# This is a patch for mush-7.2.5unoff2.debian to update it to mush-7.2.5unoff2 # # To apply this patch: # STEP 1: Chdir to the source directory. # STEP 2: Run the 'applypatch' program with this patch file as input. # # If you do not have 'applypatch', it is part of the 'makepatch' package # that you can fetch from the Comprehensive Perl Archive Network: # http://www.perl.com/CPAN/authors/Johan_Vromans/makepatch-x.y.tar.gz # In the above URL, 'x' should be 2 or higher. # # To apply this patch without the use of 'applypatch': # STEP 1: Chdir to the source directory. # If you have a decent Bourne-type shell: # STEP 2: Run the shell with this file as input. # If you don't have such a shell, you may need to manually create # the files as shown below. # STEP 3: Run the 'patch' program with this file as input. # # These are the commands needed to create/delete files/directories: # touch 'makefile.bsdi' chmod 0644 'makefile.bsdi' touch 'makefile.freebsd' chmod 0644 'makefile.freebsd' touch 'makefile.linux' chmod 0644 'makefile.linux' touch 'makefile.solaris' chmod 0644 'makefile.solaris' touch 'makefile.sun-notool' chmod 0644 'makefile.sun-notool' # # This command terminates the shell and need not be executed manually. exit # #### End of Preamble #### #### Patch data follows #### diff -c 'mush-7.2.5unoff2.debian/README' 'mush-7.2.5unoff2/README' Index: ./README *** ./README Fri Oct 30 14:55:04 1992 --- ./README Tue May 15 12:44:47 2001 *************** *** 1,12 **** /* @(#)README (c) copyright 2/1/92 (Dan Heller) */ ! Authors: Dan Heller Bart Schaefer Network addresses: ! argv@z-code.com argv@sun.com argv@ora.com ! schaefer@zigzag.z-code.com schaefer@cse.ogi.edu When sending mail, mail to the addresses in the order given. --- 1,12 ---- /* @(#)README (c) copyright 2/1/92 (Dan Heller) */ ! Original Authors: Dan Heller Bart Schaefer Network addresses: ! argv@internezzo.com argv@well.com argv@ora.com ! schaefer@brasslantern.com barts@well.com schaefer@zanshin.com When sending mail, mail to the addresses in the order given. *************** *** 18,23 **** --- 18,24 ---- that actually -delivers- mail. Mush is copyright (c) 1986, 1987, 1988, 1989, 1990, 1991 by Dan Heller. + Copyright (c) 1994, 1995 by Network Computing Devices, Inc. All Rights Reserved. This software is not in the public domain. Redistribution of the unmodified source code is permitted as long as all *************** *** 44,51 **** Mush runs on various flavors of unix. To build mush, you should identify which unix you are running: ! SunOS (all versions from 3.5 and higher). ! BSD (versions 4.2 and up, or SunOS earlier than 3.5) System-V / Version 7 / System III (Bell Labs) Xenix (this might be tricky) Hybrids including HP-UX and IRIX (Version 4.0 and up is best) --- 45,54 ---- Mush runs on various flavors of unix. To build mush, you should identify which unix you are running: ! Solaris or a System-V Release-4 variant (including IRIX 5.x) ! LINUX, BSDI, or a POSIX-like system ! SunOS (all versions from 3.5 and higher, but not 5.x (Solaris)) ! BSD (versions 4.2 and up, or SunOS earlier than 3.5, but not BSDI) System-V / Version 7 / System III (Bell Labs) Xenix (this might be tricky) Hybrids including HP-UX and IRIX (Version 4.0 and up is best) *************** *** 72,78 **** --------------- Which makefile to use: ! If you are on a Sun Workstation: makefile.sun applies only to suns and creates a binary called "mush." If the binary ends in "tool", then the graphics (suntools) mode will be --- 75,81 ---- --------------- Which makefile to use: ! If you are on a Sun Workstation, pre-Solaris: makefile.sun applies only to suns and creates a binary called "mush." If the binary ends in "tool", then the graphics (suntools) mode will be *************** *** 84,90 **** If you know that you're not going to use the suntools mode then you should use makefile.bsd so that SUNTOOL won't be defined and unnecessary ! files will not be compiled so the binary will be smaller. Whether or not you define SUNTOOL, you should define one of SUN_3_5, SUN_4_0, or SUN_4_1 depending on your SunOS version. If SUNTOOL is --- 87,94 ---- If you know that you're not going to use the suntools mode then you should use makefile.bsd so that SUNTOOL won't be defined and unnecessary ! files will not be compiled so the binary will be smaller. You may ! also need to add -DBASENAME -DDNAME to CFLAGS. Whether or not you define SUNTOOL, you should define one of SUN_3_5, SUN_4_0, or SUN_4_1 depending on your SunOS version. If SUNTOOL is *************** *** 100,105 **** --- 104,125 ---- You should use the makefile.bsd makefile. + There may be problems building on BSD 4.4, BSDI, FreeBSD, and similar + "unencumbered" variants; these procedures have been thoroughly tested + only up to BSD 4.3. + + If you have LINUX or another closely POSIX system: + + Use makefile.linux. If you don't actually have LINUX, you may need + to try makefile.bsdi. + + If you are using RedHat 5.0, choose the CFLAGS and LIBS definitions + that omit -I/usr/include/ncurses, add -DNCURSES, and omit -ltermcap. + + If you have BSDI or a POSIX-like system: + + Use makefile.bsdi. + If you are using XENIX: There is one makefile for xenix: makefile.xenix. However, SCO-xenix *************** *** 135,147 **** It may also be desirable to change MANDIR to /usr/man/man.C and MANEXT to C in the makefile. SCO UNIX V.3.2 users should avoid -lx like the plague, and should define DIRECTORY and SELECT instead. MicroPort sys-v users should probably remove the -O compiler option from the makefile, and may have trouble with the msg_bit() macro defined in mush.h. It should be fairly trivial to generate an equivalent function. ! If you have System V Release 4: Use makefile.sys.v as above, but define SVR4 and DIRECTORY. You should also change --- 155,178 ---- It may also be desirable to change MANDIR to /usr/man/man.C and MANEXT to C in the makefile. SCO UNIX V.3.2 users should avoid -lx like the plague, and should define DIRECTORY and SELECT instead. + Suggested for SCO was + CFLAGS= -O -DSYSV -DUSG -DCURSES -DREGCMP \ + -DSIGRET=void -DDIRECTORY -DSELECT + LIBS= -ltinfo -lc_s + Under SCO 3.2v2.0 you may also need -lc, and prior to 3.2v2 you + may find you need -lPW. MicroPort sys-v users should probably remove the -O compiler option from the makefile, and may have trouble with the msg_bit() macro defined in mush.h. It should be fairly trivial to generate an equivalent function. ! Interactive UNIX users should try ! CFLAGS= -O -DSYSV -DUSG -DCURSES -DREGCMP \ ! -DSIGRET=void -DDIRECTORY ! LIBS= -lPW -ltermlib -lc_s ! ! If you have System V Release 4 (including Solaris with SunSoft compiler): Use makefile.sys.v as above, but define SVR4 and DIRECTORY. You should also change *************** *** 149,154 **** --- 180,195 ---- to LIBS= -lcurses -lgen + DG/UX 5.40 (and later?) -- change to: + LIBS= -lcurses -lgen -ldgc + + Also for DG/UX, #define MAILDIR "/usr/mail", and you may need to + add -DDGUX to CFLAGS. Also consider -lmalloc (see HP-UX, below). + + If you have Solaris but are using GCC: + + Use makefile.solaris. + If you are using Ultrix: Start with makefile.bsd. *************** *** 180,185 **** --- 221,235 ---- from the CFLAGS. This will cause the portable directory access routines in that file to be compiled. + On HP/UX up to 9.x, note use of the -lmalloc library; the behavior + of the default malloc in libc is pathologically bad for the way mush + allocates memory. HP/UX 10.x may be better, but -lmalloc is still + probably recommended. + + NOTE: ftp://hpux.cae.wisc.edu/HPUX/Networking/Mail/mush-7.2 is + reported to be pre-tweaked to compile with HPUX compilers. + However, it may not be up-to-date with the latest sources. + If you are using Apollo Domain/OS: Good luck. *************** *** 208,220 **** style select() function. If you do this, you must also add -lbsd to the OTHERLIBS macro definition in the Makefile. ! For IRIX 4.x you should add -DIRIX4 to CFLAGS and use: CC= cc -signed -cckr OTHERLIBS= -lsun -lmalloc Note that -lsun is used in place of -lbsd here. This provides network compatibility with sun workstations, or something like that. You may be able to get by with -lbsd. If you are using a hybrid BSD/SysV system: You may have to use a combination of many of the defines listed --- 258,277 ---- style select() function. If you do this, you must also add -lbsd to the OTHERLIBS macro definition in the Makefile. ! For IRIX 4.x, add -DIRIX4 -DBASENAME -DDECLARE_ERRLIST -DNO_FLOCK to ! CFLAGS and use: CC= cc -signed -cckr OTHERLIBS= -lsun -lmalloc Note that -lsun is used in place of -lbsd here. This provides network compatibility with sun workstations, or something like that. You may be able to get by with -lbsd. + Be sure to set LPR correctly in config.h, depending on whether you + installed the Berkeley or SystemV print services. Use the "versions" + command if you need to find out. + + For IRIX 5, you're on your own. Start with the SVR4 directions. + If you are using a hybrid BSD/SysV system: You may have to use a combination of many of the defines listed *************** *** 305,312 **** On a SYSV system, define MAIL_DELIVERY as /bin/rmail. POP: ! Define POP3_SUPPORT. You may also need to define HOMEMAIL; see config.h ! for additional configuration of HOMEMAIL. You will still need to define other macros appropriately for the transport agent that is used to *send* mail from your machine. --- 362,374 ---- On a SYSV system, define MAIL_DELIVERY as /bin/rmail. POP: ! Add -DPOP3_SUPPORT to your CFLAGS. You may also need to define ! HOMEMAIL; see config.h for additional configuration of HOMEMAIL. ! ! See config.h for additional POP3 definitions, including Kerberos ! and Hesiod support. If you define MAIL_FROM_POPHOST to make mush ! believe that the local host and the pop host are the same, be sure ! to adjust the definition of DEFAULT_POPHOST to your environment. You will still need to define other macros appropriately for the transport agent that is used to *send* mail from your machine. *************** *** 349,354 **** --- 411,421 ---- as /usr/spool/mail for BSD and SVR4. However, some systems are unusual, so you may need to define this explicitly. + ENV_MAIL + Define this if mush should recognize the MAIL environment variable + as the location of the spool file. The compiled-in MAILDIR is still + used by default if $MAIL is not set in the environment at startup. + MAIL_DELIVERY This is the program that mush invokes to send your messages off to your list of recipients. It defaults to "sendmail" (or "submit" for MMDF). *************** *** 433,438 **** --- 500,525 ---- System V, it has been reported, creates the .lock file without checking to see if it exists (therefore ruining someone else's lock). + NO_FLOCK + Define this if mush should NOT attempt kernel locking of mail files, + usually for NFS compatibility reasons. This forces DOT_LOCK to be + defined, so you must be able to install mush with permission to create + files in the mail spool directory. + + ROOTMAIL + When running mush from under "su root", the name of the current + user is set to the real user logged in on the terminal. This + makes mail appear to originate from the real user, rather than + from "root", but it also causes "root" to access the real user's + folders, which may cause confusion later (especially if the user + saves mail to new files, which will then be owned by root). To + turn OFF this behavior, define ROOTMAIL. + + MAIL_FROM_POPHOST + When using POP3_SUPPORT, define MAIL_FROM_POPHOST if mush should + hide the client's machine name when creating From: headers for + outbound mail, etc. + --------------- Signals: *************** *** 517,522 **** --- 604,632 ---- This should be defined if your system uses the getwd() system call, as opposed to getcwd(), and your system is not a BSD system (e.g. MIPS). + BASENAME + This should be defined if your system does NOT supply a basename() + function (to extract the trailing file name from a full path). + + DECLARE_ERRLIST + Define this if you get unresolved symbol errors for sys_errlist[]. + + POSIX_UTIME_USEC + Define this if you have POSIX-style time structures but they also + contain a "modusec" field for microseconds. (Who has this?) + + NCURSES + Define this if you have ncurses but do NOT use the default style of + installation in /usr/include/ncurses/curses.h. When NCURSES is + predefined, mush.h looks for instead. If you have the + standard installation, add -I/usr/include/ncurses to CFLAGS and do + not define NCURSES. + + DEFINE_CURSES_SGTTY + Define this if your curses header files do not provide a typedef + for the SGTTY type. This applies to Linux (see makefile.linux) and + probably to other POSIX systems and/or those using NCURSES. + --------------- The sprintf() function: If you *know* your system's sprintf returns a char *, you can remove the *************** *** 533,538 **** --- 643,652 ---- normally be defined for xenix and System-V Unix. If you don't have REGCMP defined, then the routines re_comp() and re_exec() are used (this is the default for mush). + + You can link with regcomp() and regexec() if you define REGCOMP (note + the `O'), rather than regcmp() or re_comp(). This is otherwise like + regcmp()/regex(). Note that some systems do not have either set of routines in the default libraries. You must find the library to use and add it to the list of diff -c 'mush-7.2.5unoff2.debian/addrs.c' 'mush-7.2.5unoff2/addrs.c' Index: ./addrs.c *** ./addrs.c Fri Oct 30 14:55:26 1992 --- ./addrs.c Tue May 15 13:18:23 2001 *************** *** 45,51 **** continue; (void) bang_form(buf, listv[l]); if (strcmp(listv[l], buf)) /* if they differ... */ ! (void) strdup(listv[l], buf); /* save new version */ } Debug("\nlist1 = "), print_argv(listv); --- 45,51 ---- continue; (void) bang_form(buf, listv[l]); if (strcmp(listv[l], buf)) /* if they differ... */ ! (void) strdup1(listv[l], buf); /* save new version */ } Debug("\nlist1 = "), print_argv(listv); diff -c 'mush-7.2.5unoff2.debian/command2.c' 'mush-7.2.5unoff2/command2.c' Index: ./command2.c Prereq: 1991 *** ./command2.c Tue May 15 12:28:52 2001 --- ./command2.c Tue May 15 13:18:34 2001 *************** *** 516,522 **** int done = 0, snooze = 30, last_cnt = msg_cnt; char* me = argv[0]; ! int check = !strncmp(me, "check"); int old_time_out; int interact = 1; --- 516,522 ---- int done = 0, snooze = 30, last_cnt = msg_cnt; char* me = argv[0]; ! int check = !strncmp(me, "check", 5); int old_time_out; int interact = 1; diff -c 'mush-7.2.5unoff2.debian/commands.c' 'mush-7.2.5unoff2/commands.c' Index: ./commands.c *** ./commands.c Tue May 15 12:28:52 2001 --- ./commands.c Tue May 15 13:00:34 2001 *************** *** 507,513 **** if (!strcmp(cmd, "replyall")) Upper(*cmd); if (n > 0) ! strdup(argv[0], cmd); /* make sure the *current* message is the one being replied to */ for (current_msg = -1, n = 0; n < msg_cnt && current_msg == -1; n++) --- 507,513 ---- if (!strcmp(cmd, "replyall")) Upper(*cmd); if (n > 0) ! strdup1(argv[0], cmd); /* make sure the *current* message is the one being replied to */ for (current_msg = -1, n = 0; n < msg_cnt && current_msg == -1; n++) diff -c 'mush-7.2.5unoff2.debian/config.h' 'mush-7.2.5unoff2/config.h' Index: ./config.h *** ./config.h Tue May 15 12:28:52 2001 --- ./config.h Tue May 15 14:26:10 2001 *************** *** 149,155 **** #define POP3_SUPPORT /**/ #ifdef POP3_SUPPORT #ifndef DEBIAN ! #define HOMEMAIL #endif #ifdef HOMEMAIL #define POPMAILFILE "Mailbox.pop" --- 149,155 ---- #define POP3_SUPPORT /**/ #ifdef POP3_SUPPORT #ifndef DEBIAN ! // #define HOMEMAIL #endif #ifdef HOMEMAIL #define POPMAILFILE "Mailbox.pop" *************** *** 218,228 **** */ /* #define LCKDFLDIR "/usr/spool/mmdf/lockfiles" /* (for example) */ #else /* !MMDF */ ! #if defined(FSSTND) || defined(M_XENIX) #ifndef DOT_LOCK #define DOT_LOCK /* DOT_LOCK should be used for SCO Xenix */ #endif ! #endif /* M_XENIX */ #endif /* MMDF */ #ifdef DOT_LOCK --- 218,228 ---- */ /* #define LCKDFLDIR "/usr/spool/mmdf/lockfiles" /* (for example) */ #else /* !MMDF */ ! /* #if defined(FSSTND) || defined(M_XENIX) */ #ifndef DOT_LOCK #define DOT_LOCK /* DOT_LOCK should be used for SCO Xenix */ #endif ! /* #endif /* M_XENIX */ #endif /* MMDF */ #ifdef DOT_LOCK *************** *** 231,236 **** --- 231,239 ---- #endif #endif + #define HAS_BZERO 1 + #define HAS_STRSTR 1 + #ifdef HOMEMAIL #define MAILFILE "Mailbox" #else /* HOMEMAIL */ *************** *** 254,262 **** * shipped needs this, but note that if you are allowing mush to default * to SUN_4_1 (see the end of this file) you won't get this. */ ! #ifdef SUN_4_1 /* SunOS 4.1 has warped sendmail.cf */ #define NO_COMMAS /**/ ! #endif /* SUN_4_1 */ /* * Most RFC822-compliant mailers (sendmail) will add the headers From: --- 257,265 ---- * shipped needs this, but note that if you are allowing mush to default * to SUN_4_1 (see the end of this file) you won't get this. */ ! #if defined(SUN_4_1) || defined(QMAIL) /* SunOS 4.1 has warped sendmail.cf */ #define NO_COMMAS /**/ ! #endif /* SUN_4_1 || QMAIL */ /* * Most RFC822-compliant mailers (sendmail) will add the headers From: diff -c 'mush-7.2.5unoff2.debian/config.h-dist' 'mush-7.2.5unoff2/config.h-dist' Index: ./config.h-dist *** ./config.h-dist Tue May 15 12:28:52 2001 --- ./config.h-dist Tue May 15 12:44:47 2001 *************** *** 52,58 **** #define EDFILE ".edXXXXXX" /* file/pathname added to user's "home" */ #define LS_COMMAND "ls" - #define LPR "lpr" #define DEF_PRINTER "lp" /* If your lpr command understands only -P or -d (or some other flag) then * define PRINTER_OPT to the appropriate value. If you want to be able to --- 52,57 ---- *************** *** 62,70 **** * arguments, include a trailing space in this definition. */ #ifdef SYSV #define PRINTER_OPT "-d" #endif /* SYSV */ ! #ifdef BSD #define PRINTER_OPT "-P" #endif /* BSD */ --- 61,71 ---- * arguments, include a trailing space in this definition. */ #ifdef SYSV + #define LPR "lp" #define PRINTER_OPT "-d" #endif /* SYSV */ ! #if defined(BSD) || defined(linux) ! #define LPR "lpr" #define PRINTER_OPT "-P" #endif /* BSD */ *************** *** 174,179 **** --- 175,181 ---- #define MAIL_DELIVERY "/usr/lib/mail/execmail" # define VERBOSE_ARG "-v" # define METOO_ARG "-m" + #define MTA_EXIT 0 /* exit status for successful execmail */ #else /* M_EXECMAIL */ #define MAIL_DELIVERY "exec /usr/mmdf/bin/submit -mlnr" #define VERBOSE_ARG "Ww" *************** *** 241,247 **** --- 243,257 ---- #if defined(SYSV) && !defined(SVR4) #define MAILDIR "/usr/mail" #else /* BSD || SVR4 */ + #ifdef BSD44 + #define MAILDIR "/var/mail" + #else + #ifdef linux + #define MAILDIR "/var/spool/mail" + #else #define MAILDIR "/usr/spool/mail" + #endif /* linux */ + #endif /* BSD44 */ #endif /* SYSV && !SVR4 */ #endif /* FSSTND */ #endif /* MAILDIR */ diff -c 'mush-7.2.5unoff2.debian/curs_io.c' 'mush-7.2.5unoff2/curs_io.c' Index: ./curs_io.c *** ./curs_io.c Tue May 15 12:28:52 2001 --- ./curs_io.c Tue May 15 13:12:38 2001 *************** *** 35,41 **** { int is_tty = isatty(0); ! if (is_tty) savetty(); #if defined(SYSV) || defined(AIX) --- 35,44 ---- { int is_tty = isatty(0); ! if (ison(glob_flags, PRE_CURSES)) { ! return; ! } ! if (is_tty && iscurses) savetty(); #if defined(SYSV) || defined(AIX) *************** *** 719,725 **** for (i = 0; i < fcnt; i++) { if (flist[i][0] == '.' && !any(flist[i], FMETA)) { (void) strcpy(b, flist[i]); ! (void) strdup(flist[i], buf); } } Debug("ignoring "), print_argv(flist); --- 722,728 ---- for (i = 0; i < fcnt; i++) { if (flist[i][0] == '.' && !any(flist[i], FMETA)) { (void) strcpy(b, flist[i]); ! (void) strdup1(flist[i], buf); } } Debug("ignoring "), print_argv(flist); diff -c 'mush-7.2.5unoff2.debian/curses.c' 'mush-7.2.5unoff2/curses.c' Index: ./curses.c *** ./curses.c Tue May 15 12:28:52 2001 --- ./curses.c Tue May 15 13:38:00 2001 *************** *** 524,530 **** when C_EXIT : case C_EXIT_HARD : clr_bot_line(); - iscurses = FALSE; if (c != C_EXIT && c != C_EXIT_HARD) putchar('\n'); cleanup(0); --- 524,529 ---- *************** *** 783,794 **** putchar('\n'); return 0; } ! print("Update folder [y]? "); ! if ((c = getchar()) != 'y' && c != 'Y' && c != '\n' && !isspace(c)) { ! print("Folder unchanged."); ! if (ison(glob_flags, CNTD_CMD)) ! putchar('\n'); ! return 0; } if (*redo < 0) return 1; --- 782,795 ---- putchar('\n'); return 0; } ! if (chk_option("verify", "update")) { ! print("Update folder [y]? "); ! if ((c = getchar()) != 'y' && c != 'Y' && c != '\n' && !isspace(c)) { ! print("Folder unchanged."); ! if (ison(glob_flags, CNTD_CMD)) ! putchar('\n'); ! return 0; ! } } if (*redo < 0) return 1; *************** *** 862,868 **** break; } } ! strdup(format[i], buf); /* replace word with its "definition" */ } /* Columnate the output nicely */ if (mxm > 0) { --- 863,869 ---- break; } } ! strdup1(format[i], buf); /* replace word with its "definition" */ } /* Columnate the output nicely */ if (mxm > 0) { diff -c 'mush-7.2.5unoff2.debian/dates.c' 'mush-7.2.5unoff2/dates.c' Index: ./dates.c Prereq: 3.0 *** ./dates.c Tue May 15 12:28:52 2001 --- ./dates.c Tue May 15 12:44:47 2001 *************** *** 123,129 **** { struct tm *T; char *tz; ! #if defined(SYSV) || defined(TIMEZONE) long x; (void) time(&x); --- 123,129 ---- { struct tm *T; char *tz; ! #if defined(SYSV) || defined(TIMEZONE) || defined(POSIX) long x; (void) time(&x); *************** *** 134,140 **** tz = tzname[T->tm_isdst]; } #endif /* TIMEZONE */ ! #else /* SYSV || TIMEZONE */ extern char *timezone(); struct timeval mytime; struct timezone myzone; --- 134,140 ---- tz = tzname[T->tm_isdst]; } #endif /* TIMEZONE */ ! #else /* SYSV || TIMEZONE || POSIX */ extern char *timezone(); struct timeval mytime; struct timezone myzone; *************** *** 282,288 **** /* day_number month_name year_number time-timezone (day) */ /* ^no colon separator */ ! if (sscanf(p, "%d %s %d %2d%2d%1[-+]%6[0123456789]", &Day, month, &Year, &Hours, &Mins, &Secs, &Zone[0], &Zone[1]) == 8) goto gotit; if (sscanf(p, "%d %s %d %2d%2d-%7s", /* Does this _ever_ hit? */ --- 282,288 ---- /* day_number month_name year_number time-timezone (day) */ /* ^no colon separator */ ! if (sscanf(p, "%d %s %d %2d%2d%2d%1[-+]%6[0123456789]", &Day, month, &Year, &Hours, &Mins, &Secs, &Zone[0], &Zone[1]) == 8) goto gotit; if (sscanf(p, "%d %s %d %2d%2d-%7s", /* Does this _ever_ hit? */ diff -c 'mush-7.2.5unoff2.debian/doproc.c' 'mush-7.2.5unoff2/doproc.c' Index: ./doproc.c *** ./doproc.c Fri Oct 30 14:55:08 1992 --- ./doproc.c Tue May 15 12:44:47 2001 *************** *** 758,765 **** for (item = (Panel_item) panel_get(item, PANEL_NEXT_ITEM); item; item = next) { next = (Panel_item) panel_get(item, PANEL_NEXT_ITEM); ! (void) panel_set(item, ! PANEL_SHOW_ITEM, (i++ < 1)? !getting : getting, NULL); } } --- 758,769 ---- for (item = (Panel_item) panel_get(item, PANEL_NEXT_ITEM); item; item = next) { next = (Panel_item) panel_get(item, PANEL_NEXT_ITEM); ! /* Don't erase choices and toggles - Ick */ ! if (!panel_get(item, PANEL_CHOICE_STRING, 0) || ! panel_get(item, PANEL_LABEL_IMAGE)) ! (void) panel_set(item, ! PANEL_SHOW_ITEM, (i < 1) ? !getting : getting, NULL); ! i++; } } *************** *** 799,804 **** --- 803,812 ---- ok_box(buf) char *buf; { + if (!istool) { + print("%s", buf); + return; + } #ifdef SUN_4_0 (void) alert_prompt(tool, (Event *)NULL, ALERT_MESSAGE_STRINGS, buf, NULL, diff -c 'mush-7.2.5unoff2.debian/file.c' 'mush-7.2.5unoff2/file.c' Index: ./file.c *** ./file.c Tue May 15 12:28:52 2001 --- ./file.c Tue May 15 12:44:47 2001 *************** *** 36,43 **** * look for ~user or ~user/subpath * if '/' exists, separate into tmp="user" p="subpath" */ ! struct passwd *ent, *getpwnam(); ! char *p2 = p+1; if (p = index(p2, '/')) *p++ = 0; if (!(ent = getpwnam(p2))) { --- 36,44 ---- * look for ~user or ~user/subpath * if '/' exists, separate into tmp="user" p="subpath" */ ! struct passwd *ent; ! char tmp[MAXPATHLEN], *p2 = tmp+1; ! strcpy(tmp, p); if (p = index(p2, '/')) *p++ = 0; if (!(ent = getpwnam(p2))) { diff -c 'mush-7.2.5unoff2.debian/folders.c' 'mush-7.2.5unoff2/folders.c' Index: ./folders.c *** ./folders.c Tue May 15 12:28:52 2001 --- ./folders.c Tue May 15 16:24:35 2001 *************** *** 85,91 **** */ n = 0; if (*tmp != '/') { ! if (!GetCwd(buf, sizeof buf)) { error("getcwd: %s",buf); return -1; } --- 85,92 ---- */ n = 0; if (*tmp != '/') { ! buf[0] = '\0'; ! if (GetCwd(buf, sizeof buf) == NULL) { error("getcwd: %s",buf); return -1; } *************** *** 107,114 **** return -1; } /* If the file can't be opened for writing, autoset READ_ONLY */ ! if (Access(buf, W_OK) < 0) do_read_only = 1; if (!(n=copyback(updating?"Update folder?":"Change anyway?",!updating))) { #ifdef SUNTOOL --- 108,117 ---- return -1; } /* If the file can't be opened for writing, autoset READ_ONLY */ ! if ((n = open(buf, O_RDWR)) < 0) do_read_only = 1; + else + close(n); if (!(n=copyback(updating?"Update folder?":"Change anyway?",!updating))) { #ifdef SUNTOOL *************** *** 124,130 **** n = 1; /* force load of new folder */ if (!updating) (void) strcpy(oldfolder, *oldfolder? mailfile : buf); ! strdup(mailfile, buf); } do_read_only? turnon(glob_flags,READ_ONLY) : turnoff(glob_flags,READ_ONLY); last_size = spool_size = 0L; --- 127,133 ---- n = 1; /* force load of new folder */ if (!updating) (void) strcpy(oldfolder, *oldfolder? mailfile : buf); ! strdup1(mailfile, buf); } do_read_only? turnon(glob_flags,READ_ONLY) : turnoff(glob_flags,READ_ONLY); last_size = spool_size = 0L; *************** *** 411,417 **** { int r, articles = 0, merge = 0, appending = 0; char buf[MAXPATHLEN], cmdbuf[MAXPATHLEN], newlist[MAXMSGS_BITS], *dir; ! char *art_sep = ARTICLE_SEP, *mktemp(); FILE *fp; while (argv && *++argv && **argv == '-') { --- 414,420 ---- { int r, articles = 0, merge = 0, appending = 0; char buf[MAXPATHLEN], cmdbuf[MAXPATHLEN], newlist[MAXMSGS_BITS], *dir; ! char *art_sep = ARTICLE_SEP; FILE *fp; while (argv && *++argv && **argv == '-') { *************** *** 677,683 **** if (fputs(from, fp) == EOF) #endif /* MSG_SEPARATOR */ art_cnt = -1; ! if (!(p = header_field(n, "from"))) p = "Mush-Undigest (Real author unknown)"; if (fprintf(fp, "From: %s\n", p) == EOF) art_cnt = -1; --- 680,687 ---- if (fputs(from, fp) == EOF) #endif /* MSG_SEPARATOR */ art_cnt = -1; ! if (!(p = header_field(n, "from")) ! && !(p = header_field(n, "newsgroups"))) p = "Mush-Undigest (Real author unknown)"; if (fprintf(fp, "From: %s\n", p) == EOF) art_cnt = -1; diff -c 'mush-7.2.5unoff2.debian/glob.c' 'mush-7.2.5unoff2/glob.c' Index: ./glob.c *** ./glob.c Tue May 15 12:28:52 2001 --- ./glob.c Tue May 15 12:44:47 2001 *************** *** 1,6 **** --- 1,26 ---- + /* glob.c Copyright 1990, 1991 Z-Code Software Corp. */ + + #ifndef TEST #include "mush.h" + #else /* !TEST */ + #include + #ifdef BSD + #define DIRECTORY + #include + #include + #include + #endif /* BSD */ + #endif /* TEST */ + #include "glob.h" + static int fxp(), pglob(), dglob(), fglob(), fglob(), sxp(); + + #ifndef BSD + #undef bcopy + #define bcopy(s,d,n) memcpy(d,s,n) + #endif /* BSD */ + /* * Buried somewhere in here is the skeleton of a pattern matcher posted * by koblas@mips.COM (David Koblas). It has been hacked almost beyond *************** *** 27,36 **** #define min(x,y) ((x) > (y) ? (y) : (x)) #endif /* min */ #define xfree free #undef wprint #define wprint printf #define debug 0 ! #undef sprintf #define TESTGLOB(str1,str2) \ printf("%s %s = %s\n",str1,str2,glob(str1,str2)?"TRUE":"FALSE") --- 47,63 ---- #define min(x,y) ((x) > (y) ? (y) : (x)) #endif /* min */ #define xfree free + #define free_vec(v) \ + do { int i; for (i = 0; (v) && (v)[i]; free((v)[i++])); } while (0) #undef wprint #define wprint printf #define debug 0 ! ! #define DUBL_NULL (char **)0 ! #define TRPL_NULL (char ***)0 ! #define TRUE 1 ! #define FALSE 0 ! #define MAXPATHLEN 1024 #define TESTGLOB(str1,str2) \ printf("%s %s = %s\n",str1,str2,glob(str1,str2)?"TRUE":"FALSE") *************** *** 46,54 **** while (*++argv) { (void) printf("%s -->\n", *argv); if (f = filexp(*argv, &e)) { ! columnate(f, e, 0); } } #ifdef TEST2 /* Define TEST2 to automatically run these test cases */ TESTGLOB("abcdefg", "abcdefg"); TESTGLOB("abcdefg", "a?cd?fg"); --- 73,92 ---- while (*++argv) { (void) printf("%s -->\n", *argv); if (f = filexp(*argv, &e)) { ! (void) columnate(f, e, 0, (char ***)0); } } + else { + char buf[1024]; + + e = (char **)0; + f = 0; + while (fgets(buf, sizeof buf, stdin)) { + buf[strlen(buf)-1] = 0; + f = catv(f, &e, 1, unitv(buf)); + } + (void) columnate(f, e, 0, (char ***)0); + } #ifdef TEST2 /* Define TEST2 to automatically run these test cases */ TESTGLOB("abcdefg", "abcdefg"); TESTGLOB("abcdefg", "a?cd?fg"); *************** *** 62,68 **** TESTGLOB("./der/den/deq/der/", "*deq*"); TESTGLOB("./bc/def/gh/ij", "*ij"); TESTGLOB("./ij", ".?ij"); ! TESTGLOB("./bc/def/gh/ij", "./*"); TESTGLOB("abcdef", "*def"); TESTGLOB("abcdef", "*abcdef"); TESTGLOB("abcdef", "abc*"); --- 100,106 ---- TESTGLOB("./der/den/deq/der/", "*deq*"); TESTGLOB("./bc/def/gh/ij", "*ij"); TESTGLOB("./ij", ".?ij"); ! TESTGLOB("./bc/def/gh/ij", "./\052"); /* dot-slash-star */ TESTGLOB("abcdef", "*def"); TESTGLOB("abcdef", "*abcdef"); TESTGLOB("abcdef", "abc*"); *************** *** 96,122 **** return 0; } ! #endif /* TEST */ /* ! * Make a string into a one-element vector */ ! char ** ! unitv(s) ! char *s; { ! char **v; ! if (v = (char **)malloc((unsigned)(2 * sizeof(char *)))) { ! v[0] = savestr(s); ! v[1] = NULL; } ! return v; } /* ! * Append one vector to another */ catv(s1, v1, s2, v2) int s1, s2; char ***v1, **v2; --- 134,209 ---- return 0; } ! char * ! rany(s1, s2) ! register char *s1, *s2; ! { ! register char *p, *p2 = s1; ! ! if (!s1 || !*s1 || !s2 || !*s2) ! return NULL; ! s1 += strlen(s1); /* Skip to last character in s1 */ ! while (s1-- > p2) { ! for (p = s2; *p; p++) ! if (*p == *s1) ! return s1; ! } ! return NULL; ! } /* ! * Copy a vector -- returns number of elements */ ! vcpy(v1, v2) ! char ***v1, **v2; { ! int i, s2; ! if (!v1 || !v2) ! return -1; ! for (s2 = 0; v2[s2]; s2++) ! ; ! *v1 = (char **)malloc((unsigned)((s2 + 1) * sizeof(char **))); ! if (*v1) { ! for (i = 0; i < s2; i++) { ! (*v1)[i] = savestr(v2[i]); ! if (!(*v1)[i]) { ! free_vec(*v1); ! *v1 = DUBL_NULL; ! return -1; ! } ! } ! (*v1)[i] = NULL; ! return i; } ! return -1; } /* ! * Append one vector to another -- frees v2 */ + vcat(v1, v2) + char ***v1, **v2; + { + int s1 = 0, s2 = 0; + + if (!v1) + return -1; + if (*v1) + for (s1 = 0; (*v1)[s1]; s1++) + ; + if (v2) + for (s2 = 0; v2[s2]; s2++) + ; + return catv(s1, v1, s2, v2); + } + + #endif /* TEST */ + + /* + * Speedier vector append when sizes are known + */ + static catv(s1, v1, s2, v2) int s1, s2; char ***v1, **v2; *************** *** 131,150 **** /* realloc(NULL, size) should be legal, but Sun doesn't support it. */ if (*v1) *v1 = (char **)realloc(*v1,(unsigned)((s1+s2+1) * sizeof(char **))); ! else ! *v1 = (char **)malloc((unsigned)((s1+s2+1) * sizeof(char **))); if (*v1) { for (i = 0; i < s2 && v2[i]; i++) (*v1)[s1 + i] = v2[i]; (*v1)[s1 + i] = NULL; ! xfree(v2); return s1 + i; } return -1; } /* * A duplicate-eliminating comparison for sorting. It treats an empty * string as greater than any other string, and forces empty one of any * pair of of equal strings. Two passes are sufficient to move the empty --- 218,257 ---- /* realloc(NULL, size) should be legal, but Sun doesn't support it. */ if (*v1) *v1 = (char **)realloc(*v1,(unsigned)((s1+s2+1) * sizeof(char **))); ! else { ! *v1 = v2; /* Do the obvious optimzation */ ! return s2; ! } if (*v1) { for (i = 0; i < s2 && v2[i]; i++) (*v1)[s1 + i] = v2[i]; (*v1)[s1 + i] = NULL; ! xfree((char *)v2); return s1 + i; } return -1; } /* + * Make a string into a one-element vector + */ + static + char ** + unitv(s) + char *s; + { + char **v; + + if (v = (char **)malloc((unsigned)(2 * sizeof(char *)))) { + v[0] = savestr(s); + v[1] = NULL; + } + return v; + } + + #ifdef NOT_NOW + /* * A duplicate-eliminating comparison for sorting. It treats an empty * string as greater than any other string, and forces empty one of any * pair of of equal strings. Two passes are sufficient to move the empty *************** *** 153,158 **** --- 260,266 ---- * This is NOT compatible with the ANSI C qsort(), which requires that the * comparison function will not modify its arguments! */ + int uniqcmp(p1, p2) char **p1, **p2; { *************** *** 167,206 **** **p2 = 0; return -1; } /* * Expand a pattern into a list of file names. Returns the number of * matches. As in csh, names generated from pattern sets are returned * even if there are no actual matches. */ filexp(pat, exp) char *pat, ***exp; { char **t1, **t2; ! int n, new, cnt; if (!exp) return -1; if (!pat || !*pat) return 0; if ((n = sxp(pat, &t1)) > 0) cnt = 0; else return n; *exp = DUBL_NULL; while (n--) ! if ((new = fxp(t1[n], &t2)) > 0 || new++ == 0 && t2) cnt = catv(cnt, exp, new, t2); - if (cnt > 1) { - /* Two sort passes to eliminate duplicates -- see uniqcmp() */ - qsort((char *)*exp, cnt, sizeof(char *), uniqcmp); - qsort((char *)*exp, cnt, sizeof(char *), uniqcmp); - while (!(*exp)[cnt - 1][0]) { - xfree((*exp)[--cnt]); - (*exp)[cnt] = NULL; } ! } return cnt; } --- 275,385 ---- **p2 = 0; return -1; } + #endif /* NOT_NOW */ + + /* + * String comparison function for qsort. An empty string is greater + * than any other, otherwise strcmp is used. + */ + static + int + strptrcmp(v1, v2) + void *v1, *v2; + { + char **p1, **p2; + + p1 = (char **)v1; p2 = (char **)v2; + if (!**p1 || !**p2) + return **p2 - **p1; + return strcmp(*p1, *p2); + } + + /* + * Remove duplicate entries in a sorted array, usually the result of qsort. + * Returns the number of unique entries, or -1 on error. + * Moves the redundant stuff to the end, in case it needs to be deallocated + * or something. + */ + static + int + crunch(base, nel, width, cmp) + char *base; + int nel, width, (*cmp)(); + { + int i, j; + char *temp = malloc(width); + + if (!temp) + return -1; + + j = 0; + for (i = 0; i < nel; ++i) { + if (i == 0 || (*cmp)(base+i*width, base+(j-1)*width) != 0) { + if (i != j) { + bcopy(base+j*width, temp, width); + bcopy(base+i*width, base+j*width, width); + bcopy(temp, base+i*width, width); + } + j++; + } + } + + xfree(temp); + + return j; + } + + /* + * Qsort and remove duplicates. Returns the final number of entries. + */ + static + int + qsort_and_crunch(base, nel, width, cmp) + char *base; + int nel, width, (*cmp)(); + { + qsort(base, nel, width, cmp); + return crunch(base, nel, width, cmp); + } /* * Expand a pattern into a list of file names. Returns the number of * matches. As in csh, names generated from pattern sets are returned * even if there are no actual matches. */ + int filexp(pat, exp) char *pat, ***exp; { char **t1, **t2; ! int n, new, crunched_new, cnt; if (!exp) return -1; if (!pat || !*pat) return 0; + /* Note that sxp() returns its list in reverse order, so we then + * step through it in reverse order to complete the expansion. + */ if ((n = sxp(pat, &t1)) > 0) cnt = 0; else return n; *exp = DUBL_NULL; while (n--) ! if ((new = fxp(t1[n], &t2)) > 0 || new++ == 0 && t2) { ! if (new > 1) { ! crunched_new = ! qsort_and_crunch((char *)t2, new, sizeof(char *), strptrcmp); ! while (new > crunched_new) { ! xfree(t2[--new]); ! t2[new] = NULL; ! } ! } cnt = catv(cnt, exp, new, t2); } ! free_vec(t1); return cnt; } *************** *** 213,218 **** --- 392,399 ---- * The list of expansions is placed in *exp, and the number of matches * is returned, or -1 on an error. */ + static + int fxp(name, exp) char *name, ***exp; { *************** *** 228,234 **** return -1; else if (isdir) return ((*exp = unitv(p)) ? 1 : -1); ! return pglob(p, 0, exp); } /* --- 409,415 ---- return -1; else if (isdir) return ((*exp = unitv(p)) ? 1 : -1); ! return pglob((*name == '\\') ? name : p, 0, exp); } /* *************** *** 243,248 **** --- 424,431 ---- * and returned even when there are no matches (ala csh generation of names * from pattern sets). pglob() still returns zero in this case. */ + static + int pglob(path, skip, exp) char *path, ***exp; int skip; *************** *** 254,261 **** return -1; *exp = DUBL_NULL; /* Must be null in case of zero matches and no sets */ ! for (t = t2 = path + skip; (t2 = any(t2, META)) && *t2 == '/'; t = t2++) ! ; if (!t2) { ret = ((*exp = unitv(path)) ? 1 : -1); if (ret > 0 && Access(path, F_OK) < 0) --- 437,446 ---- return -1; *exp = DUBL_NULL; /* Must be null in case of zero matches and no sets */ ! for (t = t2 = path + skip; (t2 = any(t2, META)); t = t2++) { ! if (*t2 != '/') ! break; ! } if (!t2) { ret = ((*exp = unitv(path)) ? 1 : -1); if (ret > 0 && Access(path, F_OK) < 0) *************** *** 273,310 **** ret = dglob("", t, t2, exp); } } return ret; } /* * Search a directory (possibly recursively) for glob matches. * Argument pat1 is a pattern to be matched in this directory, * and pat2 is a pattern to be matched in matched subdirectories. * * Matches are returned through *exp. */ dglob(dir, pat1, pat2, exp) char *dir, *pat1, *pat2, ***exp; { DIR *dirp; struct dirent *dp; ! char *b, *d, buf[MAXPATHLEN], **tmp; ! int n, ret = 0, skip; if (!dir || !exp) return -1; d = (*dir ? dir : "."); ! if (!(dirp = opendir(d))) ! return -1; b = buf + Strcpy(buf, dir); if (b > buf && *(b - 1) != '/') *b++ = '/'; skip = b - buf; /* We know this much matches, don't glob it again */ while (ret >= 0 && (dp = readdir(dirp))) { if (fglob(dp->d_name, pat1)) { if (pat2) { (void) sprintf(b, "%s/%s", dp->d_name, pat2); ! n = pglob(buf, skip, &tmp); ret = catv(ret, exp, n, tmp); } else { (void) strcpy(b, dp->d_name); --- 458,558 ---- ret = dglob("", t, t2, exp); } } + /* + * If we're going to return zero with something in exp, then we're + * returning for an sxp() pattern as described above. Strip the + * '\\' character as if we'd actually found a file that matches. + * Note that in this case we know there's only one element in exp. + */ + if (ret == 0 && *exp && **exp) { + for (t = t2 = exp[0][0]; t && *t; *t2++ = *t++) { + if (*t == '\\' && t[1]) + t++; + } + *t2 = 0; + } return ret; } /* + * Terminate a failing dglob() by gluing a path name back together out + * of the several components. If the reassembled path doesn't contain + * any globbing metacharacters, add it to the exp list. This deals with + * the lowest level {foo,bar} pattern notation as described for pglob(). + * + * Note that we know from the circumstances in which this is called by + * dglob() that the exp array is empty within xglob()'s context. This + * function should be considered part of dglob() and should not be used + * from other parts of the code. If C could do nested function decls, + * this would be a perfect candidate. + */ + static int + xglob(buf, b, pat1, pat2, exp) + char *buf, *b; + char *pat1, *pat2; + char ***exp; + { + while (*pat1) { + if (index(FMETA, *pat1)) + return 0; + else if (*pat1 == '\\' && pat1[1]) + pat1++; + *b++ = *pat1++; + } + if (pat2) { + *b++ = '/'; + while (*pat2) { + if (index(FMETA, *pat2)) + return 0; + else if (*pat2 == '\\' && pat2[1]) + pat2++; + *b++ = *pat2++; + } + } + *b = 0; + return catv(0, exp, 1, unitv(buf)); + } + + /* * Search a directory (possibly recursively) for glob matches. * Argument pat1 is a pattern to be matched in this directory, * and pat2 is a pattern to be matched in matched subdirectories. * * Matches are returned through *exp. */ + static + int dglob(dir, pat1, pat2, exp) char *dir, *pat1, *pat2, ***exp; { DIR *dirp; struct dirent *dp; ! char *b, buf[MAXPATHLEN], **tmp; ! char *d; ! int n, ret = 0, skip, hits = 0; if (!dir || !exp) return -1; d = (*dir ? dir : "."); ! b = buf + Strcpy(buf, dir); if (b > buf && *(b - 1) != '/') *b++ = '/'; + + errno = 0; + if (!(dirp = opendir(d))) { + if ((errno == ENOENT || errno == ENOTDIR) && + xglob(buf, b, pat1, pat2, exp) > 0) + return 0; + return -1; + } skip = b - buf; /* We know this much matches, don't glob it again */ while (ret >= 0 && (dp = readdir(dirp))) { if (fglob(dp->d_name, pat1)) { + hits++; if (pat2) { (void) sprintf(b, "%s/%s", dp->d_name, pat2); ! n = pglob(buf, skip + strlen(dp->d_name), &tmp); ret = catv(ret, exp, n, tmp); } else { (void) strcpy(b, dp->d_name); *************** *** 313,324 **** --- 561,576 ---- } } closedir(dirp); + if (hits == 0 && *pat1) + (void) xglob(buf, b, pat1, pat2, exp); return ret; } /* * Match file names. This means that metachars do not match leading ".". */ + static + int fglob(str, pat) char *str, *pat; { *************** *** 344,349 **** --- 596,685 ---- } /* + * Match a pattern set {s1,s2,...} followed by any other pattern. + * Pattern sets and other patterns may nest arbitrarily. + * + * If "mat" is not a null pointer, a vector of possible expansions + * is generated and placed in *mat; otherwise, the expansions are + * matched against str and a truth value is returned ("/" is NOT + * treated as a directory separator in this case). NOTE: The vector + * of expansions may still contain nested pattern sets, which must + * be expanded separately. See sxp(). + * + * Currently allows at most 256 alternatives per set. Enough? :-) + */ + static int + sglob(str, pat, mat) + char *str, *pat, ***mat; + { + char *p, *newpat[256], *oldpat[256], buf[MAXPATHLEN], *b = buf; + int copy = 1, had_nest = 0, nest = 0, i = 0, ret = 0; + + if (!pat) + return FALSE; + + while (*pat) { + if (copy) + if (*pat != '{') /*}*/ { + if (*pat == '\\' && pat[1]) + *b++ = *pat++; + *b++ = *pat++; + continue; + } else { + copy = 0; + pat++; + } + p = pat; + while (*pat && (nest || *pat != ',' && /*{*/ *pat != '}')) { + if (*pat == '\\') + pat++; + else if (*pat == '{') + had_nest = nest++; + else if (*pat == '}') + nest--; + if (*pat) + pat++; + } + if (*pat) { + oldpat[i] = pat; + newpat[i++] = p; + if (*pat != ',') { + *pat++ = 0; + break; + } else + *pat++ = 0; + } + } + oldpat[i] = NULL; + if (i > 0 && mat) { + *mat = (char **)malloc((unsigned)((i + 1) * sizeof(char *))); + if (*mat) + (*mat)[i] = NULL; + else + return -1; + ret = i; + } + while (!mat && i-- > 0) + if (ret = glob2(str, newpat[i], pat)) + break; + for (i = 0; oldpat[i]; i++) { + if (mat && *mat) { + (void) sprintf(b, "%s%s", newpat[i], pat); + (*mat)[i] = savestr(buf); + } + if (oldpat[i + 1]) + oldpat[i][0] = ','; + else + oldpat[i][0] = /*{*/ '}'; + } + if (ret == 0 && b > buf && mat) { + *b = 0; + ret = ((*mat = unitv(buf)) ? 1 : -1); + } + return ret; + } + + /* * The basic globbing matcher. * * "*" = match 0 or more occurances of anything *************** *** 352,357 **** --- 688,694 ---- * "xx", "yy" can be any pattern or empty * "?" = match any character */ + int glob(str, pat) char *str, *pat; { *************** *** 361,381 **** return FALSE; while (*pat && !done && (*str || (*pat == '{' || *pat == '*'))) /*}*/ { /* * First look for a literal match, stepping over backslashes * in the pattern to match against the "protected" character. - * Ordering and precendence are important in this expression! */ ! if (*pat == '\\' && *str == *++pat || *str == *pat) { str++; pat++; ! } else switch (*pat++) { case '*': /* Match any string */ ! if (!*pat) { ! while (*str) ! str++; ! break; ! } /* * Try the rest of the glob against every * possible suffix of the string. A bit --- 698,718 ---- return FALSE; while (*pat && !done && (*str || (*pat == '{' || *pat == '*'))) /*}*/ { + char c; /* * First look for a literal match, stepping over backslashes * in the pattern to match against the "protected" character. */ ! if (*pat == '\\' && *str == *++pat) { str++; pat++; ! } else switch (c = *pat++) { case '*': /* Match any string */ ! /* Any number of consecutive '*' are equivalent */ ! while (*pat == '*') ! pat++; ! if (!*pat) ! return TRUE; /* * Try the rest of the glob against every * possible suffix of the string. A bit *************** *** 393,400 **** break; } /* Check for a range. */ ! if (*(pat + 1) == '-') { ! char c = *pat++; /* We don't handle open-ended ranges. */ if (*++pat == ']' || *pat == '\\' && !*++pat) { done = TRUE; --- 730,737 ---- break; } /* Check for a range. */ ! if (pat[1] == '-') { ! c = *pat++; /* We don't handle open-ended ranges. */ if (*++pat == ']' || *pat == '\\' && !*++pat) { done = TRUE; *************** *** 432,533 **** return sglob(str, pat - 1, TRPL_NULL); break; default: ! done = TRUE; } } while (*pat == '*') pat++; return ((*str == '\0') && (*pat == '\0')); } /* - * Match a pattern set {s1,s2,...} followed by any other pattern. - * Pattern sets and other patterns may nest arbitrarily. - * - * If "mat" is not a null pointer, a vector of possible expansions - * is generated and placed in *mat; otherwise, the expansions are - * matched against str and a truth value is returned ("/" is NOT - * treated as a directory separator in this case). NOTE: The vector - * of expansions may still contain nested pattern sets, which must - * be expanded separately. See sxp(). - * - * Currently allows at most 256 alternatives per set. Enough? :-) - */ - static - sglob(str, pat, mat) - char *str, *pat, ***mat; - { - char *p, *newpat[256], *oldpat[256], buf[MAXPATHLEN], *b = buf; - int copy = 1, nest = 0, i = 0, ret = 0; - - if (!pat) - return FALSE; - - while (*pat) { - if (copy) - if (*pat != '{') /*}*/ { - if (*pat == '\\' && pat[1]) - *b++ = *pat++; - *b++ = *pat++; - continue; - } else { - copy = 0; - pat++; - } - p = pat; - while (*pat && (nest || *pat != ',' && /*{*/ *pat != '}')) { - if (*pat == '\\') - pat++; - else if (*pat == '{') - nest++; - else if (*pat == '}') - nest--; - if (*pat) - pat++; - } - if (*pat) { - oldpat[i] = pat; - newpat[i++] = p; - if (*pat != ',') { - *pat++ = 0; - break; - } else - *pat++ = 0; - } - } - oldpat[i] = NULL; - if (i > 0 && mat) { - *mat = (char **)malloc((unsigned)((i + 1) * sizeof(char *))); - if (*mat) - (*mat)[i] = NULL; - else - return -1; - ret = i; - } - while (!mat && i-- > 0) - if (ret = glob2(str, newpat[i], pat)) - break; - for (i = 0; oldpat[i]; i++) { - if (mat && *mat) { - (void) sprintf(b, "%s%s", newpat[i], pat); - (*mat)[i] = savestr(buf); - } - if (oldpat[i + 1]) - oldpat[i][0] = ','; - else - oldpat[i][0] = /*{*/ '}'; - } - if (ret == 0 && b > buf && mat) { - *b = 0; - ret = ((*mat = unitv(buf)) ? 1 : -1); - } - return ret; - } - - /* * Pre-expand pattern set notations so sets containing "/" separators * can be globbed successfully. Returns the number of expansions. */ sxp(pat, exp) char *pat, ***exp; { --- 769,792 ---- return sglob(str, pat - 1, TRPL_NULL); break; default: ! if (*str == c) ! str++; ! else ! done = TRUE; } } + /* Any number of trailing '*' are equivalent */ while (*pat == '*') pat++; return ((*str == '\0') && (*pat == '\0')); } /* * Pre-expand pattern set notations so sets containing "/" separators * can be globbed successfully. Returns the number of expansions. */ + static + int sxp(pat, exp) char *pat, ***exp; { *************** *** 535,549 **** int n, new, cnt = 0; if ((n = sglob(NULL, pat, &t1)) < 2) { ! *exp = t1; ! return n; } *exp = DUBL_NULL; while (n-- && cnt >= 0) { new = sxp(t1[n], &t2); cnt = catv(cnt, exp, new, t2); } ! xfree(t1); return cnt; } --- 794,823 ---- int n, new, cnt = 0; if ((n = sglob(NULL, pat, &t1)) < 2) { ! char *b = NULL; ! ! /* ! * Determine whether we need to do a recursive expansion. ! */ ! if (t1 && t1[0]) { ! for (pat = t1[0]; *pat && (b = index(pat, '{' /*}*/)); pat++) { ! if (b == t1[0] || b[-1] != '\\') ! break; ! else ! pat = b; ! } ! } ! if (!b) { ! *exp = t1; ! return n; ! } } *exp = DUBL_NULL; while (n-- && cnt >= 0) { new = sxp(t1[n], &t2); cnt = catv(cnt, exp, new, t2); } ! free_vec(t1); return cnt; } *************** *** 552,566 **** * The "glob difference" means to remove all strings from argv that * match any of the glob patterns in patv. * * Returns the number of strings remaining in *argvp. The strings "removed" * from argv are actually left at the end of *argvp, so they can still be * accessed; their number will of course be argc - (returned value). */ gdiffv(argc, argvp, patc, patv) int argc, patc; char ***argvp, **patv; { ! char **argv, *t; int ac, pc, oldac = argc; if (argc < 1 || patc < 1 || !patv || !*patv) --- 826,845 ---- * The "glob difference" means to remove all strings from argv that * match any of the glob patterns in patv. * + * Consecutive slashes in the pattern match literally! This is not a true + * file path "glob". Metacharacters may match '/' characters in some + * circumstances. + * * Returns the number of strings remaining in *argvp. The strings "removed" * from argv are actually left at the end of *argvp, so they can still be * accessed; their number will of course be argc - (returned value). */ + int gdiffv(argc, argvp, patc, patv) int argc, patc; char ***argvp, **patv; { ! char **argv, *t, *h; int ac, pc, oldac = argc; if (argc < 1 || patc < 1 || !patv || !*patv) *************** *** 569,580 **** return -1; for (ac = 0; ac < argc && argv[ac]; ac++) { for (pc = 0; ac < argc && pc < patc && patv[pc]; pc++) { /* ! * We shouldn't cross '/' characters, so test ! * only the "tail" of each element of argv. */ ! if (!(t = rindex(argv[ac], '/'))) ! t = argv[ac]; if (glob(t, patv[pc])) { /* Move matches to the end and reduce argc */ t = argv[ac]; --- 848,872 ---- return -1; for (ac = 0; ac < argc && argv[ac]; ac++) { for (pc = 0; ac < argc && pc < patc && patv[pc]; pc++) { + int l = strlen(argv[ac]); + if (l == 0) + continue; /* ! * We shouldn't cross '/' characters unless they appear ! * in the pattern, so test only as much of the "tail" of ! * each element of argv as necessary. If the first char ! * of the pattern is a '/', match from the beginning. */ ! h = patv[pc]; ! if (*h != '/') { ! for (t = &argv[ac][--l]; t > argv[ac]; t--) { ! if (*t =='/' && !((h = index(h, '/')) && h++)) { ! t++; ! break; ! } ! } ! } else ! t = argv[ac]; if (glob(t, patv[pc])) { /* Move matches to the end and reduce argc */ t = argv[ac]; *************** *** 586,598 **** } } /* ! * Sort the two parts of the argv. uniqcmp() works here only if ! * there already are no duplicates, but we assume that for now. */ if (argc) ! qsort((char *)argv, argc, sizeof(char *), uniqcmp); if (oldac > argc) ! qsort((char *)&argv[argc], oldac - argc, sizeof(char *), uniqcmp); return argc; } --- 878,889 ---- } } /* ! * Sort the two parts of the argv. */ if (argc) ! qsort((char *)argv, argc, sizeof(char *), strptrcmp); if (oldac > argc) ! qsort((char *)&argv[argc], oldac - argc, sizeof(char *), strptrcmp); return argc; } *************** *** 604,609 **** --- 895,901 ---- * * Returns the length of the longest common prefix. */ + int lcprefix(vec, skip) char **vec; int skip; *************** *** 611,617 **** char c, **v; int done = FALSE; ! if (!vec || !*vec || skip < 0) return 0; do { for (v = vec + 1, c = vec[0][skip]; c && *v; v++) --- 903,909 ---- char c, **v; int done = FALSE; ! if (!vec || !*vec || !vec[1] || skip < 0) return 0; do { for (v = vec + 1, c = vec[0][skip]; c && *v; v++) *************** *** 634,652 **** /* * Print a vector in columns * * If "skip" is nonzero, that many chars are assumed to be in common * and are not printed. WARNING: skip must be <= than the length of * the shortest string in the vector! Safest to call with skip = 0. */ ! columnate(argc, argv, skip) int argc; ! char **argv; int skip; { int colstep, colwidth[MAXCOLS + 1]; int maxcols = min(argc, MAXCOLS); int minwidth, maxwidth, *widths; ! int maxword = 0, n, c; if (argc <= 0 || !argv || !*argv) return -1; --- 926,951 ---- /* * Print a vector in columns * + * If "outv" is non-null, it will be loaded with an allocated vector + * where each element is one line of the columnated text to be output. + * Strings in outv do NOT include a trailing newline! Returns the number + * of elements in outv (or the number of lines printed if outv is null). + * * If "skip" is nonzero, that many chars are assumed to be in common * and are not printed. WARNING: skip must be <= than the length of * the shortest string in the vector! Safest to call with skip = 0. */ ! int ! columnate(argc, argv, skip, outv) int argc; ! char **argv, ***outv; int skip; { int colstep, colwidth[MAXCOLS + 1]; int maxcols = min(argc, MAXCOLS); int minwidth, maxwidth, *widths; ! int maxword = 0, n, c, lines = 0; ! char *out = NULL; if (argc <= 0 || !argv || !*argv) return -1; *************** *** 659,665 **** * Also remember the minimum width. */ for (minwidth = MAXWIDTH, maxwidth = n = 0; n < argc; n++) { ! widths[n] = max(strlen(argv[n] + skip) + 2, MINWIDTH); if (widths[n] > MAXWIDTH - MINWIDTH) break; if (widths[n] > maxwidth) { --- 958,964 ---- * Also remember the minimum width. */ for (minwidth = MAXWIDTH, maxwidth = n = 0; n < argc; n++) { ! widths[n] = max(strlen(argv[n] + skip) + 2, (unsigned int)MINWIDTH); if (widths[n] > MAXWIDTH - MINWIDTH) break; if (widths[n] > maxwidth) { *************** *** 687,713 **** } xfree(widths); if (maxcols < 2 && minwidth <= MAXWIDTH / 2) { /* ! * The maxword fills too much screen, so redo everything * above it, print maxword, then do everything below it. */ ! if (maxword > 0 && columnate(maxword, argv, skip) < 0) return -1; ! wprint("%s\n", argv[maxword] + skip); if (argc - maxword < 2) ! return 0; ! return columnate(argc - maxword - 1, &argv[maxword + 1], skip); } for (n = 0; n < colstep; n++) { ! for (c = 0; c < maxcols && n + c * colstep < argc - colstep; c++) ! wprint("%-*.*s", colwidth[c], colwidth[c], argv[n + c * colstep] + skip); ! wprint("%s\n", argv[n + c * colstep] + skip); } ! return 0; } #ifndef DIRECTORY --- 986,1055 ---- } xfree(widths); + if (outv) + *outv = DUBL_NULL; /* for catv() */ + if (maxcols < 2 && minwidth <= MAXWIDTH / 2) { + char **tmpv = DUBL_NULL; /* ! * If the maxword fills too much screen, redo everything * above it, print maxword, then do everything below it. */ ! if (maxword > 0 && (lines = columnate(maxword, argv, skip, outv)) < 0) return -1; ! if (outv) { ! if ((n = catv(lines, outv, 1, unitv(argv[maxword] + skip))) < 0) { ! if (*outv) ! free_vec(*outv); ! *outv = DUBL_NULL; ! return -1; ! } else ! lines = n; ! } else ! wprint("%s\n", argv[maxword] + skip); if (argc - maxword < 2) ! return lines; ! else if (outv) ! tmpv = *outv; ! n = columnate(argc - maxword - 1, &argv[maxword + 1], skip, outv); ! if (tmpv) { ! if (n < 0 || (n = catv(lines, &tmpv, n, *outv)) < 0) { ! free_vec(tmpv); ! *outv = DUBL_NULL; ! } else ! *outv = tmpv; ! } ! return n; } + if (!(out = malloc((unsigned)(MAXWIDTH + 1)))) { + if (outv && *outv) + free_vec(*outv); + if (outv) + *outv = DUBL_NULL; + return -1; + } for (n = 0; n < colstep; n++) { ! char *p = out; ! for (c = 0; c < maxcols && n + c * colstep < argc - colstep; c++) { ! (void) sprintf(p, "%-*.*s", colwidth[c], colwidth[c], argv[n + c * colstep] + skip); ! p += strlen(p); ! } ! sprintf(p, "%s", argv[n + c * colstep] + skip); ! if (outv) { ! if ((lines = catv(lines, outv, 1, unitv(out))) < 0) { ! if (*outv) ! free_vec(*outv); ! *outv = DUBL_NULL; ! return -1; ! } ! } else ! wprint("%s\n", out); } + xfree(out); ! return lines; } #ifndef DIRECTORY *************** *** 791,797 **** dir.d_fileno = dp->od_ino ; strncpy(dir.d_name, dp->od_name, ODIRSIZ) ; dir.d_name[ODIRSIZ] = '\0' ; /* Ensure termination. */ ! dir.d_namlen = strlen(dir.d_name) ; dir.d_reclen = DIRSIZ(&dir) ; return(&dir) ; } --- 1133,1139 ---- dir.d_fileno = dp->od_ino ; strncpy(dir.d_name, dp->od_name, ODIRSIZ) ; dir.d_name[ODIRSIZ] = '\0' ; /* Ensure termination. */ ! dir.d_namlen = strlen(dir.d_name) + 1; dir.d_reclen = DIRSIZ(&dir) ; return(&dir) ; } diff -c 'mush-7.2.5unoff2.debian/hdrs.c' 'mush-7.2.5unoff2/hdrs.c' Index: ./hdrs.c *** ./hdrs.c Fri Oct 30 14:55:32 1992 --- ./hdrs.c Tue May 15 13:27:18 2001 *************** *** 325,331 **** if (list) unset_msg_bit(list, n); if (debug) { ! (void) printf("msg[%d].m_flags: %d", n, msg[n].m_flags); (void) check_flags(msg[n].m_flags); } } --- 325,331 ---- if (list) unset_msg_bit(list, n); if (debug) { ! (void) printf("msg[%d].m_flags: %d", n, (int)msg[n].m_flags); (void) check_flags(msg[n].m_flags); } } *************** *** 393,398 **** --- 393,400 ---- (p = header_field(cnt, "to")) || (p = header_field(cnt, "apparently-to"))) Strncpy(to, p); + else + show_to = 0; /* who's the message from */ if ((p = header_field(cnt, "from")) && strcpy(from, p) *************** *** 412,418 **** * Use take_me_off() to be sure the message really is from the current * user and not just someone with the same login at another site. */ ! if (show_to && !strncmp(p, login, strlen(login))) (void) take_me_off(from); if (show_to && (isauthor = !*from)) { /* assign and test */ (void) get_name_n_addr(to, name+4, addr+4); --- 414,420 ---- * Use take_me_off() to be sure the message really is from the current * user and not just someone with the same login at another site. */ ! if (show_to && (alternates || !strncmp(p, login, strlen(login)))) (void) take_me_off(from); if (show_to && (isauthor = !*from)) { /* assign and test */ (void) get_name_n_addr(to, name+4, addr+4); *************** *** 545,551 **** } otherwise: continue; /* unknown formatting char */ } ! if (do_pad && pad && strlen(p2) > pad) { char *old_p2 = p2, *p3; int is_bangform = 0; /* if addr is too long, move pointer forward till the --- 547,553 ---- } otherwise: continue; /* unknown formatting char */ } ! if (do_pad && pad && strlen(p2) > (unsigned int)pad) { char *old_p2 = p2, *p3; int is_bangform = 0; /* if addr is too long, move pointer forward till the *************** *** 561,567 **** break; } } ! if (isauthor && p2 > old_p2+4 && !p3 && strlen(p2) + 4 > pad) p2 -= 4; if (is_bangform && (p3 = rindex(p2, '@'))) { len = strlen(p3); --- 563,569 ---- break; } } ! if (isauthor && p2 > old_p2+4 && !p3 && strlen(p2) + 4 > (unsigned int)pad) p2 -= 4; if (is_bangform && (p3 = rindex(p2, '@'))) { len = strlen(p3); *************** *** 658,668 **** return ""; skipspaces(1); /* Extra work to handle quoted tokens */ ! while (p2 = any(p, "\" ")) { if (*p2 == '"') { ! if (p2 = index(p2 + 1, '"')) ! p2++; ! else return ""; } else break; --- 660,668 ---- return ""; skipspaces(1); /* Extra work to handle quoted tokens */ ! for (p2 = p; p2 = any(p2, "\" "); p2++) { if (*p2 == '"') { ! if (!(p2 = index(p2 + 1, '"'))) return ""; } else break; *************** *** 672,679 **** if (!unscramble_addr(p, line)) { /* p is safely recopied to line */ p2 = addr; goto BrokenFrom; ! } else p2 = NULL; #else /* MSG_SEPARATOR */ wprint("Warning: unable to find who msg %d is from!\n", n+1); p2 = addr; --- 672,681 ---- if (!unscramble_addr(p, line)) { /* p is safely recopied to line */ p2 = addr; goto BrokenFrom; ! } else { p2 = NULL; + p = line; + } #else /* MSG_SEPARATOR */ wprint("Warning: unable to find who msg %d is from!\n", n+1); p2 = addr; *************** *** 784,789 **** --- 786,813 ---- return NULL; if (lcase_strncmp(p, "Re:", 3)) (void) strcpy(buf, "Re: "); + return strcat(buf, p); + } + + char * + references_to(n, buf) + register char *buf; + { + register char *p; + buf[0] = 0; /* make sure it's already null terminated */ + if (!(p = header_field(n, "references"))) + return NULL; + return strcat(buf, p); + } + + char * + newsgroups_to(n, buf) + register char *buf; + { + register char *p; + buf[0] = 0; /* make sure it's already null terminated */ + if (!(p = header_field(n, "newsgroups"))) + return NULL; return strcat(buf, p); } diff -c 'mush-7.2.5unoff2.debian/hostname.c' 'mush-7.2.5unoff2/hostname.c' Index: ./hostname.c *** ./hostname.c Tue May 15 12:28:52 2001 --- ./hostname.c Tue May 15 13:01:54 2001 *************** *** 30,36 **** (void) gethostname(ourhost, sizeof ourhost); if (!(hp = gethostbyname(ourhost))) { if (ourname = (char **)calloc((unsigned)2, sizeof (char *))) ! strdup(ourname[0], ourhost); } else { int n = -1; cnt = 2; /* 1 for ourhost and 1 for NULL terminator */ --- 30,36 ---- (void) gethostname(ourhost, sizeof ourhost); if (!(hp = gethostbyname(ourhost))) { if (ourname = (char **)calloc((unsigned)2, sizeof (char *))) ! strdup1(ourname[0], ourhost); } else { int n = -1; cnt = 2; /* 1 for ourhost and 1 for NULL terminator */ diff -c 'mush-7.2.5unoff2.debian/init.c' 'mush-7.2.5unoff2/init.c' Index: ./init.c *** ./init.c Tue May 15 12:28:52 2001 --- ./init.c Tue May 15 14:38:45 2001 *************** *** 3,8 **** --- 3,9 ---- /* init.c -- functions and whatnot that initialize everything */ #include "mush.h" #include + #include #if defined(BSD) || defined(HPUX) || defined(IRIX4) || defined(__linux__) #include *************** *** 18,31 **** init_spoolfile() { char buf[MAXPATHLEN]; register char *p; if (spoolfile) { ! xfree(spoolfile); ! spoolfile = 0; } #ifdef HOMEMAIL ! strdup(spoolfile, sprintf(buf, "%s/%s", home, MAILFILE)); #else /* HOMEMAIL */ #ifdef ENV_MAIL #ifdef POP3_SUPPORT --- 19,33 ---- init_spoolfile() { char buf[MAXPATHLEN]; register char *p; + char* home; if (spoolfile) { ! return; } #ifdef HOMEMAIL ! home = getenv("HOME"); ! strdup1(spoolfile, sprintf(buf, "%s/%s", home, MAILFILE)); #else /* HOMEMAIL */ #ifdef ENV_MAIL #ifdef POP3_SUPPORT *************** *** 39,57 **** strdup(spoolfile, p); else #endif /* ENV_MAIL */ ! strdup(spoolfile, sprintf(buf, "%s/%s", MAILDIR, login)); #endif /* HOMEMAIL */ if (!sysspoolfile) { #ifdef HOMEMAIL ! strdup(sysspoolfile, spoolfile); #else #ifdef ENV_MAIL if ((p = getenv("MAIL")) && *p) ! strdup(sysspoolfile, p); else #endif ! strdup(sysspoolfile, sprintf(buf, "%s/%s", MAILDIR, login)); #endif } } --- 41,59 ---- strdup(spoolfile, p); else #endif /* ENV_MAIL */ ! strdup1(spoolfile, sprintf(buf, "%s/%s", MAILDIR, login)); #endif /* HOMEMAIL */ if (!sysspoolfile) { #ifdef HOMEMAIL ! strdup1(sysspoolfile, spoolfile); #else #ifdef ENV_MAIL if ((p = getenv("MAIL")) && *p) ! strdup1(sysspoolfile, p); else #endif ! strdup1(sysspoolfile, sprintf(buf, "%s/%s", MAILDIR, login)); #endif } } *************** *** 89,101 **** if (!entry && !(entry = getpwuid(getuid()))) if (p = getlogin()) ! strdup(login, p); else { ! strdup(login, "unknown"); print("I don't know you, but that's ok.\n"); } else { ! strdup(login, entry->pw_name); if (!home || !*home) home = entry->pw_dir; if (!realname && (realname = entry->pw_gecos)) { --- 91,103 ---- if (!entry && !(entry = getpwuid(getuid()))) if (p = getlogin()) ! strdup1(login, p); else { ! strdup1(login, "unknown"); print("I don't know you, but that's ok.\n"); } else { ! strdup1(login, entry->pw_name); if (!home || !*home) home = entry->pw_dir; if (!realname && (realname = entry->pw_gecos)) { diff -c 'mush-7.2.5unoff2.debian/loop.c' 'mush-7.2.5unoff2/loop.c' Index: ./loop.c *** ./loop.c Tue May 15 12:28:52 2001 --- ./loop.c Tue May 15 16:28:42 2001 *************** *** 9,19 **** #include "mush.h" #include "version.h" ! #ifdef BSD #include #else #ifndef SYSV #include #endif /* SYSV */ #endif /* BSD */ --- 9,20 ---- #include "mush.h" #include "version.h" ! #if defined(BSD) || defined(POSIX) #include #else #ifndef SYSV #include + #include #endif /* SYSV */ #endif /* BSD */ *************** *** 22,28 **** --- 23,31 ---- #define isdelimeter(c) (index(" \t;|", c)) char *alias_expand(), *hist_expand(), *reference_hist(), *hist_from_str(); + #ifndef __STDC__ char *calloc(); + #endif struct history { int histno; *************** *** 31,43 **** struct history *next; }; static struct history *hist_head, *hist_tail; #define malloc(n) (struct history *)calloc((unsigned)1,(unsigned)(n)) #define NULL_HIST (struct history *)0 static char *last_aliased; static int hist_size, print_only; ! do_loop() { register char *p, **argv; char **last_argv = DUBL_NULL, line[256]; --- 34,49 ---- struct history *next; }; static struct history *hist_head, *hist_tail; + #ifdef malloc + #undef malloc + #endif #define malloc(n) (struct history *)calloc((unsigned)1,(unsigned)(n)) #define NULL_HIST (struct history *)0 static char *last_aliased; static int hist_size, print_only; ! int do_loop() { register char *p, **argv; char **last_argv = DUBL_NULL, line[256]; *************** *** 146,157 **** } else if (argc > -1) (void) do_command(argc, argv, msg_list); } } /* Add a command to the history list */ /*ARGSUSED*/ ! add_history(un_used, argv) char **argv; { struct history *new; --- 152,165 ---- } else if (argc > -1) (void) do_command(argc, argv, msg_list); } + /* NOTREACHED */ + return(0); } /* Add a command to the history list */ /*ARGSUSED*/ ! int add_history(un_used, argv) char **argv; { struct history *new; *************** *** 184,189 **** --- 192,198 ---- xfree((char *) (hist_tail->prev)); hist_tail->prev = NULL_HIST; } + return(0); } /* make a command from "buf". *************** *** 439,445 **** continue; sep = n + i; while (i--) ! strdup(argv[i], Argv[n+i]); if ((!last_aliased || strcmp(last_aliased, argv[0])) && (p = alias_expand(argv[0]))) { --- 448,454 ---- continue; sep = n + i; while (i--) ! strdup1(argv[i], Argv[n+i]); if ((!last_aliased || strcmp(last_aliased, argv[0])) && (p = alias_expand(argv[0]))) { *************** *** 1187,1196 **** char buf[BUFSIZ]; struct history *hist; #ifndef REGCMP extern char *re_comp(); #else char *rex = NULL; ! extern char *regcmp(); #endif /* REGCMP */ /* For !{something}, the {} are stripped in reference_hist() */ --- 1196,1210 ---- char buf[BUFSIZ]; struct history *hist; #ifndef REGCMP + # ifdef REGCOMP + char *rex = NULL; + extern char *regcomp(); + # else extern char *re_comp(); + # endif #else char *rex = NULL; ! /*extern char *regcmp(); */ #endif /* REGCMP */ /* For !{something}, the {} are stripped in reference_hist() */ *************** *** 1208,1214 **** --- 1222,1232 ---- } if (*str) { #ifndef REGCMP + # ifdef REGCOMP + if (!(rex = regcomp(str))) /* Assign and test */ + # else if (re_comp(str)) + # endif #else if (!(rex = regcmp(str, NULL))) /* Assign and test */ #endif /* REGCMP */ *************** *** 1238,1244 **** --- 1256,1266 ---- } else found = #ifndef REGCMP + # ifdef REGCOMP + !!regexec(rex, buf) + # else re_exec(buf) + # endif #else !!regex(rex, buf, NULL) /* convert to boolean value */ #endif /* REGCMP */ *************** *** 1247,1257 **** --- 1269,1295 ---- *hist_number = hist->histno; Debug("Found it in history #%d\n", *hist_number); *p = c; + #ifdef REGCMP + /* XXX: regfree */ + free(rex); + #else + # ifdef REGCOMP + free(rex); + # endif + #endif return (*p == '?' ? p + 1 : p); } } hist_error("%s: event not found\n", str); *p = c; + #ifdef REGCMP + free(rex); + #else + # ifdef REGCOMP + /* XXX: regfree */ + free(rex); + # endif + #endif return NULL; } *************** *** 1308,1315 **** return 0; } ! init_history(newsize) { if ((hist_size = newsize) < 1) hist_size = 1; } --- 1346,1354 ---- return 0; } ! int init_history(newsize) { if ((hist_size = newsize) < 1) hist_size = 1; + return 0; } diff -c 'mush-7.2.5unoff2.debian/macros.c' 'mush-7.2.5unoff2/macros.c' Index: ./macros.c *** ./macros.c Thu May 3 15:40:28 1990 --- ./macros.c Tue May 15 12:44:47 2001 *************** *** 5,11 **** extern struct cmd_map map_func_names[]; ! struct cmd_map *mac_stack, *mac_hide; /* * print current binding to macro mappings if "str" is NULL. --- 5,12 ---- extern struct cmd_map map_func_names[]; ! static struct cmd_map *mac_stack; ! struct cmd_map *mac_hide; /* * print current binding to macro mappings if "str" is NULL. *************** *** 236,247 **** --- 237,253 ---- turnoff(glob_flags, IN_MACRO); turnoff(glob_flags, LINE_MACRO); turnoff(glob_flags, QUOTE_MACRO); + retry: + errno = 0; while ((c = getchar()) == 0) /* Ignore NUL chars from stdin */ ; /* until better solution found */ + if (c == EOF && errno == EINTR) + goto retry; return c; } } + int m_ungetc(c) char c; { *************** *** 249,254 **** --- 255,261 ---- *(--(mac_stack->m_str)) = c; else (void) ungetc(c, stdin); + return 0; } /* diff -c 'mush-7.2.5unoff2.debian/mail.c' 'mush-7.2.5unoff2/mail.c' Index: ./mail.c Prereq: 1986 *** ./mail.c Tue May 15 12:28:52 2001 --- ./mail.c Mon May 21 15:24:43 2001 *************** *** 16,21 **** --- 16,22 ---- */ static char Subject[BUFSIZ],To[HDRSIZ],Cc[HDRSIZ],Bcc[HDRSIZ],in_reply_to[256]; + static char References[HDRSIZ], Newsgroups[HDRSIZ]; static int killme; static u_long flags; static SIGRET (*oldterm)(), (*oldint)(), (*oldquit)(); *************** *** 187,192 **** --- 188,195 ---- turnon(flgs, VERBOSE); #endif /* VERBOSE_ARG */ *in_reply_to = *To = *Subject = *Cc = *Bcc = 0; + References[0] = '\0'; + Newsgroups[0] = '\0'; if (lower(firstchar) == 'r') { char *in_reply_fmt, *pcc = NULL; to = To, cc = Cc; *************** *** 201,206 **** --- 204,211 ---- if (to != To) *to++ = ',', *to++ = ' '; (void) reply_to(n, (firstchar == 'R'), buf); + references_to(n, References); + newsgroups_to(n, Newsgroups); if (strlen(buf) + (to - To) > sizeof(To) - 1) { wprint("# recipients exceeded at msg %d\n", n); break; *************** *** 278,289 **** (void) strncpy(Bcc, bcc, sizeof(Bcc)); /* bcc already fixed up */ bcc = Bcc; ! return mail_someone(to, subj, cc, bcc, flgs, inc_list); } static ! mail_someone(to, subject, cc, bcc, flgs, list) ! register char *to, *subject, *cc, *bcc, *list; u_long flgs; { register char *p; --- 283,295 ---- (void) strncpy(Bcc, bcc, sizeof(Bcc)); /* bcc already fixed up */ bcc = Bcc; ! return mail_someone(to, subj, cc, bcc, flgs, inc_list, References, ! Newsgroups); } static ! mail_someone(to, subject, cc, bcc, flgs, list, references, newsgroups) ! register char *to, *subject, *cc, *bcc, *list, *references, *newsgroups; u_long flgs; { register char *p; *************** *** 387,393 **** alted: dir = ALTERNATE_HOME; (void) mktemp(sprintf(line, "%s/%s", dir, EDFILE)); ! strdup(edfile, line); if (!(ed_fp = mask_fopen(edfile, "w+"))) { if (strcmp(dir, ALTERNATE_HOME)) goto alted; --- 393,399 ---- alted: dir = ALTERNATE_HOME; (void) mktemp(sprintf(line, "%s/%s", dir, EDFILE)); ! strdup1(edfile, line); if (!(ed_fp = mask_fopen(edfile, "w+"))) { if (strcmp(dir, ALTERNATE_HOME)) goto alted; *************** *** 415,421 **** had_hfile = TRUE; } if (istool && isoff(flags, SEND_NOW)) ! strdup(hfile, edfile); /* if flags call for it, include current message (with header?) */ if (ison(flags, INCLUDE|FORWARD|INCLUDE_H)) { --- 421,427 ---- had_hfile = TRUE; } if (istool && isoff(flags, SEND_NOW)) ! strdup1(hfile, edfile); /* if flags call for it, include current message (with header?) */ if (ison(flags, INCLUDE|FORWARD|INCLUDE_H)) { *************** *** 511,517 **** #endif /* SUNTOOL */ if (ison(flags, SEND_NOW)) { /* editing couldn't have been on -- finish_up_letter() failed */ ! rm_edfile(0 - ison(flags, FORWARD)); return -1; } --- 517,523 ---- #endif /* SUNTOOL */ if (ison(flags, SEND_NOW)) { /* editing couldn't have been on -- finish_up_letter() failed */ ! rm_edfile((int)(0 - ison(flags, FORWARD))); return -1; } *************** *** 585,590 **** --- 591,597 ---- { register char *p; char buf[HDRSIZ > MAXPATHLEN ? HDRSIZ : MAXPATHLEN]; + void dead_letter(); killme = 0; if (ed_fp) /* may be null if istool */ *************** *** 1052,1057 **** --- 1059,1066 ---- static int send_it() { + void dead_letter(); + static char mail_delivery[sizeof(MAIL_DELIVERY) #ifdef DELIVER_ARG + sizeof(DELIVER_ARG) + 1 *************** *** 1263,1269 **** if (isoff(flags, VERBOSE) && debug < 3) switch (fork_pid = fork()) { case 0: /* the child will send the letter. ignore signals */ ! #if defined(SYSV) && !defined(AUX) && !defined(IRIX4) if (setpgrp() == -1) #else /* !SYSV || AUX || IRIX4 */ if (setpgrp(0, getpid()) == -1) --- 1272,1278 ---- if (isoff(flags, VERBOSE) && debug < 3) switch (fork_pid = fork()) { case 0: /* the child will send the letter. ignore signals */ ! #if (defined(SYSV) && !defined(AUX) && !defined(IRIX4)) || defined(linux) if (setpgrp() == -1) #else /* !SYSV || AUX || IRIX4 */ if (setpgrp(0, getpid()) == -1) *************** *** 1332,1338 **** if (!(files[0] = open_file(buf, TRUE, FALSE))) { rm_edfile(-1); /* force saving of undeliverable mail */ if (isoff(flags, VERBOSE) && debug < 3) ! exit(-1); else return 0; } --- 1341,1347 ---- if (!(files[0] = open_file(buf, TRUE, FALSE))) { rm_edfile(-1); /* force saving of undeliverable mail */ if (isoff(flags, VERBOSE) && debug < 3) ! _exit(-1); else return 0; } *************** *** 1511,1517 **** (void) signal(SIGTERM, oldterm); } } else ! exit(0); /* not a user exit -- a child exit */ return 0; } --- 1520,1526 ---- (void) signal(SIGTERM, oldterm); } } else ! _exit(0); /* not a user exit -- a child exit */ return 0; } *************** *** 1534,1539 **** --- 1543,1549 ---- int i, for_editor = (fp == NULL_FILE); int got_date = for_editor, got_from = for_editor; struct options *opts; + char facebuf[1024]; if (for_editor && hfile) { i = file_to_fp(hfile, files[0], "r"); *************** *** 1653,1659 **** (void) strcpy(To, p); } if (Cc[0]) { ! strdup(orig, Cc); if (!(p = alias_to_address(Cc))) { wprint("Cc: list unmodified.\n"); p = orig; --- 1663,1669 ---- (void) strcpy(To, p); } if (Cc[0]) { ! strdup1(orig, Cc); if (!(p = alias_to_address(Cc))) { wprint("Cc: list unmodified.\n"); p = orig; *************** *** 1661,1667 **** (void) strcpy(Cc, p); } if (Bcc[0]) { ! strdup(orig, Bcc); if (!(p = alias_to_address(Bcc))) { wprint("Bcc: list unmodified.\n"); p = orig; --- 1671,1677 ---- (void) strcpy(Cc, p); } if (Bcc[0]) { ! strdup1(orig, Bcc); if (!(p = alias_to_address(Bcc))) { wprint("Bcc: list unmodified.\n"); p = orig; *************** *** 1699,1704 **** --- 1709,1715 ---- !lcase_strncmp(p, "bcc:", 4) || !lcase_strncmp(p, "fcc:", 4) || !lcase_strncmp(p, "x-mailer:", 9) || + !lcase_strncmp(p, "x-face:", 7) || !lcase_strncmp(p, "status:", 7)) print_hdr = FALSE; else if (!lcase_strncmp(p, "date:", 5)) *************** *** 1710,1716 **** p = buf; } else if (!lcase_strncmp(p, "subject:", 8)) ! (print_hdr = FALSE), strdup(subj, p); else if (!lcase_strncmp(p, "from:", 5)) { char not_me[BUFSIZ]; (void) strcpy(not_me, buf + 5); --- 1721,1727 ---- p = buf; } else if (!lcase_strncmp(p, "subject:", 8)) ! (print_hdr = FALSE), strdup1(subj, p); else if (!lcase_strncmp(p, "from:", 5)) { char not_me[BUFSIZ]; (void) strcpy(not_me, buf + 5); *************** *** 1748,1753 **** --- 1759,1767 ---- (void) wrap_addrs(To, 80); (void) wrap_addrs(Cc, 80); (void) wrap_addrs(Bcc, 80); + (void) wrap_addrs(Newsgroups, 80); + (void) wrap_addrs(References, 80); + (void) load_xface(facebuf); for (i = 0; i < size; i++) { if (!files[i]) continue; *************** *** 1762,1767 **** --- 1776,1783 ---- #ifdef PICKY_MAILER } #endif /* PICKY_MAILER */ + if (facebuf[0]) + (void) fprintf(files[i], "X-Face: %s", facebuf); (void) fprintf(files[i], "X-Mailer: %s\n", check_internal("version")); (void) fprintf(files[i], "%sTo: %s\n", ison(flags, FORWARD) ? "Resent-" : "", To); *************** *** 1770,1776 **** (*Subject || for_editor && (do_set(set_options, "ask") || do_set(set_options, "asksub")))) (void) fprintf(files[i], "Subject: %s\n", Subject); ! } else if (subj && *subj && strlen(subj) > 9) (void) (fputs(subj, files[i]), fputc('\n', files[i])); if (*Cc || for_editor && do_set(set_options, "askcc")) (void) fprintf(files[i], "%sCc: %s\n", --- 1786,1792 ---- (*Subject || for_editor && (do_set(set_options, "ask") || do_set(set_options, "asksub")))) (void) fprintf(files[i], "Subject: %s\n", Subject); ! } else if (subj && *subj && strlen(subj) > (unsigned int)9) (void) (fputs(subj, files[i]), fputc('\n', files[i])); if (*Cc || for_editor && do_set(set_options, "askcc")) (void) fprintf(files[i], "%sCc: %s\n", *************** *** 1782,1787 **** --- 1798,1811 ---- ison(flags, FORWARD) ? "Resent-" : "", Bcc); if (i > 0) (void) fprintf(files[i], "Status: OR\n"); + #if 0 + if (*References) { + fprintf(files[i], "References: %s\n", References); + } + if (*Newsgroups) { + fprintf(files[i], "Newsgroups: %s\n", Newsgroups); + } + #endif } for (i = 0; i < size; i++) if (files[i]) *************** *** 1809,1815 **** --- 1833,1842 ---- /* ARGSUSED */ SIGRET rm_edfile(sig) + int sig; { + void dead_letter(); + if (sig > 0) { char *fix; #ifdef linux *************** *** 1828,1835 **** --- 1855,1869 ---- (void) signal(sig, rm_edfile); killme = 1; print("\n** interrupt -- one more to kill letter **\n"); + #ifdef __linux__ + m_getchar(); + #endif longjmp(cntrl_c_buf, 1); } + #ifdef __linux__ + if (sig > 0) + m_getchar(); + #endif killme = 0; /* if sig == -1, force a save into dead.letter. * else, check for nosave not being set and save anyway if it's not set *************** *** 1861,1872 **** puts("exiting"); #endif echo_on(); ! exit(1); } longjmp(jmpbuf, 1); } /* save letter into dead letter */ dead_letter(sig) int sig; /* signal passed to rm_edfile() or 0 */ { --- 1895,1907 ---- puts("exiting"); #endif echo_on(); ! _exit(1); } longjmp(jmpbuf, 1); } /* save letter into dead letter */ + void dead_letter(sig) int sig; /* signal passed to rm_edfile() or 0 */ { diff -c 'mush-7.2.5unoff2.debian/main.c' 'mush-7.2.5unoff2/main.c' Index: ./main.c *** ./main.c Tue May 15 12:28:52 2001 --- ./main.c Tue May 15 14:38:11 2001 *************** *** 100,105 **** --- 100,107 ---- setgid(rgid); #endif /* BSD */ + spoolfile = 0; + parse_options(&argv, &Flags); #ifdef POP3_SUPPORT *************** *** 155,165 **** char *wd = do_set(set_options, "cwd"); if (*wd) { (void) sprintf(buf, "%s/%s", wd, p); ! strdup(spoolfile, buf); } else ! strdup(spoolfile, p); } else ! strdup(spoolfile, p); } #ifdef SUNTOOL --- 157,167 ---- char *wd = do_set(set_options, "cwd"); if (*wd) { (void) sprintf(buf, "%s/%s", wd, p); ! strdup1(spoolfile, buf); } else ! strdup1(spoolfile, p); } else ! strdup1(spoolfile, p); } #ifdef SUNTOOL *************** *** 242,248 **** cleanup(0); } if (!*mailfile) { ! strdup(mailfile, spoolfile); if (!mail_size() && isoff(glob_flags, DO_SHELL)) { /* we know it's not the spool file here */ (void) printf("No mail in \"%s\".\n", mailfile); --- 244,250 ---- cleanup(0); } if (!*mailfile) { ! strdup1(mailfile, spoolfile); if (!mail_size() && isoff(glob_flags, DO_SHELL)) { /* we know it's not the spool file here */ (void) printf("No mail in \"%s\".\n", mailfile); diff -c 'mush-7.2.5unoff2.debian/makefile' 'mush-7.2.5unoff2/makefile' Index: ./makefile *** ./makefile Tue May 15 12:28:52 2001 --- ./makefile Tue May 15 16:21:24 2001 *************** *** 39,48 **** OPT_CFLAGS = -O6 -fomit-frame-pointer #OPT_CFLAGS = -g SYS_CFLAGS = -DSYSV -DUSG ! CFLAGS= -fwritable-strings $(OPT_CFLAGS) $(SYS_CFLAGS) -DCURSES $(OTHER_CFLAGS) #CFLAGS= -I /usr/include/ncurses -fwritable-strings -g -m486 -DSYSV -DUSG -DCURSES -DSIGRET=void -DENV_MAIL ! LDFLAGS= ! #LDFLAGS=-g LIBS= -lncurses #-lPW OTHERLIBS= # Use some variant of this one if you #define MMDF in config.h --- 39,48 ---- OPT_CFLAGS = -O6 -fomit-frame-pointer #OPT_CFLAGS = -g SYS_CFLAGS = -DSYSV -DUSG ! CFLAGS= -fwritable-strings $(OPT_CFLAGS) $(SYS_CFLAGS) -DQMAIL -DCURSES $(OTHER_CFLAGS) #CFLAGS= -I /usr/include/ncurses -fwritable-strings -g -m486 -DSYSV -DUSG -DCURSES -DSIGRET=void -DENV_MAIL ! #LDFLAGS=-static ! LDFLAGS=-static -g LIBS= -lncurses #-lPW OTHERLIBS= # Use some variant of this one if you #define MMDF in config.h diff -c 'mush-7.2.5unoff2.debian/makefile.bsd' 'mush-7.2.5unoff2/makefile.bsd' Index: ./makefile.bsd *** ./makefile.bsd Tue May 15 12:28:52 2001 --- ./makefile.bsd Tue May 15 12:44:59 2001 *************** *** 31,39 **** # Use some variant of this one if you #define MMDF in config.h #OTHERLIBS=/usr/src/mmdf/lib/libmmdf.a mush: $(OBJS) @echo loading... ! @cc $(LDFLAGS) $(OBJS) $(LIBS) $(OTHERLIBS) -o mush $(OBJS): config.h mush.h loop.o: version.h --- 31,42 ---- # Use some variant of this one if you #define MMDF in config.h #OTHERLIBS=/usr/src/mmdf/lib/libmmdf.a + # GCC needs -fwritable-strings + #CC= gcc -fwritable-strings + mush: $(OBJS) @echo loading... ! @$(CC) $(LDFLAGS) $(OBJS) $(LIBS) $(OTHERLIBS) -o mush $(OBJS): config.h mush.h loop.o: version.h diff -c /dev/null 'mush-7.2.5unoff2/makefile.bsdi' Index: ./makefile.bsdi *** ./makefile.bsdi Wed Dec 31 19:00:00 1969 --- ./makefile.bsdi Tue May 15 12:44:59 2001 *************** *** 0 **** --- 1,74 ---- + # makefile.bsdi + # + HDRS= mush.h config.h-dist strings.h bindings.h options.h version.h glob.h pop.h + + SRCS= main.c init.c misc.c mail.c hdrs.c execute.c commands.c print.c dates.c \ + signals.c setopts.c msgs.c pick.c sort.c expr.c folders.c \ + loop.c viewopts.c curses.c curs_io.c bind.c file.c strings.c \ + lock.c macros.c options.c addrs.c malloc.c glob.c command2.c \ + pop.c pmush.c xcreat.c + OBJS= main.o init.o misc.o mail.o hdrs.o execute.o commands.o print.o file.o \ + signals.o setopts.o msgs.o pick.o sort.o expr.o strings.o \ + folders.o dates.o loop.o viewopts.o curses.o curs_io.o bind.o \ + lock.o macros.o options.o addrs.o malloc.o glob.o command2.o \ + pop.o pmush.o xcreat.o + + HELP_FILES= README README-7.0 README-7.1 README-7.2.0 README-7.2.2 \ + README-7.2.4 mush.1 cmd_help Mushrc Mailrc Gnurc \ + sample.mushrc advanced.mushrc digestify + + MAKES= makefile.bsdi makefile.bsd makefile.xenix makefile.sys.v makefile.hpux makefile.sun makefile.solaris + + CFLAGS= -g -DCURSES -DBSD -DSIGRET=void -DBSD44 + LDFLAGS= -g + LINTFLAGS= -bxah -Dlint -DCURSES -DBSD + LIBS= -lcurses -ltermlib -lcompat + OTHERLIBS= + # Use some variant of this one if you #define MMDF in config.h + #OTHERLIBS=/usr/src/mmdf/lib/libmmdf.a + + mush: $(OBJS) + @echo loading... + @$(CC) $(LDFLAGS) $(OBJS) $(LIBS) $(OTHERLIBS) -o mush + + $(OBJS): config.h mush.h + loop.o: version.h + + tape: + @tar cv $(MAKES) $(HDRS) $(SRCS) $(HELP_FILES) + + tar: + @tar fcv MUSH $(MAKES) $(HDRS) $(SRCS) $(HELP_FILES) + + tarmail: + tar fcv - $(MAKES) $(HDRS) $(SRCS) $(HELP_FILES) | \ + compress | btoa > mush.tarmail + + lint: + lint $(LINTFLAGS) $(SRCS) + + clean: + rm -f *.o core mush + + BINDIR= /usr/local/bin + LIBDIR= /usr/local/lib + MRCDIR= /usr/share/misc + MANDIR= /usr/local/man/man1 + MANEXT= 1 + + install: mush + mv mush $(BINDIR) + strip $(BINDIR)/mush + chmod 0755 $(BINDIR)/mush + cp mush.1 $(MANDIR)/mush.$(MANEXT) + chmod 0644 $(MANDIR)/mush.$(MANEXT) + cp cmd_help $(LIBDIR) + chmod 0644 $(LIBDIR)/cmd_help + cp Mushrc $(MRCDIR)/Mushrc + chmod 0644 $(MRCDIR)/Mushrc + + + glob: glob.c + $(CC) $(CFLAGS) -DTEST -DTEST2 glob.c $(LIBS) $(OTHERLIBS) -o glob + + diff -c /dev/null 'mush-7.2.5unoff2/makefile.freebsd' Index: ./makefile.freebsd *** ./makefile.freebsd Wed Dec 31 19:00:00 1969 --- ./makefile.freebsd Tue May 15 12:44:59 2001 *************** *** 0 **** --- 1,74 ---- + # makefile.freebsd + # + HDRS= mush.h config.h-dist strings.h bindings.h options.h version.h glob.h pop.h + + SRCS= main.c init.c misc.c mail.c hdrs.c execute.c commands.c print.c dates.c \ + signals.c setopts.c msgs.c pick.c sort.c expr.c folders.c \ + loop.c viewopts.c curses.c curs_io.c bind.c file.c strings.c \ + lock.c macros.c options.c addrs.c malloc.c glob.c command2.c \ + pop.c pmush.c xcreat.c + OBJS= main.o init.o misc.o mail.o hdrs.o execute.o commands.o print.o file.o \ + signals.o setopts.o msgs.o pick.o sort.o expr.o strings.o \ + folders.o dates.o loop.o viewopts.o curses.o curs_io.o bind.o \ + lock.o macros.o options.o addrs.o malloc.o glob.o command2.o \ + pop.o pmush.o xcreat.o + + HELP_FILES= README README-7.0 README-7.1 README-7.2.0 README-7.2.2 \ + README-7.2.4 mush.1 cmd_help Mushrc Mailrc Gnurc \ + sample.mushrc advanced.mushrc digestify + + MAKES= makefile.bsdi makefile.bsd makefile.xenix makefile.sys.v makefile.hpux makefile.sun makefile.solaris makefile.freebsd + + CFLAGS= -O2 -g -fwritable-strings -DCURSES -DBSD -DBSD44 -DSIGRET=void -DBASENAME + LDFLAGS= -g + LINTFLAGS= -bxah -Dlint -DCURSES -DBSD + LIBS= -lcurses -ltermlib -lcompat + OTHERLIBS= + # Use some variant of this one if you #define MMDF in config.h + #OTHERLIBS=/usr/src/mmdf/lib/libmmdf.a + + mush: $(OBJS) + @echo loading... + @$(CC) $(LDFLAGS) $(OBJS) $(LIBS) $(OTHERLIBS) -o mush + + $(OBJS): config.h mush.h + loop.o: version.h + + tape: + @tar cv $(MAKES) $(HDRS) $(SRCS) $(HELP_FILES) + + tar: + @tar fcv MUSH $(MAKES) $(HDRS) $(SRCS) $(HELP_FILES) + + tarmail: + tar fcv - $(MAKES) $(HDRS) $(SRCS) $(HELP_FILES) | \ + compress | btoa > mush.tarmail + + lint: + lint $(LINTFLAGS) $(SRCS) + + clean: + rm -f *.o core mush + + BINDIR= /usr/local/bin + LIBDIR= /usr/local/lib + MRCDIR= /usr/share/misc + MANDIR= /usr/local/man/man1 + MANEXT= 1 + + install: mush + mv mush $(BINDIR) + strip $(BINDIR)/mush + chmod 0755 $(BINDIR)/mush + cp mush.1 $(MANDIR)/mush.$(MANEXT) + chmod 0644 $(MANDIR)/mush.$(MANEXT) + cp cmd_help $(LIBDIR) + chmod 0644 $(LIBDIR)/cmd_help + cp Mushrc $(MRCDIR)/Mushrc + chmod 0644 $(MRCDIR)/Mushrc + + + glob: glob.c + $(CC) $(CFLAGS) -DTEST -DTEST2 glob.c $(LIBS) $(OTHERLIBS) -o glob + + diff -c /dev/null 'mush-7.2.5unoff2/makefile.linux' Index: ./makefile.linux *** ./makefile.linux Wed Dec 31 19:00:00 1969 --- ./makefile.linux Tue May 15 12:44:59 2001 *************** *** 0 **** --- 1,73 ---- + # Mush makefile modified for linux. + # based on Makefile.sys.v + + HDRS1= mush.h config.h + HDRS2= strings.h options.h + HDRS3= bindings.h glob.h + HDRS4= version.h pop.h + SRCS1= commands.c dates.c execute.c expr.c folders.c \ + hdrs.c init.c loop.c mail.c main.c misc.c msgs.c pick.c \ + print.c setopts.c signals.c sort.c viewopts.c options.c lock.c + SRCS2= bind.c curs_io.c curses.c file.c strings.c macros.c \ + addrs.c malloc.c glob.c command2.c pop.c pmush.c xcreat.c + + OBJS1= commands.o dates.o execute.o expr.o folders.o \ + hdrs.o init.o loop.o mail.o main.o misc.o msgs.o pick.o \ + print.o setopts.o signals.o sort.o viewopts.o options.o lock.o + OBJS2= bind.o curs_io.o curses.o file.o strings.o macros.o \ + addrs.o malloc.o glob.o command2.o pop.o pmush.o xcreat.o + + HELP= README README-7.0 README-7.1 README-7.2.0 README-7.2.2 \ + README-7.2.4 mush.1 cmd_help Mushrc Mailrc Gnurc \ + sample.mushrc advanced.mushrc digestify + + DEBUG=-O6 + # DEBUG=-g + + # There are apparently at least two major variants of Linux; one has ncurses + # installed in /usr/include/ncurses.h, the other has the standard ncurses + # installation using /usr/include/ncurses/curses.h. The former of these + # apparently has the ncurses library installed as -lcurses, whereas the latter + # has a separate -lncurses. RedHat for 5.0 recommends dropping -ltermcap + # and using only -lcurses. Set CFLAGS and LIBS here as appropriate. + CFLAGS= $(DEBUG) -DPOSIX -DSIGRET=void -fwritable-strings -DCURSES -DDEFINE_CURSES_SGTTY -I/usr/include/ncurses + #CFLAGS= $(DEBUG) -DPOSIX -DSIGRET=void -fwritable-strings -DCURSES -DDEFINE_CURSES_SGTTY -DNCURSES + LDFLAGS= $(DEBUG) + LIBS= -lncurses -ltermcap + #LIBS= -lcurses -ltermcap + #LIBS= -lcurses + OTHERLIBS= + # Use some variant of this one if you #define MMDF in config.h + #OTHERLIBS=/usr/src/mmdf/lib/libmmdf.a + PROG= mush + + $(PROG): $(OBJS1) $(OBJS2) + @echo loading... + @$(CC) $(LDFLAGS) $(OBJS1) $(OBJS2) -o $(PROG) $(LIBS) $(OTHERLIBS) + + $(OBJS1): $(HDRS1) $(HDRS2) + $(OBJS2): $(HDRS1) $(HDRS2) $(HDRS3) + loop.o: version.h + + #PREFIX= /usr/packages/mush + PREFIX= /usr + BINDIR= $(PREFIX)/bin + LIBDIR= $(PREFIX)/lib + MRCDIR= $(PREFIX)/lib + MANDIR= $(PREFIX)/man/man1 + MANEXT= 1 + + install: mush + -mkdir $(PREFIX) $(PREFIX)/{bin,lib,man,man/man1} + cp mush $(BINDIR) + strip $(BINDIR)/mush + chmod 0755 $(BINDIR)/mush + cp mush.1 $(MANDIR)/mush.$(MANEXT) + chmod 0644 $(MANDIR)/mush.$(MANEXT) + cp cmd_help $(LIBDIR) + chmod 0644 $(LIBDIR)/cmd_help + cp Mushrc $(MRCDIR)/Mushrc + chmod 0644 $(MRCDIR)/Mushrc + + clean: + rm -f *.o *~ core TAGS tags a.out mush diff -c /dev/null 'mush-7.2.5unoff2/makefile.solaris' Index: ./makefile.solaris *** ./makefile.solaris Wed Dec 31 19:00:00 1969 --- ./makefile.solaris Tue May 15 12:44:59 2001 *************** *** 0 **** --- 1,65 ---- + # + # Mush makefile for Solaris with gcc 2.5.8 + # + CC=gcc -traditional -fwritable-strings + HDRS1= mush.h config.h + HDRS2= strings.h options.h + HDRS3= bindings.h glob.h + HDRS4= version.h pop.h + SRCS1= commands.c dates.c execute.c expr.c folders.c \ + hdrs.c init.c loop.c mail.c main.c misc.c msgs.c pick.c \ + print.c setopts.c signals.c sort.c viewopts.c options.c lock.c + SRCS2= bind.c curs_io.c curses.c file.c strings.c macros.c \ + addrs.c malloc.c command2.c pop.c pmush.c xcreat.c glob.c + + OBJS1= commands.o dates.o execute.o expr.o folders.o \ + hdrs.o init.o loop.o mail.o main.o misc.o msgs.o pick.o \ + print.o setopts.o signals.o sort.o viewopts.o options.o lock.o + OBJS2= bind.o curs_io.o curses.o file.o strings.o macros.o \ + addrs.o malloc.o command2.o pop.o pmush.o xcreat.o glob.o + + HELP= README README-7.0 README-7.1 README-7.2.0 README-7.2.2 \ + README-7.2.4 mush.1 cmd_help Mushrc Mailrc Gnurc \ + sample.mushrc advanced.mushrc digestify + # + # + # + CFLAGS= -O2 -g -DPOSIX -DSYSV -DUSG -DCURSES -DSIGRET=void -DSVR4 -DREGCMP -DDECLARE_ERRLIST + LDFLAGS= -g + LIBS= -L/usr/ccs/lib -R/usr/ccs/lib -lcurses -lgen -ltermlib -lsocket -lnsl -lc /usr/ucblib/libucb.a + OTHERLIBS= + # Use some variant of this one if you #define MMDF in config.h + #OTHERLIBS=/usr/src/mmdf/lib/libmmdf.a + PROG= mush + + $(PROG): $(OBJS1) $(OBJS2) + @echo loading... + @$(CC) $(LDFLAGS) $(OBJS1) $(OBJS2) -o $(PROG) $(LIBS) $(OTHERLIBS) + + $(OBJS1): $(HDRS1) $(HDRS2) + $(OBJS2): $(HDRS1) $(HDRS2) $(HDRS3) + loop.o: version.h + + BINDIR= /usr/local/bin + LIBDIR= /usr/local/lib + MRCDIR= /usr/local/lib + MANDIR= /usr/local/man/man1 + MANEXT= 1 + + install: mush + cp mush $(BINDIR) + strip $(BINDIR)/mush + chmod 0755 $(BINDIR)/mush + cp mush.1 $(MANDIR)/mush.$(MANEXT) + chmod 0644 $(MANDIR)/mush.$(MANEXT) + cp cmd_help $(LIBDIR) + chmod 0644 $(LIBDIR)/cmd_help + cp Mushrc $(MRCDIR)/Mushrc + chmod 0644 $(MRCDIR)/Mushrc + + + clean: + rm -f *.o mush + + glob: glob.c + $(CC) $(LDFLAGS) $(CFLAGS) -DTEST -DTEST2 glob.c -o glob $(LIBS) $(OTHERLIBS) diff -c /dev/null 'mush-7.2.5unoff2/makefile.sun-notool' Index: ./makefile.sun-notool *** ./makefile.sun-notool Wed Dec 31 19:00:00 1969 --- ./makefile.sun-notool Tue May 15 12:44:59 2001 *************** *** 0 **** --- 1,74 ---- + # makefile.bsd (c) copyright 1991 (Dan Heller) + # SunOS users should add -DSUN_3_5, -DSUN_4_0, or -DSUN_4_1 to CFLAGS. + # + HDRS= mush.h config.h-dist strings.h bindings.h options.h version.h glob.h pop.h + + SRCS= main.c init.c misc.c mail.c hdrs.c execute.c commands.c print.c dates.c \ + signals.c setopts.c msgs.c pick.c sort.c expr.c folders.c \ + loop.c viewopts.c curses.c curs_io.c bind.c file.c strings.c \ + lock.c macros.c options.c addrs.c malloc.c glob.c command2.c \ + pop.c pmush.c xcreat.c + OBJS= main.o init.o misc.o mail.o hdrs.o execute.o commands.o print.o file.o \ + signals.o setopts.o msgs.o pick.o sort.o expr.o strings.o \ + folders.o dates.o loop.o viewopts.o curses.o curs_io.o bind.o \ + lock.o macros.o options.o addrs.o malloc.o glob.o command2.o \ + pop.o pmush.o xcreat.o + + HELP_FILES= README README-7.0 README-7.1 README-7.2.0 README-7.2.2 \ + README-7.2.4 mush.1 cmd_help Mushrc Mailrc Gnurc \ + sample.mushrc advanced.mushrc digestify + + MAKES= makefile.bsd makefile.xenix makefile.sys.v makefile.hpux makefile.sun + + # See the README for changes needed to compile under Ultrix. + # In particular, you may need -DSIGRET=void and/or -ltermcap. + CFLAGS= -g -O2 -DCURSES -DBSD -DSUN_4_1 -DBASENAME + LDFLAGS= + LINTFLAGS= -bxah -Dlint -DCURSES -DBSD + LIBS= -lcurses -ltermlib + OTHERLIBS= + # Use some variant of this one if you #define MMDF in config.h + #OTHERLIBS=/usr/src/mmdf/lib/libmmdf.a + + # GCC needs -fwritable-strings + CC=gcc -fwritable-strings + + mush: $(OBJS) + @echo loading... + @$(CC) $(LDFLAGS) $(OBJS) $(LIBS) $(OTHERLIBS) -o mush + + $(OBJS): config.h mush.h + loop.o: version.h + + tape: + @tar cv $(MAKES) $(HDRS) $(SRCS) $(HELP_FILES) + + tar: + @tar fcv MUSH $(MAKES) $(HDRS) $(SRCS) $(HELP_FILES) + + tarmail: + tar fcv - $(MAKES) $(HDRS) $(SRCS) $(HELP_FILES) | \ + compress | btoa > mush.tarmail + + lint: + lint $(LINTFLAGS) $(SRCS) + + clean: + rm -f *.o core mush + + BINDIR= /vol/local/bin + LIBDIR= /vol/local/lib/mush + MRCDIR= /vol/local/lib/mush + MANDIR= /vol/local/man/man1 + MANEXT= 1 + + install: mush + mv mush $(BINDIR) + strip $(BINDIR)/mush + chmod 0755 $(BINDIR)/mush + cp mush.1 $(MANDIR)/mush.$(MANEXT) + chmod 0644 $(MANDIR)/mush.$(MANEXT) + cp cmd_help $(LIBDIR) + chmod 0644 $(LIBDIR)/cmd_help + cp Mushrc $(MRCDIR)/Mushrc + chmod 0644 $(MRCDIR)/Mushrc diff -c 'mush-7.2.5unoff2.debian/makefile.sys.v' 'mush-7.2.5unoff2/makefile.sys.v' Index: ./makefile.sys.v *** ./makefile.sys.v Tue May 15 12:28:52 2001 --- ./makefile.sys.v Tue May 15 12:44:59 2001 *************** *** 31,36 **** --- 31,37 ---- # LIBS= -L/usr/5lib -lcurses # IRIX 3.2 systems (SGI Iris workstations) should add -DDIRECTORY to CFLAGS + # IRIX 4.x systems should add -DIRIX4 -DBASENAME -DDECLARE_ERRLIST -DNO_FLOCK # SCO UNIX 3.2 should add -DDIRECTORY -DSELECT and should avoid library -lx # System V Release 4 (SunOS 5?) should add -DSVR4 -DDIRECTORY to CFLAGS and # should replace -lPW with -lgen *************** *** 42,47 **** --- 43,52 ---- OTHERLIBS= # Use some variant of this one if you #define MMDF in config.h #OTHERLIBS=/usr/src/mmdf/lib/libmmdf.a + + # GCC needs -fwritable-strings + #CC= gcc -fwritable-strings + PROG= mush $(PROG): $(OBJS1) $(OBJS2) diff -c 'mush-7.2.5unoff2.debian/makefile.xenix' 'mush-7.2.5unoff2/makefile.xenix' Index: ./makefile.xenix *** ./makefile.xenix Tue May 15 12:28:52 2001 --- ./makefile.xenix Tue May 15 12:44:59 2001 *************** *** 41,46 **** --- 41,49 ---- # Use some variant of this one if you #define MMDF in config.h #OTHERLIBS=/usr/src/mmdf/lib/libmmdf.a + # GCC needs -fwritable-strings + #CC= gcc -fwritable-strings + mush: $(OBJS) @echo loading... @cc $(LDFLAGS) $(OBJS) $(LIBS) $(OTHERLIBS) -o mush diff -c 'mush-7.2.5unoff2.debian/misc.c' 'mush-7.2.5unoff2/misc.c' Index: ./misc.c *** ./misc.c Fri Oct 30 14:55:37 1992 --- ./misc.c Tue May 15 16:42:29 2001 *************** *** 218,223 **** --- 218,224 ---- return ret_val; } + void glob_test(s) char *s; { *************** *** 336,342 **** if (!msg_bit(list, i)) continue; else if (!newflag) { ! wprint("msg %d: offset: %d, lines: %d, bytes: %d, flags:", i+1, msg[i].m_offset, msg[i].m_lines, msg[i].m_size); if (ison(msg[i].m_flags, UNREAD)) wprint(" UNREAD"); --- 337,343 ---- if (!msg_bit(list, i)) continue; else if (!newflag) { ! wprint("msg %d: offset: %ld, lines: %d, bytes: %ld, flags:", i+1, msg[i].m_offset, msg[i].m_lines, msg[i].m_size); if (ison(msg[i].m_flags, UNREAD)) wprint(" UNREAD"); *************** *** 762,767 **** --- 763,792 ---- (void) fflush(stdout); /* for sys-v and older xenix */ } + /* + * Load an X-Face header from a file + */ + int + load_xface(facebuf) + char *facebuf; + { + FILE *fp; + char buf[MAXPATHLEN]; + int n = 0; + + facebuf[0] = '\0'; + (void) strcpy(buf, getpath("~/.face", &n)); + if (n == 0 && (fp = fopen(buf, "r"))) { + while (fgets(buf, MAXPATHLEN, fp) != NULL) { + if (facebuf[0] != '\0' && buf[strlen(buf) - 1] == '\n') + (void) strcat(facebuf, " "); + (void) strcat(facebuf, buf); + } + (void) fclose(fp); + return 1; + } else + return 0; + } /* return -1 since function doesn't affect messages */ check_flags(flags) diff -c 'mush-7.2.5unoff2.debian/msgs.c' 'mush-7.2.5unoff2/msgs.c' Index: ./msgs.c *** ./msgs.c Tue May 15 12:28:52 2001 --- ./msgs.c Tue May 15 16:42:29 2001 *************** *** 172,178 **** } if (ison(flags, UPDATE_STATUS)) ! if (!strncmp(line, "Status:", 7) || !strncmp(line, "Priority:", 9)) continue; /* ignore "Status" and "Priority" lines */ else if (!on_hdr) { int i, write_priority = 0; --- 172,179 ---- } if (ison(flags, UPDATE_STATUS)) ! if (!lcase_strncmp(line, "Status:", 7) || ! !lcase_strncmp(line, "Priority:", 9)) continue; /* ignore "Status" and "Priority" lines */ else if (!on_hdr) { int i, write_priority = 0; *************** *** 520,529 **** #ifdef POSIX_UTIME struct utimbuf times[1]; (void) fflush(mail_fp); /* just in case */ ! times[0].modtime = time(×[0].actime) - 2; ! #ifndef __linux__ times[0].ausec = times[0].modusec = 0; ! #endif /* __linux__ */ #else /* !POSIX_UTIME */ long times[2]; (void) fflush(mail_fp); /* just in case */ --- 521,532 ---- #ifdef POSIX_UTIME struct utimbuf times[1]; (void) fflush(mail_fp); /* just in case */ ! time(×[0].actime); ! times[0].modtime = times[0].actime - 2; ! #ifdef POSIX_UTIME_USEC ! /* this isn't in MY posix manual (IEEE Std 1003.1-1988, 5.6.6.1) */ times[0].ausec = times[0].modusec = 0; ! #endif /* POSIX_UTIME_USEC */ #else /* !POSIX_UTIME */ long times[2]; (void) fflush(mail_fp); /* just in case */ *************** *** 741,746 **** --- 744,751 ---- * to UUCP path form. * g. Append the saved username to return_path. */ + static + void parse_from(fp, path) FILE *fp; char path[]; *************** *** 751,764 **** path[0] = '\0'; while (fgets(buf, sizeof buf, fp)) { ! if (strncmp(buf, ">From ", 6)) break; p = buf + 6; (void) sscanf(p, "%s", user); while (p = index(p+1, 'r')) { ! if (!strncmp(p, "remote from ", 12)) { char *p2 = path+strlen(path); skipspaces(12); (void) sscanf(p, "%s", p2); /* add the new machine to current path */ --- 756,769 ---- path[0] = '\0'; while (fgets(buf, sizeof buf, fp)) { ! if (lcase_strncmp(buf, ">From ", 6)) break; p = buf + 6; (void) sscanf(p, "%s", user); while (p = index(p+1, 'r')) { ! if (!lcase_strncmp(p, "remote from ", 12)) { char *p2 = path+strlen(path); skipspaces(12); (void) sscanf(p, "%s", p2); /* add the new machine to current path */ *************** *** 795,801 **** char buf[BUFSIZ]; int lines = 0, msg_found = 0, had_error = 1; int get_status = 1, cnt; ! long bytes, ftell(); struct msg old; char *p, date[64]; FILE *fp; --- 800,806 ---- char buf[BUFSIZ]; int lines = 0, msg_found = 0, had_error = 1; int get_status = 1, cnt; ! long bytes; struct msg old; char *p, date[64]; FILE *fp; *************** *** 909,915 **** lines = 1; /* count the From_ line */ if (warn) turnon(glob_flags, WARNING); ! strdup(msg[cnt].m_date_recv, date); #endif /* MSG_SEPARATOR */ turnon(msg[cnt].m_flags, UNREAD); /* initialize */ /* we've read the "From " line(s), now read the rest of --- 914,920 ---- lines = 1; /* count the From_ line */ if (warn) turnon(glob_flags, WARNING); ! strdup1(msg[cnt].m_date_recv, date); #endif /* MSG_SEPARATOR */ turnon(msg[cnt].m_flags, UNREAD); /* initialize */ /* we've read the "From " line(s), now read the rest of *************** *** 926,936 **** /* Try once more the hard way */ (p = get_name_n_addr(buf + 5, NULL, NULL)) && (p = parse_date(p + 1))) ! strdup(msg[cnt].m_date_recv, p); } else #endif /* MMDF */ if (!strncmp(buf, "Date:", 5)) ! strdup(msg[cnt].m_date_sent, parse_date(p+5)); else if (!msg[cnt].m_date_sent && !lcase_strncmp(buf, "Resent-Date:", 12)) msg[cnt].m_date_sent = savestr(parse_date(p+12)); --- 931,941 ---- /* Try once more the hard way */ (p = get_name_n_addr(buf + 5, NULL, NULL)) && (p = parse_date(p + 1))) ! strdup1(msg[cnt].m_date_recv, p); } else #endif /* MMDF */ if (!strncmp(buf, "Date:", 5)) ! strdup1(msg[cnt].m_date_sent, parse_date(p+5)); else if (!msg[cnt].m_date_sent && !lcase_strncmp(buf, "Resent-Date:", 12)) msg[cnt].m_date_sent = savestr(parse_date(p+12)); *************** *** 944,950 **** M_PRIORITY(upper(*p) - 'A' + 1)); } } else if (get_status && ! !(get_status = strncmp(p, "Status:", 7))) { /* new mail should not have a Status: field! */ turnon(msg[cnt].m_flags, OLD); for (p += 7 ; *p != '\n'; p++) { --- 949,955 ---- M_PRIORITY(upper(*p) - 'A' + 1)); } } else if (get_status && ! !(get_status = lcase_strncmp(p, "Status:", 7))) { /* new mail should not have a Status: field! */ turnon(msg[cnt].m_flags, OLD); for (p += 7 ; *p != '\n'; p++) { *************** *** 980,988 **** msg[cnt].m_date_sent = msg[cnt].m_date_recv = "0000000000XXX"; } else ! strdup(msg[cnt].m_date_sent, msg[cnt].m_date_recv); else if (!msg[cnt].m_date_recv || !*msg[cnt].m_date_recv) ! strdup(msg[cnt].m_date_recv, msg[cnt].m_date_sent); if (had_error) break; if (append && list) --- 985,993 ---- msg[cnt].m_date_sent = msg[cnt].m_date_recv = "0000000000XXX"; } else ! strdup1(msg[cnt].m_date_sent, msg[cnt].m_date_recv); else if (!msg[cnt].m_date_recv || !*msg[cnt].m_date_recv) ! strdup1(msg[cnt].m_date_recv, msg[cnt].m_date_sent); if (had_error) break; if (append && list) *************** *** 1016,1021 **** --- 1021,1033 ---- if (!append) (void) fputs(END_MSG_SEP, tmpf); #endif /* MMDF */ + /* + * Try a little harder to detect i/o errors. + */ + if (isoff(glob_flags, READ_ONLY) && fflush(tmpf) != 0) { + error(tempfile); + had_error++; + } if (had_error) { if (!append) msg[cnt] = old; diff -c 'mush-7.2.5unoff2.debian/mush.1' 'mush-7.2.5unoff2/mush.1' Index: ./mush.1 *** ./mush.1 Fri Oct 30 14:55:03 1992 --- ./mush.1 Tue May 15 12:45:00 2001 *************** *** 3249,3255 **** .B home variable descriptions for more information. .TP ! .BR sort " [\-i] [[\-r] \-a | \-d | \-l | \-p | \-R | \-s | \-S]" This command sorts messages according to author, date, status or subject (with or without considering the \*QRe:\ \*U, in replied messages). In addition, the messages can be sorted in reverse order (same arguments). --- 3249,3255 ---- .B home variable descriptions for more information. .TP ! .BR sort " [\-i] [[\-r] \-a | \-d | \-l | \-p | \-R | \-s | \-S | \-t]" This command sorts messages according to author, date, status or subject (with or without considering the \*QRe:\ \*U, in replied messages). In addition, the messages can be sorted in reverse order (same arguments). *************** *** 3267,3272 **** --- 3267,3273 ---- \-R sort by subject including \*QRe:\*U \-s sort by subject (alphabetical) \-S sort by message status + \-t sort by To: address .in -2 .fi .sp *************** *** 5035,5040 **** --- 5036,5042 ---- .in +4 .\" \& escapes are to make obvious the tab after each word mail\&\& Confirm sending of mail (as above). + update\&\& Confirm updating of mailfolders. save\&\& Confirm save-item selections (tool only). .in -4 .fi diff -c 'mush-7.2.5unoff2.debian/mush.h' 'mush-7.2.5unoff2/mush.h' Index: ./mush.h Prereq: 1986 *** ./mush.h Tue May 15 12:28:52 2001 --- ./mush.h Tue May 15 13:09:25 2001 *************** *** 51,57 **** #endif #endif /* CURSES */ ! #if defined(SVR4) #include #endif /* SVR4 */ --- 51,57 ---- #endif #endif /* CURSES */ ! #if defined(SVR4) && !defined(__linux__) #include #endif /* SVR4 */ *************** *** 235,240 **** --- 235,241 ---- #ifdef __linux__ typedef struct termios SGTTY; #endif + #endif /* If curses isn't defined, declare our 'tty' and macros for echo/cbreak */ #ifndef CURSES *************** *** 255,261 **** #define crmode() ((iscurses) ? cbreak() : cbrkon()) #define nocrmode() ((iscurses) ? nocbreak() : cbrkoff()) #endif /* CURSES */ - #endif /* SYSV && USG || AIX */ #if !defined(USG) && !defined(AIX) #ifndef CURSES --- 256,261 ---- *************** *** 288,298 **** /* These macros now turn on/off echo/cbreak independent of the UNIX running */ #define echo_on() \ ! if (_tty.sg_flags && isoff(glob_flags, ECHO_FLAG)) nocrmode(), echom() #define echo_off() \ ! if (_tty.sg_flags && isoff(glob_flags, ECHO_FLAG)) crmode(), noechom() ! #define strdup(dst, src) (xfree (dst), dst = savestr(src)) #define Debug if (debug == 0) {;} else (void) wprint #ifdef SYSV --- 288,298 ---- /* These macros now turn on/off echo/cbreak independent of the UNIX running */ #define echo_on() \ ! if (_tty.sg_flags && (isoff(glob_flags, ECHO_FLAG) || iscurses)) nocrmode(), echom() #define echo_off() \ ! if (_tty.sg_flags && (isoff(glob_flags, ECHO_FLAG) || iscurses)) crmode(), noechom() ! #define strdup1(dst, src) (xfree (dst), dst = savestr(src)) #define Debug if (debug == 0) {;} else (void) wprint #ifdef SYSV *************** *** 345,351 **** #if defined(CURSES) || defined(SUNTOOL) #define print_more turnon(glob_flags, CONT_PRNT), print ! void print(); /* printf to window or curses or tty accordingly */ #endif /* CURSES || SUNTOOL */ #define ArraySize(o) (sizeof(o) / sizeof(*o)) --- 345,351 ---- #if defined(CURSES) || defined(SUNTOOL) #define print_more turnon(glob_flags, CONT_PRNT), print ! void print(char *,...); /* printf to window or curses or tty accordingly */ #endif /* CURSES || SUNTOOL */ #define ArraySize(o) (sizeof(o) / sizeof(*o)) diff -c 'mush-7.2.5unoff2.debian/options.c' 'mush-7.2.5unoff2/options.c' Index: ./options.c *** ./options.c Tue May 15 12:28:52 2001 --- ./options.c Tue May 15 16:42:29 2001 *************** *** 8,14 **** * listed AFTER the flag it prefixes in the list below */ ! char *word_flags[][2] = { { "-bcc", "-b" }, { "-blindcarbon", "-b" }, { "-blind", "-b" }, --- 8,14 ---- * listed AFTER the flag it prefixes in the list below */ ! static char *word_flags[][2] = { { "-bcc", "-b" }, { "-blindcarbon", "-b" }, { "-blind", "-b" }, *************** *** 47,52 **** --- 47,54 ---- { NULL, NULL } /* This must be the last entry */ }; + static + void fix_word_flag(argp) register char **argp; { *************** *** 191,196 **** --- 193,199 ---- ""; #endif + void parse_options(argvp, flags) register char ***argvp; struct mush_flags *flags; *************** *** 266,279 **** (void) sprintf(buf, "%%%s", (*argvp)[1] ? (*argvp)[1] : "root"); if ((p = getpath(buf, &isdir)) && !isdir) ! strdup(flags->folder, p); else if (isdir < 0) puts(p), exit(1); else if (isdir) (void) printf("Mailbox \"%s\" is a directory\n", p), exit(1); } #else /* HOMEMAIL */ ! strdup(flags->folder, sprintf(buf, "%s/%s", MAILDIR, ((*argvp)[1])? (*argvp)[1] : "root")); #endif /* HOMEMAIL */ if ((*argvp)[1]) --- 269,282 ---- (void) sprintf(buf, "%%%s", (*argvp)[1] ? (*argvp)[1] : "root"); if ((p = getpath(buf, &isdir)) && !isdir) ! strdup1(flags->folder, p); else if (isdir < 0) puts(p), exit(1); else if (isdir) (void) printf("Mailbox \"%s\" is a directory\n", p), exit(1); } #else /* HOMEMAIL */ ! strdup1(flags->folder, sprintf(buf, "%s/%s", MAILDIR, ((*argvp)[1])? (*argvp)[1] : "root")); #endif /* HOMEMAIL */ if ((*argvp)[1]) *************** *** 298,304 **** } when 'm': if ((*argvp)[1]) ! strdup(spoolfile, *++(*argvp)); else (void) printf("-m: missing mailbox name.\n"), exit(1); look_again = FALSE; --- 301,307 ---- } when 'm': if ((*argvp)[1]) ! strdup1(spoolfile, *++(*argvp)); else (void) printf("-m: missing mailbox name.\n"), exit(1); look_again = FALSE; *************** *** 306,315 **** if (*(flags->folder)) puts("You can't specify more than one mailbox"), exit(1); if ((*argvp)[1]) { ! strdup(flags->folder, *++(*argvp)); look_again = FALSE; } else ! strdup(flags->folder, "&"); when 's': if (istool) puts("bad option when run as a tool"), exit(1); --- 309,318 ---- if (*(flags->folder)) puts("You can't specify more than one mailbox"), exit(1); if ((*argvp)[1]) { ! strdup1(flags->folder, *++(*argvp)); look_again = FALSE; } else ! strdup1(flags->folder, "&"); when 's': if (istool) puts("bad option when run as a tool"), exit(1); diff -c 'mush-7.2.5unoff2.debian/panels.c' 'mush-7.2.5unoff2/panels.c' Index: ./panels.c *** ./panels.c Thu Dec 6 19:53:18 1990 --- ./panels.c Tue May 15 12:45:00 2001 *************** *** 393,399 **** PANEL_ATTRIBUTE_LIST, choice_args, PANEL_DISPLAY_LEVEL, PANEL_ALL, PANEL_SHOW_MENU_MARK, TRUE, ! PANEL_SHOW_ITEM, FALSE, PANEL_LABEL_STRING, "Autosign:", PANEL_CHOICE_STRINGS, "Off", "On", NULL, NULL); --- 393,399 ---- PANEL_ATTRIBUTE_LIST, choice_args, PANEL_DISPLAY_LEVEL, PANEL_ALL, PANEL_SHOW_MENU_MARK, TRUE, ! PANEL_SHOW_ITEM, TRUE, PANEL_LABEL_STRING, "Autosign:", PANEL_CHOICE_STRINGS, "Off", "On", NULL, NULL); *************** *** 433,439 **** PANEL_ATTRIBUTE_LIST, choice_args, PANEL_DISPLAY_LEVEL, PANEL_ALL, PANEL_SHOW_MENU_MARK, TRUE, ! PANEL_SHOW_ITEM, FALSE, PANEL_LABEL_STRING, "Fortune:", PANEL_CHOICE_STRINGS, "Off", "On", NULL, NULL); --- 433,439 ---- PANEL_ATTRIBUTE_LIST, choice_args, PANEL_DISPLAY_LEVEL, PANEL_ALL, PANEL_SHOW_MENU_MARK, TRUE, ! PANEL_SHOW_ITEM, TRUE, PANEL_LABEL_STRING, "Fortune:", PANEL_CHOICE_STRINGS, "Off", "On", NULL, NULL); diff -c 'mush-7.2.5unoff2.debian/pick.c' 'mush-7.2.5unoff2/pick.c' Index: ./pick.c Prereq: 7.2 *** ./pick.c Fri Oct 30 14:55:41 1992 --- ./pick.c Tue May 15 12:45:00 2001 *************** *** 2,7 **** --- 2,9 ---- #include "mush.h" + static find_pattern(), date1(), ago_date(); + static int before, after, search_from, search_subj, search_to, xflg, icase; static u_long match_priority; static char search_hdr[64]; *************** *** 9,14 **** --- 11,24 ---- static int pick(); static void month_day_year(); + #ifdef REGCOMP + regerror(msg) + char *msg; + { + printf("regcomp error: %s\n", msg); + } + #endif + do_pick(n, argv, list) register int n; register char **argv, list[]; *************** *** 174,180 **** return -1; } } ! search = (pattern[0] || mdy[1] || match_priority > 0); if (verbose) { if (head_cnt + tail_cnt >= 0) { print("Finding the "); --- 184,190 ---- return -1; } } ! search = (pattern[0] || mdy[1] || (match_priority != 0)); if (verbose) { if (head_cnt + tail_cnt >= 0) { print("Finding the "); *************** *** 199,205 **** print_more(" of the last %d", tail_cnt); } else print_more("Searching for %smessages", ! match_priority > 0 ? "priority " : ""); if (!search) { if (tail_cnt > 0 && head_cnt > 0) print_more(" messages"); --- 209,215 ---- print_more(" of the last %d", tail_cnt); } else print_more("Searching for %smessages", ! match_priority != 0 ? "priority " : ""); if (!search) { if (tail_cnt > 0 && head_cnt > 0) print_more(" messages"); *************** *** 280,285 **** --- 290,296 ---- * the list of messages which have matched the pattern. * return -1 for internal error or # of pattern matches. */ + static find_pattern(cnt, p, check_list, ret_list) int cnt; register char *p; *************** *** 291,299 **** --- 302,316 ---- char buf[HDRSIZ]; char *err = NULL; #ifdef REGCMP + #ifndef POSIX char *regcmp(), *regex(); + #endif #else /* REGCMP */ + # ifdef REGCOMP + char *regcomp(), *regexec(); + # else char *re_comp(); + # endif #endif /* REGCMP */ if (p && *p == '\\') *************** *** 310,320 **** --- 327,344 ---- return -1; } #else /* REGCMP */ + # ifdef REGCOMP + if ((err = regcomp(p)) == NULL) { + clear_msg_list(ret_list); + return -1; + } + # else if (err = re_comp(p)) { print("re_comp error: %s\n", err); clear_msg_list(ret_list); return -1; } + # endif #endif /* REGCMP */ } else if (err == NULL && mdy[1] <= 0 && match_priority == 0) { print("No previous regular expression\n"); *************** *** 324,330 **** /* start searching: set bytes, and message number: n */ for (n = 0; cnt && n < msg_cnt; n++) if (msg_bit(check_list, n)) { ! if (match_priority > 0) { if (msg[n].m_flags & match_priority) ++matches, set_msg_bit(ret_list, n); continue; --- 348,354 ---- /* start searching: set bytes, and message number: n */ for (n = 0; cnt && n < msg_cnt; n++) if (msg_bit(check_list, n)) { ! if (match_priority != 0) { if (msg[n].m_flags & match_priority) ++matches, set_msg_bit(ret_list, n); continue; *************** *** 396,402 **** --- 420,430 ---- #ifdef REGCMP val = !!regex(err, p, NULL); /* convert value to a boolean */ #else /* REGCMP */ + # ifdef REGCOMP + val = !!regexec(err, p); + # else val = re_exec(p); + # endif #endif /* REGCMP */ if (val == -1) { /* doesn't apply in system V */ print("Internal error for pattern search.\n"); *************** *** 417,422 **** --- 445,456 ---- #ifdef REGCMP if (err) free(err); + #else + # ifdef REGCOMP + if (err) + /* XXX: regfree soon */ + free(err); + # endif #endif /* REGCMP */ return matches; } *************** *** 437,445 **** --- 471,485 ---- static char *err = (char *)-1, direction; SIGRET (*oldint)(), (*oldquit)(); #ifdef REGCMP + #ifndef POSIX char *regex(), *regcmp(); + #endif #else /* REGCMP */ + # ifdef REGCOMP + char *regcomp(), *regexec(); + # else char *re_comp(); + # endif #endif /* REGCMP */ if (msg_cnt <= 1) { *************** *** 468,477 **** --- 508,524 ---- return 0; } #else /* REGCMP */ + # ifdef REGCOMP + if (*pattern && !(err = regcomp(pattern, NULL))) { + print("Error in regcomp in %s", pattern); + return 0; + } + # else if (err = re_comp(pattern)) { print(err); return 0; } + # endif #endif /* REGCMP */ move(LINES-1, 0), refresh(); on_intr(); *************** *** 486,497 **** --- 533,559 ---- #ifdef REGCMP val = !!regex(err, p, NULL); /* convert value to a boolean */ #else /* REGCMP */ + # ifdef REGCOMP + val = !!regexec(err, p); + # else val = re_exec(p); + # endif #endif /* REGCMP */ if (val == -1) /* doesn't apply in system V */ print("Internal error for pattern search.\n"); } while (!val && current_msg != this_msg && isoff(glob_flags, WAS_INTR)); + #ifdef REGCMP + if (err) + free(err); + #else + # ifdef REGCOMP + if (err) + /* XXX: regfree soon */ + free(err); + # endif + #endif /* REGCMP */ + if (ison(glob_flags, WAS_INTR)) { print("Pattern search interrupted."); current_msg = this_msg; *************** *** 531,536 **** --- 593,599 ---- * parse a user given date string and set mdy[] array with correct * values. Return 0 on failure. */ + static date1(p) register char *p; { *************** *** 590,595 **** --- 653,659 ---- * * Return number of args parsed; -1 on error. */ + static ago_date(argv) char **argv; { diff -c 'mush-7.2.5unoff2.debian/pmush.c' 'mush-7.2.5unoff2/pmush.c' Index: ./pmush.c *** ./pmush.c Tue May 15 12:28:52 2001 --- ./pmush.c Tue May 15 13:48:43 2001 *************** *** 15,21 **** --- 15,23 ---- #include "mush.h" #include "pop.h" + #include + #ifndef HAS_STRSTR /* * strstr - find first occurrence of wanted in s */ *************** *** 41,46 **** --- 43,49 ---- return NULL; return scan; } + #endif /* This routine forms the header line for the From and Date functions below. * It was written by John Kammens for use by UCSC's version of UCBmail running diff -c 'mush-7.2.5unoff2.debian/print.c' 'mush-7.2.5unoff2/print.c' Index: ./print.c Prereq: 2.4 *** ./print.c Tue May 15 12:28:52 2001 --- ./print.c Tue May 15 16:42:30 2001 *************** *** 1,8 **** --- 1,12 ---- /* @(#)print.c 2.4 (c) copyright 10/15/86 (Dan Heller) */ #include "mush.h" + #ifdef __STDC__ + #include + #else #undef va_start #include + #endif /*ARGSUSED*/ /*VARARGS1*/ *************** *** 35,47 **** * If you're running SUN3.2 or higher, the typecast (unsigned char *)msgbuf * (where indicated) otherwise, msgbuf is not typecast at all. */ /*VARARGS*/ void print(va_alist) va_dcl { - static char msgbuf[BUFSIZ]; char *fmt; va_list args; #ifndef VPRINTF FILE foo; --- 39,59 ---- * If you're running SUN3.2 or higher, the typecast (unsigned char *)msgbuf * (where indicated) otherwise, msgbuf is not typecast at all. */ + #ifdef __STDC__ + /* WARNING: the below has become a twistly little maze of ifdef's, all + * different */ + void + print(char *fmt,...) + { + #else /* __STDC__ */ /*VARARGS*/ void print(va_alist) va_dcl { char *fmt; + #endif /* __STDC__ */ + static char msgbuf[BUFSIZ]; va_list args; #ifndef VPRINTF FILE foo; *************** *** 56,63 **** --- 68,79 ---- } else #endif /* CURSES */ if (istool < 2) { + #ifdef __STDC__ + va_start(args,fmt); + #else va_start(args); fmt = va_arg(args, char *); + #endif #ifdef VPRINTF (void) vprintf(fmt, args); #else /* VPRINTF */ *************** *** 67,74 **** --- 83,94 ---- (void) fflush(stdout); return; } + #ifdef __STDC__ + va_start(args,fmt); + #else va_start(args); fmt = va_arg(args, char *); + #endif if (fmt) { #ifdef VPRINTF (void) vsprintf(msgbuf, fmt, args); /* NULL in fmt reprints last msg */ *************** *** 97,103 **** /* don't wrap the line! Just print it and refresh() */ printw("%-.*s", len, p), clrtoeol(), refresh(); /* if length(p) (remainder of msgbuf) doesn't wrap, break loop */ ! if ((x += strlen(p)) < COLS-1) break; /* the next print will overwrite bottom line, so \n first */ putchar('\n'), move(LINES-1, x = 0); /* reset x */ --- 117,123 ---- /* don't wrap the line! Just print it and refresh() */ printw("%-.*s", len, p), clrtoeol(), refresh(); /* if length(p) (remainder of msgbuf) doesn't wrap, break loop */ ! if ((x += strlen(p)) < (unsigned int)(COLS-1)) break; /* the next print will overwrite bottom line, so \n first */ putchar('\n'), move(LINES-1, x = 0); /* reset x */ *************** *** 115,123 **** --- 135,145 ---- #endif /* SUNTOOL || CURSES */ /* for curses mode */ + void clr_bot_line() { print(""); + return; } #ifdef SUNTOOL *************** *** 140,145 **** --- 162,169 ---- #endif /* VPRINTF */ char msgbuf[BUFSIZ]; /* we're not getting huge strings */ char *fmt; + int msglen; + int max_mem; va_list args; if (istool < 2) { *************** *** 169,175 **** --- 193,234 ---- _doprnt(fmt, args, &foo); /* format like printf into msgbuf via foo */ *foo._ptr = '\0'; /* plant terminating null character */ #endif /* VPRINTF */ + #ifndef DEBIAN + msglen = strlen(msgbuf); + max_mem = (int)window_get(mfprint_sw, TEXTSW_MEMORY_MAXIMUM); + /* textsw seems to require a bout 25 bytes of overhead, + * we'll allow for 80 + */ + if ((int)window_get(mfprint_sw, TEXTSW_LENGTH) + msglen + 80 >= max_mem) { + Textsw_index first, last_plus_one; + char *tmpbuf; + + first = max_mem/2 + 1; + if (tmpbuf = malloc(max_mem/2 + 1)) { + if (textsw_find_bytes(mfprint_sw, &first, &last_plus_one, + "\n", 1, 0) != -1) { + window_get(mfprint_sw, TEXTSW_CONTENTS, last_plus_one, + tmpbuf, max_mem/2 + 1); + } else { + free(tmpbuf); + tmpbuf = NULL; + } + } + textsw_reset(mfprint_sw, 0, 0); + window_set(mfprint_sw, + TEXTSW_READ_ONLY, TRUE, + TEXTSW_BLINK_CARET, FALSE, + TEXTSW_LINE_BREAK_ACTION, TEXTSW_WRAP_AT_CHAR, + 0); + if (tmpbuf) { + window_set(mfprint_sw, TEXTSW_CONTENTS, tmpbuf, 0); + free(tmpbuf); + } + } + textsw_insert(mfprint_sw, msgbuf, msglen); + #else textsw_insert(mfprint_sw, msgbuf, strlen(msgbuf)); + #endif } va_end(args); } diff -c 'mush-7.2.5unoff2.debian/sendmime.c' 'mush-7.2.5unoff2/sendmime.c' Index: ./sendmime.c Prereq: 1996 *** ./sendmime.c Tue May 15 12:28:52 2001 --- ./sendmime.c Thu May 17 12:35:51 2001 *************** *** 7,12 **** --- 7,13 ---- #include "mush.h" #include + #include /* we really need a function, not a macro... */ #undef strdup *************** *** 40,45 **** --- 41,47 ---- *tempfile, *ptr; FILE *fp_temp, *fp_pipe; int res; + char buf[BUFSIZ]; ptr=do_set(set_options,"metasend"); if(!ptr || !*ptr) { *************** *** 76,92 **** guess_type=mime_parts[0].mimetype; free(mime_parts[0].encoding); } ! final_type=strdup(set_header("Mime type: ",guess_type,TRUE)); if(strncmp(final_type,"text/",5)) guess_encoding="base64"; else guess_encoding="quoted-printable"; ! final_encoding=strdup(set_header("Encoding: ",guess_encoding,TRUE)); while(strcmp(final_encoding,"7bit")&& strcmp(final_encoding,"base64")&& strcmp(final_encoding,"quoted-printable")&& strcmp(final_encoding,"x-uue")) { error("unknown encoding: %s",final_encoding); free(final_encoding); ! final_encoding=strdup(set_header("Encoding: ",guess_encoding,TRUE)); } if(isattach) { mime_attcnt++; --- 78,97 ---- guess_type=mime_parts[0].mimetype; free(mime_parts[0].encoding); } ! sprintf(buf, "Mime type: (%s) ", guess_type); ! final_type=strdup(set_header(buf, "",TRUE)); if(strncmp(final_type,"text/",5)) guess_encoding="base64"; else guess_encoding="quoted-printable"; ! sprintf(buf, "Encoding: (%s) ", guess_encoding); ! final_encoding=strdup(set_header(buf,"",TRUE)); while(strcmp(final_encoding,"7bit")&& strcmp(final_encoding,"base64")&& strcmp(final_encoding,"quoted-printable")&& strcmp(final_encoding,"x-uue")) { error("unknown encoding: %s",final_encoding); free(final_encoding); ! sprintf(buf, "Encoding: (%s) ", guess_encoding); ! final_encoding=strdup(set_header(buf,"",TRUE)); } if(isattach) { mime_attcnt++; diff -c 'mush-7.2.5unoff2.debian/setopts.c' 'mush-7.2.5unoff2/setopts.c' Index: ./setopts.c *** ./setopts.c Tue May 15 12:28:52 2001 --- ./setopts.c Tue May 15 13:12:03 2001 *************** *** 2,7 **** --- 2,8 ---- #include "mush.h" #include "bindings.h" + #include static void insert_option(list, opt, order) *************** *** 88,102 **** #endif /* SUNTOOL */ if (!strcmp(tmp->option, "cmd_help")) if (tmp->value && *(tmp->value)) ! strdup(cmd_help, tmp->value); else { int n = 0; /* don't ignore no such file or directory */ char *p = getpath(COMMAND_HELP, &n); if (n) ! strdup(cmd_help, "cmd_help"); else ! strdup(cmd_help, p); ! strdup(tmp->value, cmd_help); } else if (!strcmp(tmp->option, "prompt")) prompt = (tmp->value)? tmp->value : DEF_PROMPT; --- 89,103 ---- #endif /* SUNTOOL */ if (!strcmp(tmp->option, "cmd_help")) if (tmp->value && *(tmp->value)) ! strdup1(cmd_help, tmp->value); else { int n = 0; /* don't ignore no such file or directory */ char *p = getpath(COMMAND_HELP, &n); if (n) ! strdup1(cmd_help, "cmd_help"); else ! strdup1(cmd_help, p); ! strdup1(tmp->value, cmd_help); } else if (!strcmp(tmp->option, "prompt")) prompt = (tmp->value)? tmp->value : DEF_PROMPT; *************** *** 275,292 **** int n = 0; char *p2 = getpath(TOOL_HELP, &n); if (n) ! strdup(tool_help, "tool_help"); else ! strdup(tool_help, p2); } else #endif /* SUNTOOL */ if (!strcmp(p, "cmd_help")) { int n = 0; /* don't ignore no such file or directory */ char *p2 = getpath(COMMAND_HELP, &n); if (n) ! strdup(cmd_help, "cmd_help"); else ! strdup(cmd_help, p2); } else if (!strcmp(p, "wrapcolumn")) wrapcolumn = 0; else if (!strcmp(p, "history")) --- 276,293 ---- int n = 0; char *p2 = getpath(TOOL_HELP, &n); if (n) ! strdup1(tool_help, "tool_help"); else ! strdup1(tool_help, p2); } else #endif /* SUNTOOL */ if (!strcmp(p, "cmd_help")) { int n = 0; /* don't ignore no such file or directory */ char *p2 = getpath(COMMAND_HELP, &n); if (n) ! strdup1(cmd_help, "cmd_help"); else ! strdup1(cmd_help, p2); } else if (!strcmp(p, "wrapcolumn")) wrapcolumn = 0; else if (!strcmp(p, "history")) diff -c 'mush-7.2.5unoff2.debian/signals.c' 'mush-7.2.5unoff2/signals.c' Index: ./signals.c *** ./signals.c Tue May 15 12:28:52 2001 --- ./signals.c Tue May 15 12:45:01 2001 *************** *** 124,131 **** #ifdef SIGCONT #ifdef SIGTTOU ! jmp_buf ttoubuf; SIGRET tostop(sig) { --- 124,132 ---- #ifdef SIGCONT #ifdef SIGTTOU ! static jmp_buf ttoubuf; + static SIGRET tostop(sig) { *************** *** 365,372 **** return 1; /* Nothing to print */ #ifdef SUNTOOL if (istool) { mail_status(0); ! (void) do_hdrs(0, DUBL_NULL, NULL); if (noisy && !chk_option("quiet", "tool")) bell(); } --- 366,378 ---- return 1; /* Nothing to print */ #ifdef SUNTOOL if (istool) { + char *av[3], buf[8]; mail_status(0); ! /* do_hdrs(0, ...) repositions the display, so pass an arg */ ! av[0] = "h"; ! av[1] = sprintf(buf, "%d", n_array[0] + 1); ! av[2] = NULL; ! (void) do_hdrs(2, av, NULL); if (noisy && !chk_option("quiet", "tool")) bell(); } *************** *** 401,407 **** last_msg_cnt = msg_cnt; else while (last_msg_cnt < msg_cnt) { char *p2 = compose_hdr(last_msg_cnt++) + 9; ! if (strlen(p2) + (p - buf) >= BUFSIZ-5) { (void) strcpy(p, "...\n"); /* force a break by setting last_msg_cnt correctly */ last_msg_cnt = msg_cnt; --- 407,413 ---- last_msg_cnt = msg_cnt; else while (last_msg_cnt < msg_cnt) { char *p2 = compose_hdr(last_msg_cnt++) + 9; ! if ((strlen(p2) + (p - buf)) >= (unsigned int)(BUFSIZ-5)) { (void) strcpy(p, "...\n"); /* force a break by setting last_msg_cnt correctly */ last_msg_cnt = msg_cnt; diff -c 'mush-7.2.5unoff2.debian/sort.c' 'mush-7.2.5unoff2/sort.c' Index: ./sort.c *** ./sort.c Tue May 15 12:28:52 2001 --- ./sort.c Tue May 15 12:45:01 2001 *************** *** 1,6 **** --- 1,9 ---- /* sort.c 3.0 (c) copyright 1986,1990 (Dan Heller) */ #include "mush.h" + + static pri_cmp(); + /* #define MYQSORT */ /* The size of this array should really be bounded by *************** *** 41,46 **** --- 44,50 ---- case 'l': /* sort by length in bytes */ case 'S': /* sort by message status */ case 'p': /* sort by message priority */ + case 't': /* sort by addressee */ /* skip consecutive repeats of the same flag */ if (depth < 1 || subsort[depth-1] != argv[0][n]) subsort[depth++] = argv[0][n]; *************** *** 122,127 **** --- 126,132 ---- } #endif /* MYSORT */ + static status_cmp(msg1, msg2) register struct msg *msg1, *msg2; { *************** *** 163,175 **** return pri_cmp(msg1, msg2); } author_cmp(msg1, msg2) register struct msg *msg1, *msg2; { char buf1[HDRSIZ], buf2[HDRSIZ]; int retval; ! (void) reply_to(msg1 - msg, 0, buf1); /* "0" for "author only" */ (void) reply_to(msg2 - msg, 0, buf2); Debug("author: msg %d: %s, msg %d: %s\n", msg1-msg, buf1, msg2-msg, buf2); if (ignore_case) --- 168,181 ---- return pri_cmp(msg1, msg2); } + static author_cmp(msg1, msg2) register struct msg *msg1, *msg2; { char buf1[HDRSIZ], buf2[HDRSIZ]; int retval; ! (void) reply_to(msg1 - msg, 0, buf1); (void) reply_to(msg2 - msg, 0, buf2); Debug("author: msg %d: %s, msg %d: %s\n", msg1-msg, buf1, msg2-msg, buf2); if (ignore_case) *************** *** 180,191 **** } /* compare messages according to size (length) */ size_cmp(msg1, msg2) register struct msg *msg1, *msg2; { int retval; ! Debug("sizes: (%d): %d, (%d): %d\"\n", msg1-msg, msg1->m_size, msg2-msg, msg2->m_size); if (retval = (msg1->m_size - msg2->m_size) * order) /* assign and test */ return retval; --- 186,198 ---- } /* compare messages according to size (length) */ + static size_cmp(msg1, msg2) register struct msg *msg1, *msg2; { int retval; ! Debug("sizes: (%d): %ld, (%d): %ld\"\n", msg1-msg, msg1->m_size, msg2-msg, msg2->m_size); if (retval = (msg1->m_size - msg2->m_size) * order) /* assign and test */ return retval; *************** *** 196,201 **** --- 203,209 ---- * Subject comparison ignoring Re: subject_to() appends an Re: if there is * any subject whatsoever. */ + static subject_cmp(msg1, msg2) register struct msg *msg1, *msg2; { *************** *** 229,234 **** --- 237,243 ---- * compare subject strings from two messages. * If Re is appended, so be it -- if user wants to ignore Re: use 'R' flag. */ + static subj_with_re(msg1, msg2) register struct msg *msg1, *msg2; { *************** *** 250,255 **** --- 259,290 ---- return retval ? retval : msg_cmp(msg1, msg2); } + /* + * compare addressee strings from two messages. + */ + static + addressee_cmp(msg1, msg2) + register struct msg *msg1, *msg2; + { + char buf1[HDRSIZ], buf2[HDRSIZ], *p; + int retval; + + if (!(p = header_field(msg1 - msg, "to"))) + p = ""; + (void) strcpy(buf1, p); + if (!(p = header_field(msg2 - msg, "to"))) + p = ""; + (void) strcpy(buf2, p); + Debug("addressees: (%d): \"%s\" (%d): \"%s\"\n", + msg1-msg, buf1, msg2-msg, buf2); + if (ignore_case) + retval = lcase_strncmp(buf1, buf2, -1) * order; + else + retval = strcmp(buf1, buf2) * order; + return retval ? retval : msg_cmp(msg1, msg2); + } + + static date_cmp(msg1, msg2) register struct msg *msg1, *msg2; { *************** *** 265,270 **** --- 300,306 ---- return tm1 < tm2 ? -order : (tm1 > tm2) ? order : msg_cmp(msg1, msg2); } + static pri_cmp(msg1, msg2) register struct msg *msg1, *msg2; { *************** *** 307,312 **** --- 343,349 ---- when 'R': retval = subj_with_re(msg1, msg2); when 'l': retval = size_cmp(msg1, msg2); /* length compare */ when 'p': retval = pri_cmp(msg1, msg2); + when 't': retval = addressee_cmp(msg1, msg2); otherwise: retval = status_cmp(msg1, msg2); } depth = sv_depth; diff -c 'mush-7.2.5unoff2.debian/strings.c' 'mush-7.2.5unoff2/strings.c' Index: ./strings.c *** ./strings.c Tue May 15 12:28:52 2001 --- ./strings.c Tue May 15 16:41:29 2001 *************** *** 55,60 **** --- 55,85 ---- return NULL; } + static int + chk_one_item(item, len, list, delimiters) + char *item; + char *list, *delimiters; + int len; + { + char *p; + + if (!item || !list || !len) + return 0; + + /* Find first delimiter, skipping leading delimiters */ + while (*list && (p = any(list, delimiters)) == list) + list++; + if (!*list) + return 0; + + if (p) { + if (len != p - list || lcase_strncmp(item, list, len) != 0) + return chk_one_item(item, len, p + 1, delimiters); + return 1; + } + return (lcase_strncmp(item, list, len) == 0 && strlen(list) == len); + } + /* check two lists of strings each of which contain substrings. * Each substring is delimited by any char in "delimiters" * return true if any elements in list1 are on list2. *************** *** 103,108 **** --- 128,135 ---- return chk_two_lists(list2, p, delimiters); } + + #ifndef HAS_BZERO bzero(addr, size) register char *addr; register int size; *************** *** 110,115 **** --- 137,143 ---- while (size-- > 0) addr[size] = 0; } + #endif /* do an atoi() on the string passed and return in "val" the decimal value. * the function returns a pointer to the location in the string that is not *************** *** 210,215 **** --- 238,257 ---- * if you know your system's sprintf returns a char *, you can remove the * define in strings.h */ + #ifdef __STDC__ + #include + char * + Sprintf(char *buf,char *fmt, ...) + { + va_list ap; + + va_start(ap,fmt); + (void) vsprintf(buf, fmt, ap); + va_end(ap); + return buf; + } + #else + #undef va_start #include /*VARARGS*/ *************** *** 239,244 **** --- 281,287 ---- va_end(ap); return buf; } + #endif void print_argv(argv) *************** *** 429,440 **** return start; } /* * This routine returns a pointer to the file portion of a path/file name. */ char * basename(path) ! register char *path; { char *file; --- 472,484 ---- return start; } + #ifdef BASENAME /* * This routine returns a pointer to the file portion of a path/file name. */ char * basename(path) ! char *path; { char *file; *************** *** 442,444 **** --- 486,489 ---- return ++file; return path; } + #endif diff -c 'mush-7.2.5unoff2.debian/strings.h' 'mush-7.2.5unoff2/strings.h' Index: ./strings.h *** ./strings.h Wed Jul 4 18:51:50 1990 --- ./strings.h Tue May 15 12:45:01 2001 *************** *** 10,24 **** --- 10,32 ---- #define rindex strrchr #endif /* SYSV */ + #ifdef __STDC__ + #include + #else /* External function definitions for routines described in string(3). */ extern char *strcat(), *strncat(), *strcpy(), *strncpy(), *index(), *rindex(), *getenv(); extern int strcmp(), strncmp(), strlen(); + #endif extern char + #ifdef __STDC__ + *Sprintf(char *buf, char *fmt, ...), /* ansi header for varargs */ + #else *Sprintf(), /* See comments above function in strings.c */ + #endif *argv_to_string(), /* convert a vector of strings into one string */ *any(), /* return first char in str2 that exists in str1 */ *basename(), /* return the last component of a file path */ diff -c 'mush-7.2.5unoff2.debian/util.c' 'mush-7.2.5unoff2/util.c' Index: ./util.c *** ./util.c Tue May 15 12:28:52 2001 --- ./util.c Tue May 15 12:31:16 2001 *************** *** 1,6 **** --- 1,7 ---- /* Code by Yves Arrouye */ #include "mush.h" + #include /* Return 1 if we think file is someone's sysspooldir, 0 otherwise. */ diff -c 'mush-7.2.5unoff2.debian/version.h' 'mush-7.2.5unoff2/version.h' Index: ./version.h Prereq: 1991 *** ./version.h Tue May 15 12:28:52 2001 --- ./version.h Tue May 15 12:58:59 2001 *************** *** 1,7 **** /* @(#)version.h (c) Copyright 1989, 1990, 1991 (Dan Heller) */ #define MUSHNAME "Mail User's Shell" ! #define RELEASE_DATE "8/31/96" #define RELEASE 7 #define REVISION "2" #define PATCHLEVEL 6 --- 1,7 ---- /* @(#)version.h (c) Copyright 1989, 1990, 1991 (Dan Heller) */ #define MUSHNAME "Mail User's Shell" ! #define RELEASE_DATE "beta(4) 03/19/98" #define RELEASE 7 #define REVISION "2" #define PATCHLEVEL 6 diff -c 'mush-7.2.5unoff2.debian/viewopts.c' 'mush-7.2.5unoff2/viewopts.c' Index: ./viewopts.c *** ./viewopts.c Tue May 15 12:28:52 2001 --- ./viewopts.c Tue May 15 12:45:01 2001 *************** *** 30,36 **** * and to print TRUE/FALSE telling whether the value is on or off regardless * of it's "string" value. */ ! struct viewopts viewopts[] = { { "alwaysignore", NULL, "Always ignore the message headers on the 'ignored' list." }, { "alwaysmime", NULL, --- 30,36 ---- * and to print TRUE/FALSE telling whether the value is on or off regardless * of it's "string" value. */ ! static struct viewopts viewopts[] = { { "alwaysignore", NULL, "Always ignore the message headers on the 'ignored' list." }, { "alwaysmime", NULL, #### End of Patch data #### #### ApplyPatch data follows #### # Data version : 1.0 # Date generated : Fri Jun 22 15:18:52 2001 # Generated by : makepatch 2.00 # Recurse directories : Yes # Excluded files : (\A|/).*\.orig\Z # (\A|/).*\.rej\Z # p 'README' 33664 989945087 0100644 # p 'addrs.c' 33569 989947103 0100644 # p 'command2.c' 14503 989947114 0100644 # p 'commands.c' 23277 989946034 0100644 # p 'config.h' 11112 989951170 0100644 # p 'config.h-dist' 11112 989945087 0100644 # p 'curs_io.c' 19494 989946758 0100644 # p 'curses.c' 29140 989948280 0100644 # p 'dates.c' 16009 989945087 0100644 # c 'diffs' 0 990103571 0100644 # p 'doproc.c' 24178 989945087 0100644 # p 'file.c' 15219 989945087 0100644 # p 'folders.c' 20084 989958275 0100644 # p 'glob.c' 19660 989945087 0100644 # p 'hdrs.c' 23194 989947638 0100644 # p 'hostname.c' 2259 989946114 0100644 # p 'init.c' 13637 989951925 0100644 # p 'loop.c' 35551 989958522 0100644 # p 'macros.c' 9279 989945087 0100644 # p 'mail.c' 59086 990473083 0100644 # p 'main.c' 9419 989951891 0100644 # p 'makefile' 3762 989958084 0100644 # p 'makefile.bsd' 2736 989945099 0100644 # c 'makefile.bsdi' 0 989945099 0100644 # c 'makefile.freebsd' 0 989945099 0100644 # c 'makefile.linux' 0 989945099 0100644 # c 'makefile.solaris' 0 989945099 0100644 # c 'makefile.sun-notool' 0 989945099 0100644 # p 'makefile.sys.v' 2758 989945099 0100644 # p 'makefile.xenix' 2924 989945099 0100644 # p 'misc.c' 23012 989959349 0100644 # p 'msgs.c' 30295 989959349 0100644 # p 'mush.1' 192601 989945100 0100644 # p 'mush.h' 25311 989946565 0100644 # p 'options.c' 10144 989959349 0100644 # p 'panels.c' 22092 989945100 0100644 # p 'pick.c' 17767 989945100 0100644 # p 'pmush.c' 8312 989948923 0100644 # p 'print.c' 5267 989959350 0100644 # p 'sendmime.c' 8361 990117351 0100644 # p 'setopts.c' 23375 989946723 0100644 # p 'signals.c' 13161 989945101 0100644 # p 'sort.c' 8703 989945101 0100644 # p 'strings.c' 9997 989959289 0100644 # p 'strings.h' 1396 989945101 0100644 # p 'util.c' 932 989944276 0100644 # p 'version.h' 226 989945939 0100644 # p 'viewopts.c' 19908 989945101 0100644 #### End of ApplyPatch data #### #### End of Patch kit [created: Fri Jun 22 15:18:52 2001] #### #### Checksum: 8531 238142 1410 ####