home *** CD-ROM | disk | FTP | other *** search
Text File | 1989-09-23 | 24.6 KB | 1,028 lines |
- *** bind.c.orig Sat Sep 16 22:32:05 1989
- --- bind.c Sun Sep 17 01:53:53 1989
- ***************
- *** 785,790 ****
- --- 785,795 ----
- *ptr++ = '^';
- }
-
- + if ((c & 255) == 0x7F) {
- + *ptr++ = '^';
- + c = '?';
- + }
- +
- c = c & 255; /* strip the prefixes */
-
- /* and output the final sequence */
- ***************
- *** 910,916 ****
-
- Meta and ^X prefix of lower case letters are converted to upper
- case. Real control characters are automatically converted to
- ! the ^A form.
- */
-
- unsigned int PASCAL NEAR stock(keyname)
- --- 915,921 ----
-
- Meta and ^X prefix of lower case letters are converted to upper
- case. Real control characters are automatically converted to
- ! the ^A form. '^?' is converted to DEL (0x7F).
- */
-
- unsigned int PASCAL NEAR stock(keyname)
- ***************
- *** 963,969 ****
-
- /* a control char? (Always upper case) */
- if (*keyname == '^' && *(keyname+1) != 0) {
- ! c |= CTRL;
- ++keyname;
- uppercase(keyname);
- }
- --- 968,977 ----
-
- /* a control char? (Always upper case) */
- if (*keyname == '^' && *(keyname+1) != 0) {
- ! if (keyname[1] == '?')
- ! c |= 0x7F;
- ! else
- ! c |= CTRL;
- ++keyname;
- uppercase(keyname);
- }
- ***************
- *** 980,986 ****
- uppercase(keyname); /* Then make sure it's upper case */
-
- /* the final sequence... */
- ! c |= *keyname;
- return(c);
- }
-
- --- 988,995 ----
- uppercase(keyname); /* Then make sure it's upper case */
-
- /* the final sequence... */
- ! if ((c & 255) != 0x7f)
- ! c |= *keyname;
- return(c);
- }
-
- *** display.c.orig Sat Sep 16 23:15:39 1989
- --- display.c Sat Sep 16 23:51:59 1989
- ***************
- *** 11,16 ****
- --- 11,19 ----
- #include "etype.h"
- #include "edef.h"
- #include "elang.h"
- + #if VARARGS
- + #include <varargs.h>
- + #endif
-
- typedef struct VIDEO {
- int v_flag; /* Flags */
- ***************
- *** 1091,1096 ****
- --- 1094,1106 ----
- #define ADJUST(ptr, dtype) ptr += sizeof(dtype)
- #endif
-
- + #if VARARGS
- + CDECL NEAR mlwrite(va_alist)
- + va_dcl
- + {
- + va_list ap;
- + char *fmt;
- + #else
- CDECL NEAR mlwrite(fmt, arg)
-
- char *fmt; /* format string for output */
- ***************
- *** 1097,1104 ****
- char *arg; /* pointer to first argument to print */
-
- {
- - register int c; /* current char in format string */
- register char *ap; /* ptr to current data field */
-
- /* if we are not currently echoing on the command line, abort this */
- if (discmd == FALSE)
- --- 1107,1115 ----
- char *arg; /* pointer to first argument to print */
-
- {
- register char *ap; /* ptr to current data field */
- + #endif
- + register int c; /* current char in format string */
-
- /* if we are not currently echoing on the command line, abort this */
- if (discmd == FALSE)
- ***************
- *** 1116,1124 ****
- --- 1127,1141 ----
- TTflush();
- }
-
- + #if VARARGS
- + va_start(ap);
- + fmt = va_arg(ap, char *);
- + #endif
- movecursor(term.t_nrow, 0);
- lastptr = &lastmesg[0]; /* setup to record message */
- + #if !VARARGS
- ap = (char *) &arg;
- + #endif
- while ((c = *fmt++) != 0) {
- if (c != '%') {
- mlout(c);
- ***************
- *** 1127,1159 ****
- --- 1144,1200 ----
- c = *fmt++;
- switch (c) {
- case 'd':
- + #if VARARGS
- + mlputi(va_arg(ap, int), 10);
- + #else
- mlputi(*(int *)ap, 10);
- ADJUST(ap, int);
- + #endif
- break;
-
- case 'o':
- + #if VARARGS
- + mlputi(va_arg(ap, int), 8);
- + #else
- mlputi(*(int *)ap, 8);
- ADJUST(ap, int);
- + #endif
- break;
-
- case 'x':
- + #if VARARGS
- + mlputi(va_arg(ap, int), 16);
- + #else
- mlputi(*(int *)ap, 16);
- ADJUST(ap, int);
- + #endif
- break;
-
- case 'D':
- + #if VARARGS
- + mlputli(va_arg(ap, long), 10);
- + #else
- mlputli(*(long *)ap, 10);
- ADJUST(ap, long);
- + #endif
- break;
-
- case 's':
- + #if VARARGS
- + mlputs(va_arg(ap, char *));
- + #else
- mlputs(*(char **)ap);
- ADJUST(ap, char *);
- + #endif
- break;
-
- case 'f':
- + #if VARARGS
- + mlputf(va_arg(ap, int));
- + #else
- mlputf(*(int *)ap);
- ADJUST(ap, int);
- + #endif
- break;
-
- default:
- *** ebind.h.orig Sat Sep 16 23:37:51 1989
- --- ebind.h Sat Sep 16 23:38:17 1989
- ***************
- *** 78,84 ****
- {CTLX|'A', BINDFNC, setvar},
- {CTLX|'B', BINDFNC, usebuffer},
- {CTLX|'C', BINDFNC, spawncli},
- ! #if BSD
- {CTLX|'D', BINDFNC, bktoshell},
- #endif
- {CTLX|'E', BINDFNC, ctlxe},
- --- 78,84 ----
- {CTLX|'A', BINDFNC, setvar},
- {CTLX|'B', BINDFNC, usebuffer},
- {CTLX|'C', BINDFNC, spawncli},
- ! #if JOBCTRL
- {CTLX|'D', BINDFNC, bktoshell},
- #endif
- {CTLX|'E', BINDFNC, ctlxe},
- *** edef.h.orig Thu Jun 15 14:13:52 1989
- --- edef.h Thu Jun 15 14:10:28 1989
- ***************
- *** 41,47 ****
- NOSHARE int DNEAR sscroll = FALSE; /* smooth scrolling enabled flag*/
- NOSHARE int DNEAR hscroll = TRUE; /* horizontal scrolling flag */
- NOSHARE int DNEAR hjump = 1; /* horizontal jump size */
- ! NOSHARE int DNEAR ssave = TRUE; /* safe save flag */
- NOSHARE struct BUFFER *bstore = NULL; /* buffer to store macro text to*/
- NOSHARE int DNEAR vtrow = 0; /* Row location of SW cursor */
- NOSHARE int DNEAR vtcol = 0; /* Column location of SW cursor */
- --- 41,47 ----
- NOSHARE int DNEAR sscroll = FALSE; /* smooth scrolling enabled flag*/
- NOSHARE int DNEAR hscroll = TRUE; /* horizontal scrolling flag */
- NOSHARE int DNEAR hjump = 1; /* horizontal jump size */
- ! NOSHARE int DNEAR ssave = FALSE; /* safe save flag */
- NOSHARE struct BUFFER *bstore = NULL; /* buffer to store macro text to*/
- NOSHARE int DNEAR vtrow = 0; /* Row location of SW cursor */
- NOSHARE int DNEAR vtcol = 0; /* Column location of SW cursor */
- *** efunc.h.orig Sat Sep 16 23:38:37 1989
- --- efunc.h Sat Sep 16 23:39:07 1989
- ***************
- *** 229,235 ****
- #if PROC
- {"store-procedure", storeproc},
- #endif
- ! #if BSD
- {"suspend-emacs", bktoshell},
- #endif
- {"transpose-characters", twiddle},
- --- 229,235 ----
- #if PROC
- {"store-procedure", storeproc},
- #endif
- ! #if JOBCTRL
- {"suspend-emacs", bktoshell},
- #endif
- {"transpose-characters", twiddle},
- *** input.c.orig Thu Jun 15 14:05:11 1989
- --- input.c Mon Aug 14 13:20:59 1989
- ***************
- *** 46,51 ****
- --- 46,59 ----
- #include "edef.h"
- #include "elang.h"
-
- + #if USG | BSD | V7
- + #include <pwd.h>
- + extern struct passwd *getpwnam();
- + #if USG
- + #define index strchr
- + #endif
- + #endif
- +
- /*
- * Ask a yes or no question in the message line. Return either TRUE, FALSE, or
- * ABORT. The ABORT status is returned if the user bumps out of the question
- ***************
- *** 209,214 ****
- --- 217,227 ----
- register int c; /* current input character */
- int cpos; /* current column on screen output */
- static char buf[NSTRING];/* buffer to hold tentative name */
- + #if USG | BSD | V7
- + char *home;
- + struct passwd *pwd;
- + #endif
- +
- #if COMPLET == 0
- int status;
- #endif
- ***************
- *** 306,313 ****
- TTflush();
- if (buf[cpos - 1] == 0)
- return(buf);
- } else {
- ! if (cpos < maxlen && c > ' ') {
- buf[cpos++] = c;
- mlout(c);
- ++ttcol;
- --- 319,394 ----
- TTflush();
- if (buf[cpos - 1] == 0)
- return(buf);
- + #if USG | BSD | V7
- + } else if (c == '/' && type == CMP_FILENAME && buf[0] == '~') {
- + int i;
- +
- + if (cpos == 1) {
- + if (home = (char *)getenv("HOME")) {
- +
- + mlout('\b'); /* backup over ~ */
- + mlout(' ');
- + mlout('\b');
- + ttcol--;
- + TTflush();
- + strcpy(buf, home);
- + cpos = strlen(buf);
- + buf[cpos++] = '/';
- + for (i = 0; i < cpos; i++) {
- + mlout(buf[i]);
- + ttcol++;
- + }
- + TTflush();
- + } else
- + goto nextc;
- + } else {
- + buf[cpos] = '\0';
- + if (pwd = getpwnam(&buf[1])) {
- + while (cpos != 0) { /* kill */
- + mlout('\b'); /* line */
- + mlout(' ');
- + mlout('\b');
- + --cpos;
- + --ttcol;
- + }
- + TTflush();
- + strcpy(buf, pwd->pw_dir);
- + cpos = strlen(buf);
- + buf[cpos++] = '/';
- + for (i = 0; i < cpos; i++) {
- + mlout(buf[i]);
- + ttcol++;
- + }
- + TTflush();
- + } else
- + goto nextc;
- + }
- + } else if (c == '/' && type == CMP_FILENAME && buf[0] == '$') {
- + int i;
- +
- + buf[cpos] = '\0';
- + if (home = (char *)getenv(&buf[1])) {
- + while (cpos != 0) { /* kill */
- + mlout('\b'); /* line */
- + mlout(' ');
- + mlout('\b');
- + --cpos;
- + --ttcol;
- + }
- + TTflush();
- + strcpy(buf, home);
- + cpos = strlen(buf);
- + buf[cpos++] = '/';
- + for (i = 0; i < cpos; i++) {
- + mlout(buf[i]);
- + ttcol++;
- + }
- + TTflush();
- + } else
- + goto nextc;
- + #endif
- } else {
- ! nextc: if (cpos < maxlen && c > ' ') {
- buf[cpos++] = c;
- mlout(c);
- ++ttcol;
- ***************
- *** 476,542 ****
- {
- register char *fname; /* trial file to complete */
- register int index; /* index into strings to compare */
- ! register char *match; /* last file that matches string */
- ! register int matchflag; /* did this file name match? */
- ! register int comflag; /* was there a completion at all? */
- !
- ! /* start attempting completions, one character at a time */
- ! comflag = FALSE;
- ! while (*cpos < NBUFN) {
- !
- ! /* first, we start at the first file and scan the list */
- ! match = NULL;
- ! name[*cpos] = 0;
- ! fname = getffile(name);
- ! while (fname) {
- !
- ! /* is this a match? */
- ! matchflag = TRUE;
- ! for (index = 0; index < *cpos; index++)
- ! if (name[index] != fname[index]) {
- ! matchflag = FALSE;
- ! break;
- ! }
- !
- ! /* if it is a match */
- ! if (matchflag && index) {
- !
- ! /* if this is the first match, simply record it */
- ! if (match == NULL) {
- ! match = fname;
- ! name[*cpos] = fname[*cpos];
- ! } else {
- ! /* if there's a difference, stop here */
- ! if (name[*cpos] != fname[*cpos])
- ! return;
- ! }
- ! }
- !
- ! /* on to the next file */
- ! fname = getnfile();
- ! }
- !
- ! /* with no match, we are done */
- ! if (match == NULL) {
- ! /* beep if we never matched */
- ! if (comflag == FALSE)
- ! TTbeep();
- ! return;
- ! }
-
- ! /* if we have completed all the way... go back */
- ! if (name[*cpos] == 0) {
- ! (*cpos)++;
- ! return;
- ! }
-
- ! /* remember we matched, and complete one character */
- ! comflag = TRUE;
- ! TTputc(name[(*cpos)++]);
- ! TTflush();
- ! }
-
- - /* don't allow a completion past the end of the max file name length */
- return;
- }
- #endif
- --- 557,627 ----
- {
- register char *fname; /* trial file to complete */
- register int index; /* index into strings to compare */
- ! register int matches; /* number of matches for name */
- ! char longestmatch[NSTRING]; /* temp buffer for longest match */
- ! int longestlen; /* length of longest match (always > *cpos) */
-
- ! /* everything (or nothing) matches an empty string */
- ! if (*cpos == 0)
- ! return;
- !
- ! /* first, we start at the first file and scan the list */
- ! matches = 0;
- ! name[*cpos] = 0;
- ! fname = getffile(name);
- ! while (fname) {
- !
- ! /* is this a match? */
- ! if (strncmp(name,fname,*cpos) == 0) {
- !
- ! /* count the number of matches */
- ! matches++;
- !
- ! /* if this is the first match, simply record it */
- ! if (matches == 1) {
- ! strcpy(longestmatch,fname);
- ! longestlen = strlen(longestmatch);
- ! } else {
- !
- ! /* if there's a difference, stop here */
- ! if (longestmatch[*cpos] != fname[*cpos])
- ! return;
- !
- ! for (index = (*cpos) + 1; index < longestlen; index++)
- ! if (longestmatch[index] != fname[index]) {
- ! longestlen = index;
- ! longestmatch[longestlen] = 0;
- ! }
- ! }
- ! }
- !
- ! /* on to the next file */
- ! fname = getnfile();
- ! }
- !
- ! /* beep if we never matched */
- ! if (matches == 0) {
- ! TTbeep();
- ! return;
- ! }
- !
- ! /* the longestmatch array contains the longest match so copy and print it */
- ! for ( ; (*cpos < (NSTRING-1)) && (*cpos < longestlen); (*cpos)++) {
- ! name[*cpos] = longestmatch[*cpos];
- ! TTputc(name[*cpos]);
- ! }
- !
- ! name[*cpos] = 0;
- !
- ! /* if only one file matched then increment cpos to signal complete() */
- ! /* that this was a complete match. If a directory was matched then */
- ! /* last character will be the DIRSEPCHAR. In this case we do NOT *
- ! /* want to signal a complete match. */
- ! if ((matches == 1) && (name[(*cpos)-1] != DIRSEPCHAR))
- ! (*cpos)++;
-
- ! TTflush();
-
- return;
- }
- #endif
- *** tcap.c.orig Sat Sep 16 22:25:59 1989
- --- tcap.c Sat Sep 16 22:26:18 1989
- ***************
- *** 413,419 ****
- register int c;
- register int index; /* index into termcap binding table */
- char *sp;
- ! #if BSD | V7 | HPUX
- int fdset;
- struct timeval timeout;
- #endif
- --- 413,419 ----
- register int c;
- register int index; /* index into termcap binding table */
- char *sp;
- ! #if BSD | V7 | HPUX | SUN
- int fdset;
- struct timeval timeout;
- #endif
- ***************
- *** 427,433 ****
-
- /* process a possible escape sequence */
- /* set up to check the keyboard for input */
- ! #if BSD | V7 | HPUX
- fdset = 1;
- timeout.tv_sec = 0;
- timeout.tv_usec = 35000L;
- --- 427,433 ----
-
- /* process a possible escape sequence */
- /* set up to check the keyboard for input */
- ! #if BSD | V7 | HPUX | SUN
- fdset = 1;
- timeout.tv_sec = 0;
- timeout.tv_usec = 35000L;
- ***************
- *** 438,444 ****
- return(CTRL | '[');
- #endif
-
- ! #if XENIX | SUNOS
- if ((kbdmode != PLAY) && (rdchk(0) <= 0)) {
- nap(35000L);
- if (rdchk(0) <= 0)
- --- 438,444 ----
- return(CTRL | '[');
- #endif
-
- ! #if XENIX
- if ((kbdmode != PLAY) && (rdchk(0) <= 0)) {
- nap(35000L);
- if (rdchk(0) <= 0)
- *** unix.c.orig Thu May 11 13:09:36 1989
- --- unix.c Sun Sep 17 00:06:10 1989
- ***************
- *** 15,21 ****
- --- 15,28 ----
- #include <signal.h>
- #include <termio.h>
- #include <fcntl.h>
- + #include <sys/types.h>
- + #include <sys/stat.h>
- + #if DIRENT
- + #include <dirent.h>
- + #define direct dirent
- + #else
- #include <ndir.h>
- + #endif
- int kbdflgs; /* saved keyboard fd flags */
- int kbdpoll; /* in O_NDELAY mode */
- int kbdqp; /* there is a char in kbdq */
- ***************
- *** 42,55 ****
-
- #if BSD
- #include <sys/ioctl.h> /* to get at the typeahead */
- - extern int rtfrmshell(); /* return from suspended shell */
- #define TBUFSIZ 128
- char tobuf[TBUFSIZ]; /* terminal output buffer */
- #endif
- #endif
-
- #if V7 | USG | HPUX | SUN | XENIX | BSD
- - #include <signal.h>
- extern int vttidy();
- #endif
-
- --- 49,64 ----
-
- #if BSD
- #include <sys/ioctl.h> /* to get at the typeahead */
- #define TBUFSIZ 128
- char tobuf[TBUFSIZ]; /* terminal output buffer */
- #endif
- #endif
-
- + #if JOBCTRL
- + extern int rtfrmshell(); /* return from suspended shell */
- + #endif
- +
- #if V7 | USG | HPUX | SUN | XENIX | BSD
- extern int vttidy();
- #endif
-
- ***************
- *** 75,80 ****
- --- 84,94 ----
- kbdpoll = FALSE;
- #endif
-
- + #if JOBCTRL
- + signal(SIGTSTP,SIG_DFL); /* set signals so that we can */
- + signal(SIGCONT,rtfrmshell); /* suspend & restart emacs */
- + #endif
- +
- #if V7 | BSD
- gtty(0, &ostate); /* save old state */
- gtty(0, &nstate); /* get base of new state */
- ***************
- *** 87,96 ****
- /* provide a smaller terminal output buffer so that
- the type ahead detection works better (more often) */
- setbuffer(stdout, &tobuf[0], TBUFSIZ);
- - signal(SIGTSTP,SIG_DFL); /* set signals so that we can */
- - signal(SIGCONT,rtfrmshell); /* suspend & restart emacs */
- #endif
- #endif
- /* on all screens we are not sure of the initial position
- of the cursor */
- ttrow = 999;
- --- 101,112 ----
- /* provide a smaller terminal output buffer so that
- the type ahead detection works better (more often) */
- setbuffer(stdout, &tobuf[0], TBUFSIZ);
- #endif
- #endif
- + /* if we spawn a subshell we don't want to die if the user hits
- + the interrupt or quit keys */
- + signal(SIGINT, SIG_IGN);
- + signal(SIGQUIT, SIG_IGN);
- /* on all screens we are not sure of the initial position
- of the cursor */
- ttrow = 999;
- ***************
- *** 217,223 ****
- if (fcntl(0, F_SETFL, kbdflgs | O_NDELAY) < 0 && kbdpoll)
- return(FALSE);
- kbdpoll = TRUE;
- ! kbdqp = (1 == read(0, kbdq, 1));
- }
- return(kbdqp);
- #endif
- --- 233,239 ----
- if (fcntl(0, F_SETFL, kbdflgs | O_NDELAY) < 0 && kbdpoll)
- return(FALSE);
- kbdpoll = TRUE;
- ! kbdqp = (1 == read(0, &kbdq, 1));
- }
- return(kbdqp);
- #endif
- ***************
- *** 259,265 ****
- return(TRUE);
- }
-
- ! #if BSD
-
- bktoshell() /* suspend MicroEMACS and wait to wake up */
- {
- --- 275,281 ----
- return(TRUE);
- }
-
- ! #if JOBCTRL
-
- bktoshell() /* suspend MicroEMACS and wait to wake up */
- {
- ***************
- *** 299,311 ****
- TTclose(); /* stty to old modes */
- system(line);
- TTopen();
- ! TTflush();
- /* if we are interactive, pause here */
- if (clexec == FALSE) {
- mlputs(TEXT6);
- /* "\r\n\n[End]" */
- tgetc();
- }
- sgarbf = TRUE;
- return(TRUE);
- }
- --- 315,329 ----
- TTclose(); /* stty to old modes */
- system(line);
- TTopen();
- ! movecursor(term.t_nrow, 0); /* Seek to last line. */
- /* if we are interactive, pause here */
- if (clexec == FALSE) {
- mlputs(TEXT6);
- /* "\r\n\n[End]" */
- + TTflush();
- tgetc();
- }
- + TTflush();
- sgarbf = TRUE;
- return(TRUE);
- }
- ***************
- *** 317,323 ****
- */
-
- execprg(f, n)
- -
- {
- register int s;
- char line[NLINE];
- --- 335,340 ----
- ***************
- *** 326,348 ****
- if (restflag)
- return(resterr());
-
- ! if ((s=mlreply("!", line, NLINE)) != TRUE)
- return(s);
- TTputc('\n'); /* Already have '\r' */
- TTflush();
- TTclose(); /* stty to old modes */
- ! system(line);
- TTopen();
- ! mlputs(TEXT188); /* Pause. */
- ! /* "[End]" */
- ! TTflush();
- ! while ((s = tgetc()) != '\r' && s != ' ')
- ! ;
- sgarbf = TRUE;
- return(TRUE);
- }
-
- /*
- * Pipe a one line command into a window
- * Bound to ^X @
- */
- --- 343,502 ----
- if (restflag)
- return(resterr());
-
- ! if ((s=mlreply("$", line, NLINE)) != TRUE)
- return(s);
- TTputc('\n'); /* Already have '\r' */
- TTflush();
- TTclose(); /* stty to old modes */
- ! execpr(line);
- TTopen();
- ! movecursor(term.t_nrow, 0); /* Seek to last line. */
- ! /* if we are interactive, pause here */
- ! if (clexec == FALSE) {
- ! mlputs(TEXT188);
- ! /* "[End]" */
- ! TTflush();
- ! tgetc();
- ! }
- ! TTflush();
- sgarbf = TRUE;
- return(TRUE);
- }
-
- /*
- + * Run a program with arguments without using a shell.
- + * Line is a string containing a program name and arguments, separated
- + * by whitespace. Shell metacharacters have no special meaning.
- + */
- +
- + execpr(line)
- + char *line;
- + {
- + char **stov();
- + char **argv;
- + char *cp; /* A copy of the line in case it's $SHELL. */
- + int pid;
- +
- + if (line == 0 || *line == 0)
- + return;
- +
- + cp = malloc(strlen(line) + 1);
- + strcpy(cp, line);
- + argv = stov(cp);
- +
- + pid = fork();
- + switch (pid) {
- + case -1:
- + break;
- + case 0: /* Child. */
- + signal(SIGINT, SIG_DFL);
- + signal(SIGQUIT, SIG_DFL);
- + execvp(argv[0], argv);
- + /* Might want to print "argv[0]: Command not found.\n". */
- + exit(0);
- + default: /* Parent. */
- + while (wait((int *) 0) != pid)
- + /* Do nothing. */ ;
- + break;
- + }
- + free(argv);
- + free(cp);
- + }
- +
- + /* Number of arguments between realloc's. */
- + #define ALLOC_BLOCK 10
- +
- + /*
- + * Make an argv-like vector (string array) from a string (such as an
- + * environment variable). The last element of the vector is null.
- + * Scatters nulls throughout s.
- + */
- +
- + char **
- + stov(s)
- + char *s; /* The string to vectorize. */
- + {
- + char *malloc(), *realloc(), *strtok();
- + int argc;
- + char **argv;
- +
- + argc = 0;
- + argv = (char **) malloc((unsigned) (sizeof(char *) * ALLOC_BLOCK));
- +
- + for (s = strtok(s, " \t\n\r"); s;
- + s = strtok((char *) NULL, " \t\n\r")) {
- + if (argc > 0 && argc % ALLOC_BLOCK == 0)
- + argv = (char **) realloc((char *) argv, (unsigned)
- + (sizeof(char *) * (argc + ALLOC_BLOCK)));
- + argv[argc++] = s;
- + }
- + argv = (char **) realloc((char *) argv,
- + (unsigned) (sizeof(char *) * (argc + 1)));
- + argv[argc] = NULL;
- + return argv;
- + }
- +
- + #if V7 | BSD
- + /* Return the next token in string, delimited by one or more members of
- + the set separators. If string is NULL, use the same string as in the
- + last call. */
- +
- + char *
- + strtok(string, separators)
- + char *string;
- + char *separators;
- + {
- + static char *pos = NULL; /* Current location in the string. */
- + register int token_length;
- +
- + if (string)
- + pos = string;
- + pos += strspn(pos, separators); /* Skip initial separators. */
- + token_length = strcspn(pos, separators); /* Find token length. */
- + if (token_length == 0)
- + return NULL; /* No more tokens; pos is on a 0. */
- + separators = pos; /* Re-use separators to save start of token. */
- + pos += token_length; /* Move onto the 0. */
- + if (*pos) /* If not the last token, */
- + *pos++ = 0; /* null terminate the token. */
- + return separators;
- + }
- +
- + /* Return the length of the span of characters at the start of string
- + that are members of class. */
- +
- + strspn(string, class)
- + char *string;
- + char *class;
- + {
- + char *index();
- + register int count;
- +
- + for (count = 0; string[count]; ++count)
- + if (!index(class, string[count]))
- + break;
- + return count;
- + }
- +
- + /* Return the length of the span of characters at the start of string
- + that are non-members of class. */
- +
- + strcspn(string, class)
- + char *string;
- + char *class;
- + {
- + char *index();
- + register int count;
- +
- + for (count = 0; string[count]; ++count)
- + if (index(class, string[count]))
- + break;
- + return count;
- + }
- +
- + #endif
- +
- + /*
- * Pipe a one line command into a window
- * Bound to ^X @
- */
- ***************
- *** 529,534 ****
- --- 683,689 ----
- register int index; /* index into various strings */
- register int point; /* index into other strings */
- register int extflag; /* does the file have an extention? */
- + int currentdir = FALSE;
-
- /* first parse the file path off the file spec */
- strcpy(path, fspec);
- ***************
- *** 537,542 ****
- --- 692,704 ----
- path[index] != '\\' && path[index] != ':'))
- --index;
- path[index+1] = 0;
- + #if HPUX
- + if (index < 0) {
- + strcpy(path,"./");
- + index = 1;
- + currentdir = TRUE;
- + }
- + #endif
-
- /* check for an extension */
- point = strlen(fspec) - 1;
- ***************
- *** 554,563 ****
- closedir(dirptr);
- dirptr = NULL;
- }
- ! dirptr = opendir(path);
- if (dirptr == NULL)
- return(NULL);
-
- strcpy(rbuf, path);
- nameptr = &rbuf[strlen(rbuf)];
-
- --- 716,733 ----
- closedir(dirptr);
- dirptr = NULL;
- }
- ! if (path[0])
- ! dirptr = opendir(path);
- ! else
- ! dirptr = opendir(".");
- if (dirptr == NULL)
- return(NULL);
-
- + #if HPUX
- + if (currentdir == TRUE)
- + path[0] = '\0';
- + #endif
- +
- strcpy(rbuf, path);
- nameptr = &rbuf[strlen(rbuf)];
-
- ***************
- *** 580,591 ****
- /* check to make sure we skip directory entries */
- strcpy(nameptr, dp->d_name);
- stat(rbuf, &fstat);
- ! if ((fstat.st_mode & S_IFMT) != S_IFREG)
- goto nxtdir;
-
- /* return the next file name! */
- return(rbuf);
- }
- #else
- char *PASCAL NEAR getffile(fspec)
-
- --- 750,766 ----
- /* check to make sure we skip directory entries */
- strcpy(nameptr, dp->d_name);
- stat(rbuf, &fstat);
- ! if (((fstat.st_mode & S_IFMT) != S_IFREG) &&
- ! ((fstat.st_mode & S_IFMT) != S_IFDIR))
- goto nxtdir;
-
- + if ((fstat.st_mode & S_IFMT) == S_IFDIR)
- + strcat(rbuf,"/");
- +
- /* return the next file name! */
- return(rbuf);
- }
- +
- #else
- char *PASCAL NEAR getffile(fspec)
-
- *** estruct.h.orig Tue Sep 19 11:44:15 1989
- --- estruct.h Tue Sep 19 11:45:37 1989
- ***************
- *** 52,57 ****
- --- 52,62 ----
- #define WMCS 0 /* Wicat's MCS */
- #define AOSVS 0 /* Data General AOS/VS */
-
- + /* Additional settings for Unix systems */
- + #define DIRENT 1 /* has POSIX <dirent.h> library */
- + #define JOBCTRL 0 /* has BSD job control */
- + #define VARARGS 1 /* has Unix <varargs.h> */
- +
- /* Compiler definitions */
- /* [Set one of these!!] */
- #define UNIX 0 /* a random UNIX compiler */
-