Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!ukma!uunet!mcvax!mhres!jv From: jv@mhres.UUCP Newsgroups: comp.sources.bugs Subject: Re: Mail Users Shell (MUSH) - fixes for SysV Message-ID: <1362@mhres.mh.nl> Date: Fri, 2-Oct-87 05:35:32 EDT Article-I.D.: mhres.1362 Posted: Fri Oct 2 05:35:32 1987 Date-Received: Sat, 3-Oct-87 12:14:12 EDT References: <4759@ncoast.UUCP> <184800001@tiger.UUCP> Reply-To: jv@mhres.mh.nl (Johan Vromans) Organization: Multihouse N.V., The Netherlands Lines: 420 Here are the fixes I applied to MUSH to get it running on a System V (HP-UX) machine. Fixes are: eliminating _tty references using actual areas and kill characters add extra defines and declarations for types and locking and also: re-open temp file after editing, in case your editor creates a new file instead of rewriting it. ---------------- CUT HERE or FEED TO PATCH ---------------- *** ../org/curs_io.c Mon Sep 21 14:54:13 1987 --- curs_io.c Mon Sep 21 13:50:08 1987 *************** *** 48,54 /* echo isn't set, so whatever the character, enter it */ if (ison(glob_flags, ECHO_FLAG) && count < length) String[count++] = c; ! else if (c == _tty.sg_erase || c == 8 || c == 127) { if (count) { backspace() /* macro */ count--; --- 48,54 ----- /* echo isn't set, so whatever the character, enter it */ if (ison(glob_flags, ECHO_FLAG) && count < length) String[count++] = c; ! else if (c == erasechar() || c == 8 || c == 127) { if (count) { backspace() /* macro */ count--; *************** *** 56,62 String[0] = '\0'; return -1; } ! } else if (c == _tty.sg_kill) { if (count) { do backspace() /* macro */ --- 56,62 ----- String[0] = '\0'; return -1; } ! } else if (c == killchar()) { if (count) { do backspace() /* macro */ *** ../org/curses.c Mon Sep 21 07:59:44 1987 --- curses.c Mon Sep 21 13:26:57 1987 *************** *** 10,15 register char **argv; { char buf[80]; extern char *UP, ttytype[]; if (argv && *++argv && !strcmp(*argv, "-?")) --- 10,19 ----- register char **argv; { char buf[80]; + + #if 1 + char *UP = "a"; extern char ttytype[]; + #else extern char *UP, ttytype[]; #endif *************** *** 11,16 { char buf[80]; extern char *UP, ttytype[]; if (argv && *++argv && !strcmp(*argv, "-?")) return help(0, "curses", cmd_help); --- 15,21 ----- char *UP = "a"; extern char ttytype[]; #else extern char *UP, ttytype[]; + #endif if (argv && *++argv && !strcmp(*argv, "-?")) return help(0, "curses", cmd_help); *************** *** 50,55 scrollok(stdscr, TRUE); /* if the user hasn't set his screen explicitely, set it for him */ if (!do_set(set_options, "screen")) switch (_tty.sg_ospeed) { case B300 : screen = min(LINES-2, 7); when B1200 : screen = min(LINES-2, 14); --- 55,61 ----- scrollok(stdscr, TRUE); /* if the user hasn't set his screen explicitely, set it for him */ if (!do_set(set_options, "screen")) + #if 0 switch (_tty.sg_ospeed) { case B300 : screen = min(LINES-2, 7); when B1200 : screen = min(LINES-2, 14); *************** *** 57,62 otherwise : screen = LINES-2; } else screen = min(screen, LINES-2); crt = LINES; if (argc) --- 63,69 ----- otherwise : screen = LINES-2; } else + #endif screen = min(screen, LINES-2); crt = LINES; if (argc) *** ../org/hdrs.c Mon Sep 28 12:37:39 1987 --- hdrs.c Mon Sep 28 12:37:47 1987 *************** *** 349,354 } else if (*p == '%') { int buffer_space = 0; register char *p2; if (isdigit(*++p)) --- 349,355 ----- } else if (*p == '%') { int buffer_space = 0; + int sign = -1; register char *p2; if (*++p == '-') *************** *** 351,357 int buffer_space = 0; register char *p2; ! if (isdigit(*++p)) p = my_atoi(p, &buffer_space); switch (*p) { case 'f': p2 = from; --- 352,360 ----- int sign = -1; register char *p2; ! if (*++p == '-') ! sign = 1, p++; ! if (isdigit(*p)) p = my_atoi(p, &buffer_space); switch (*p) { case 'f': p2 = from; *************** *** 372,378 } if (!buffer_space) buffer_space = strlen(p2); ! (void) sprintf(b, "%-*.*s", buffer_space, buffer_space, p2); cnt += buffer_space, b += buffer_space; } else cnt++, *b++ = *p; --- 375,381 ----- } if (!buffer_space) buffer_space = strlen(p2); ! (void) sprintf(b, "%*.*s", sign * buffer_space, buffer_space, p2); cnt += buffer_space, b += buffer_space; } else cnt++, *b++ = *p; *** ../org/mail.c Mon Sep 21 16:05:14 1987 --- mail.c Mon Sep 21 16:34:36 1987 *************** *** 336,341 argv[2] = NULL; print("Starting \"%s\"...\n", argv[0]); in_editor = 1; execute(argv); in_editor = 0; turnoff(flags, EDIT); --- 336,342 ----- argv[2] = NULL; print("Starting \"%s\"...\n", argv[0]); in_editor = 1; + fclose (fp); execute(argv); in_editor = 0; turnoff(flags, EDIT); *************** *** 339,344 execute(argv); in_editor = 0; turnoff(flags, EDIT); /* upon exit of editor, user must now type ^D or "." to send */ if (istool) return 0; --- 340,350 ----- execute(argv); in_editor = 0; turnoff(flags, EDIT); + fp = fopen(edfile, "r+"); + if (!fp) { + error("can't reopen %s", edfile); + return -1; + } /* upon exit of editor, user must now type ^D or "." to send */ if (istool) return 0; *************** *** 469,474 #endif SUNTOOL (void) fputs(buf, stdout); } else { char *argv[3]; argv[0] = p; argv[1] = edfile; --- 475,481 ----- #endif SUNTOOL (void) fputs(buf, stdout); } else { + int doedit = line[1] != 'p'; char *argv[3]; argv[0] = p; argv[1] = edfile; *************** *** 474,479 argv[1] = edfile; argv[2] = NULL; in_editor = 1; execute(argv); /* page the message using pager */ in_editor = 0; if (istool) --- 481,488 ----- argv[1] = edfile; argv[2] = NULL; in_editor = 1; + if (doedit) + fclose (fp); execute(argv); /* page the message using pager */ in_editor = 0; if (doedit && !(fp = fopen (edfile, "r+"))) { *************** *** 476,481 in_editor = 1; execute(argv); /* page the message using pager */ in_editor = 0; if (istool) return 1; } --- 485,494 ----- fclose (fp); execute(argv); /* page the message using pager */ in_editor = 0; + if (doedit && !(fp = fopen (edfile, "r+"))) { + error ("can't reopen %s", edfile); + return -1; + } if (istool) return 1; } *** ../org/main.c Mon Sep 21 08:00:54 1987 --- main.c Mon Sep 21 13:27:23 1987 *************** *** 50,55 if (!isatty(0)) turnon(glob_flags, REDIRECT); f_flags[0] = '\0'; n = 0; /* don't ignore no such file or directory */ --- 50,58 ----- if (!isatty(0)) turnon(glob_flags, REDIRECT); + else + initscr (); + f_flags[0] = '\0'; n = 0; /* don't ignore no such file or directory */ *** ../org/msgs.c Mon Sep 21 08:05:31 1987 --- msgs.c Mon Sep 21 13:28:25 1987 *************** *** 2,8 #include "mush.h" #ifdef SYSV ! #include #endif SYSV void --- 2,12 ----- #include "mush.h" #ifdef SYSV ! /* #include */ ! #include ! #define locking(a,b,c) lockf(a,b,(long)(c)) ! #define LK_LOCK F_LOCK ! #define LK_UNLCK F_ULOCK #endif SYSV void *** ../org/mush.h Mon Sep 21 08:10:17 1987 --- mush.h Mon Sep 21 13:28:54 1987 *************** *** 94,99 #define savetty() (void) gtty(0, &_tty) #endif /* ~CURSES */ #define echo_on() \ if (_tty.sg_flags && isoff(glob_flags, ECHO_FLAG)) echo(), nocrmode() #define echo_off() \ --- 94,100 ----- #define savetty() (void) gtty(0, &_tty) #endif /* ~CURSES */ + #if 0 #define echo_on() \ if (_tty.sg_flags && isoff(glob_flags, ECHO_FLAG)) echo(), nocrmode() #define echo_off() \ *************** *** 98,103 if (_tty.sg_flags && isoff(glob_flags, ECHO_FLAG)) echo(), nocrmode() #define echo_off() \ if (_tty.sg_flags && isoff(glob_flags, ECHO_FLAG)) noecho(), crmode() #define strdup(dst, src) (xfree (dst), dst = savestr(src)) #define Debug if (debug) printf --- 99,108 ----- if (_tty.sg_flags && isoff(glob_flags, ECHO_FLAG)) echo(), nocrmode() #define echo_off() \ if (_tty.sg_flags && isoff(glob_flags, ECHO_FLAG)) noecho(), crmode() + #else + #define echo_on() echo(),nocrmode() + #define echo_off() noecho(),crmode() + #endif #define strdup(dst, src) (xfree (dst), dst = savestr(src)) #define Debug if (debug) printf *************** *** 104,109 #ifdef SYSV #define L_SET 0 #define F_OK 000 #define R_OK 004 #define W_OK 002 --- 109,115 ----- #ifdef SYSV #define L_SET 0 + #ifndef F_OK #define F_OK 000 #define R_OK 004 #define W_OK 002 *************** *** 107,112 #define F_OK 000 #define R_OK 004 #define W_OK 002 #define E_OK 001 #define u_long ulong_t #define vfork fork --- 113,120 ----- #define F_OK 000 #define R_OK 004 #define W_OK 002 + #endif + #ifndef E_OK #define E_OK 001 #endif typedef unsigned long ulong_t; *************** *** 108,113 #define R_OK 004 #define W_OK 002 #define E_OK 001 #define u_long ulong_t #define vfork fork #define SIGCHLD SIGCLD --- 116,123 ----- #endif #ifndef E_OK #define E_OK 001 + #endif + typedef unsigned long ulong_t; #define u_long ulong_t #define vfork fork #define SIGCHLD SIGCLD ---------------- END OF FIXES ---------------- -- Johan Vromans | jv@mh.nl via European backbone Multihouse N.V., Gouda, the Netherlands | uucp: ..{?????!}mcvax!mh.nl!jv "It is better to light a candle than to curse the darkness"