--- Makefile.Linux +++ Makefile.Linux 1995/07/17 14:06:45 @@ -0,0 +1,12 @@ +config.h: config.h-dist + ln -s config.h-dist config.h + +Makefile: makefile.sys.v + ln -s makefile.sys.v Makefile + +compile: config.h Makefile + make + +install: + make install + --- config.h-dist +++ config.h-dist 1995/07/17 14:07:31 @@ -1,5 +1,7 @@ /* config.h 1.1 (c) copyright 1986 (Dan Heller) */ +/* #define HOMEMAIL */ + /* Default names and locations for files */ #define MAILRC ".mushrc" #define ALTERNATE_RC ".mailrc" @@ -33,8 +35,8 @@ /* default settings for some variable strings */ #define DEF_PROMPT "Msg %m of %t: " -#define DEF_PAGER "more" /* set to "internal" to use internal pager */ -#define DEF_SHELL "csh" +#define DEF_PAGER "less" /* set to "internal" to use internal pager */ +#define DEF_SHELL "sh" #define DEF_EDITOR "vi" #define DEF_FOLDER "~/Mail" /* default Mail folder */ #define DEF_MBOX "~/mbox" /* default mbox */ @@ -110,7 +112,7 @@ /* * If you are not using MMDF, check these definitions. */ -#define MAIL_DELIVERY "/usr/lib/sendmail -i" /* "-i" works like "-oi" */ +#define MAIL_DELIVERY "/usr/sbin/sendmail -i" /* "-i" works like "-oi" */ #define VERBOSE_ARG "-v" /* undef if none exists */ #define METOO_ARG "-m" /* man sendmail for more info. */ #define MTA_EXIT 0 /* exit status for successful mail delivery */ @@ -146,13 +148,13 @@ #endif /* MMDF */ #ifdef HOMEMAIL -#define MAILFILE "Mailbox" /* or whatever */ +#define MAILFILE ".mail" /* or whatever */ #else /* HOMEMAIL */ #ifndef MAILDIR #if defined(SYSV) && !defined(SVR4) -#define MAILDIR "/usr/mail" +#define MAILDIR "/var/spool/mail" #else /* BSD || SVR4 */ -#define MAILDIR "/usr/spool/mail" +#define MAILDIR "/var/spool/mail" #endif /* SYSV && !SVR4 */ #endif /* MAILDIR */ #endif /* HOMEMAIL */ @@ -186,13 +188,13 @@ * is known not to be RFC822 compiant (xenix, older sys-v) or can be * counted on to pass through user-defined headers without modification. */ -/* #define PICKY_MAILER /**/ +#define PICKY_MAILER /**/ /* If your system supports the vprintf() functions, True for sys-v and * later sun versions (3.0+ ?). Typically not true for BSD systems, but * that will probably change in the future. */ -#if defined(SYSV) || defined(sun) +#if 1 || defined(SYSV) || defined(sun) #define VPRINTF #endif /* SYSV || sun */ @@ -204,7 +206,7 @@ /* If your system has the BSD-style directory routines (opendir/readdir), * define DIRECTORY. This happens automatically in glob.h for BSD. */ -#ifdef SVR4 +#if 1 #define DIRECTORY #endif /* SVR4 */ @@ -212,7 +214,7 @@ * define POSIX_UTIME. You may have to change to * in mush.h. */ -#if defined(SVR4) && !defined(sun) +#if 1 #define POSIX_UTIME #endif /* SVR4 && !sun */ --- curses.c +++ curses.c 1995/07/17 14:10:30 @@ -11,9 +11,6 @@ { char buf[80]; extern char *UP; -#ifndef M_UNIX - extern char ttytype[]; -#endif /* M_UNIX */ if (argv && *++argv && !strcmp(*argv, "-?")) return help(0, "curses", cmd_help); @@ -805,7 +802,7 @@ char *buf; { #ifndef AIX -#ifndef A_CHARTEXT +#if !defined A_CHARTEXT && !defined linux (void) strncpy(buf, stdscr->_y[line], COLS-1); buf[COLS-1] = 0; /* strncpy does not null terminate */ #else --- glob.c +++ glob.c 1995/07/17 14:06:46 @@ -31,6 +31,8 @@ #define TESTGLOB(str1,str2) \ printf("%s %s = %s\n",str1,str2,glob(str1,str2)?"TRUE":"FALSE") +static int sglob(); + main(argc, argv) int argc; char **argv; --- init.c +++ init.c 1995/07/17 14:06:46 @@ -3,6 +3,7 @@ /* init.c -- functions and whatnot that initialize everything */ #include "mush.h" #include +#include #if defined(BSD) || defined(HPUX) || defined(IRIX4) #include @@ -18,8 +19,10 @@ char *home, *realname, *argv[4]; extern char *getlogin(); char buf[MAXPATHLEN]; -#if defined(SYSV) && !defined(HPUX) && !defined(IRIX4) +#if defined(SYSV) && !defined(HPUX) && !defined(IRIX4) && !defined(__linux__) +#ifndef __linux__ extern struct passwd *getpwuid(); /* sys-v forgot this in pwd.h! */ +#endif struct utsname ourhost; #else char ourhost[128]; @@ -27,7 +30,7 @@ register char *p; struct passwd *entry; int cnt; -#if defined(BSD) || defined(HPUX) || defined(IRIX4) +#if defined(BSD) || defined(HPUX) || defined(IRIX4) || defined(__linux__) struct hostent *hp; #endif /* BSD || HPUX || IRIX4 */ @@ -98,7 +101,7 @@ escape = DEF_ESCAPE; prompt = DEF_PROMPT; -#if defined(BSD) || defined(HPUX) || defined(IRIX4) +#if defined(BSD) || defined(HPUX) || defined(IRIX4) || defined(__linux__) (void) gethostname(ourhost, sizeof ourhost); if (!(hp = gethostbyname(ourhost))) { if (ourname = (char **)calloc((unsigned)2, sizeof (char *))) --- lock.c +++ lock.c 1995/07/17 14:06:46 @@ -14,6 +14,12 @@ #include #endif /* SYSV && !USG */ +#ifdef __linux__ +#undef USG +#undef SYSV +#define BSD +#endif + #ifdef DOT_LOCK #ifndef DOLOCK_PATH @@ -253,6 +259,7 @@ /* * Define some BSD names for the SYSV world */ +#ifndef __linux__ #ifdef USG #define LOCK_SH F_RDLCK #define LOCK_EX F_WRLCK @@ -263,6 +270,7 @@ #define LOCK_UN LK_UNLCK #endif /* USG */ #define LOCK_NB 0 /* Always non-blocking in this case */ +#endif /* __linux__ */ #ifdef EWOULDBLOCK #undef EWOULDBLOCK --- mail.c +++ mail.c 1995/07/17 14:06:46 @@ -26,6 +26,8 @@ FILE *ed_fp; char *hfile, *mktemp(); +static int mail_someone(); + /* argc and argv could be null if coming from tool mode compose */ do_mail(n, argv, list) register int n; /* no need for "argc", so use the space for a variable */ @@ -998,8 +1000,10 @@ { print("send, continue editing, discard [s,c,d]? "); c = Getstr(buf, sizeof(buf), 0); - if (c < 0) - putchar('\n'); + if (c < 0) { /* This is probably not the best idea... */ + rm_edfile(-2); + return 0; + } else if (!istool) c = lower(*buf); } --- makefile.sys.v +++ makefile.sys.v 1995/07/17 14:11:37 @@ -23,7 +23,7 @@ # Sun OS systems who wish to compile with sys-v options: # CC= /usr/5bin/cc -# CFLAGS= -O -DSYSV -DCURSES -DUSG -DDIRECTORY +# CFLAGS= -O -DSYSV -DCURSES -DUSG -DDIRECTORY -UREGCMP # LIBS= -L/usr/5lib -lcurses # IRIX 3.2 systems (SGI Iris workstations) should add -DDIRECTORY to CFLAGS @@ -31,9 +31,9 @@ # System V Release 4 (SunOS 5?) should add -DSVR4 -DDIRECTORY to CFLAGS and # should replace -lPW with -lgen -CFLAGS= -O -DSYSV -DUSG -DCURSES -DREGCMP -DSIGRET=void +CFLAGS= -I /usr/include/ncurses -fwritable-strings -O6 -fomit-frame-pointer -m486 -DSYSV -DUSG -DCURSES -DSIGRET=void -DENV_MAIL LDFLAGS= -LIBS= -lcurses -lPW +LIBS= -lncurses #-lPW OTHERLIBS= # Use some variant of this one if you #define MMDF in config.h #OTHERLIBS=/usr/src/mmdf/lib/libmmdf.a @@ -47,10 +47,10 @@ $(OBJS2): $(HDRS1) $(HDRS2) $(HDRS3) loop.o: version.h -BINDIR= /usr/local/bin -LIBDIR= /usr/local/lib +BINDIR= /usr/bin +LIBDIR= /usr/lib MRCDIR= /usr/lib -MANDIR= /usr/local/man/man1 +MANDIR= /usr/man/man1 MANEXT= 1 install: mush --- msgs.c +++ msgs.c 1995/07/17 14:06:46 @@ -516,7 +516,9 @@ 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 */ --- mush.h +++ mush.h 1995/07/17 14:06:46 @@ -4,14 +4,7 @@ #ifdef CURSES -#ifdef USG -# define _USG -# undef USG -#endif /* USG */ -#ifdef SYSV -# define _SYSV -# undef SYSV -#endif /* SYSV */ +#include #include #ifdef timeout @@ -21,24 +14,15 @@ #undef overwrite #endif -#if !defined(USG) && defined(_USG) -# define USG -#endif /* USG */ -#if !defined(SYSV) && defined(_SYSV) -# define SYSV -#endif /* SYSV */ - #else /* CURSES */ #include -#if defined(SYSV) && defined(USG) || defined(AIX) -#include -#endif /* SYSV && USG */ #endif /* CURSES */ #if defined(SVR4) #include #endif /* SVR4 */ +#include #include #include #include @@ -91,7 +75,7 @@ #endif /* SUNTOOL */ #ifdef POSIX_UTIME -#include +#include /* */ #endif /* POSIX_UTIME */ #include #include @@ -165,7 +149,7 @@ #define stty(fd, sgttybuf) ioctl(fd, TIOCSETN, sgttybuf) #endif /* TIOCSETN */ -/* for system-V machines that run termio */ +/* for system-V machines that run termios */ #if defined(SYSV) && defined(USG) || defined(AIX) #ifdef crmode #undef crmode @@ -173,13 +157,13 @@ #endif /* nocrmode */ unsigned char vmin, vtime; -#define sg_erase c_cc[2] +#define sg_erase c_cc[VERASE] #define sg_flags c_lflag -#define sg_kill c_cc[3] +#define sg_kill c_cc[VKILL] #define sg_ospeed c_cflag -#define gtty(fd, SGTTYbuf) ioctl(fd, TCGETA, SGTTYbuf) +#define gtty(fd, SGTTYbuf) ioctl(fd, TCGETS, SGTTYbuf) #undef stty -#define stty(fd, SGTTYbuf) ioctl(fd, TCSETAW, SGTTYbuf) +#define stty(fd, SGTTYbuf) ioctl(fd, TCSETSW, SGTTYbuf) #define echon() (_tty.sg_flags |= (ECHO|ECHOE), stty(0, &_tty)) #define echoff() (_tty.sg_flags &= ~ECHO, stty(0, &_tty)) #define cbrkon() \ @@ -187,14 +171,17 @@ #define cbrkoff() \ (_tty.sg_flags |= ICANON,_tty.c_cc[VMIN] = vmin,_tty.c_iflag |= ICRNL, \ _tty.c_cc[VTIME] = vtime, stty(0, &_tty)) +#undef savetty #define savetty() \ (void) gtty(0, &_tty), vtime = _tty.c_cc[VTIME], vmin = _tty.c_cc[VMIN] +#undef cbreak #define cbreak() cbrkon() +#undef nocbreak #define nocbreak() cbrkoff() /* If curses isn't defined, declare our 'tty' and macros for echo/cbreak */ #ifndef CURSES -typedef struct termio SGTTY; +typedef struct termios SGTTY; #define echom() echon() #define noechom() echoff() #define crmode() cbrkon() @@ -228,7 +215,7 @@ #endif /* ~USG */ /* With all that out of the way, we can now declare our tty type */ -SGTTY _tty; +struct termios _tty; extern char del_line, /* tty delete line character */ --- signals.c +++ signals.c 1995/07/17 14:06:47 @@ -8,6 +8,7 @@ static int was_stopped; +#ifndef __linux__ #ifndef SYSV extern char *sys_siglist[]; #else @@ -35,6 +36,7 @@ /* SIGPWR */ "power-fail restart" }; #endif /* SYSV */ +#endif /* __linux__ */ SIGRET intrpt(sig) --- sort.c +++ sort.c 1995/07/17 14:06:47 @@ -13,11 +13,12 @@ static int depth, order, ignore_case; static jmp_buf sortbuf; +static int msg_cmp(); + sort(argc, argv, list) register int argc; register char *argv[], list[]; { - int msg_cmp(); SIGRET (*oldint)(), (*oldquit)(); int n, offset = -1, range = 0; long curr_msg_off = msg[current_msg].m_offset; .