home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-09-21 | 56.5 KB | 2,457 lines |
- diff -ur ./alias.c /local/src/elvis/17/src/alias.c
- --- ./alias.c Thu Feb 4 12:48:38 1993
- +++ /local/src/elvis/17/src/alias.c Wed Mar 24 15:45:26 1993
- @@ -27,6 +27,15 @@
- #define ELVIS "elvis"
- #endif
-
- +#if __STDC__
- +#include <string.h>
- +#include <stdlib.h>
- +#endif
- +
- +#if MINT
- +extern char *getenv();
- +#endif
- +
- extern char **environ;
- extern int errno;
-
- @@ -40,6 +49,9 @@
- #if OSK
- extern int chainc();
- #endif
- +#if TOS || MINT
- + extern char myname[];
- +#endif
-
- /* allocate enough space for a copy of the argument list, plus a
- * terminating NULL, plus maybe an added flag.
- @@ -55,9 +67,15 @@
- exit(2);
- }
-
- +#if TOS || MINT
- + /* some stupid TOS shells haven't heared about argv[0] -nox */
- + if (!**argv)
- + *argv = myname; /* (see myname.c) */
- +#endif
- +
- /* find the last letter in the invocation name of this program */
- i = strlen(argv[0]);
- -#if MSDOS || TOS
- +#if MSDOS || TOS || MINT
- /* we almost certainly must bypass ".EXE" or ".TTP" from argv[0] */
- if (i > 4 && argv[0][i - 4] == '.')
- i -= 4;
- @@ -65,6 +83,14 @@
- letter = argv[0][i - 1];
-
- /* copy argv to argblk, possibly inserting a flag such as "-R" */
- +#if MINT
- + /* see if elvis is the $EDITOR and has a path, so that execvp()
- + doesn't have to search $PATH (yes, GEMDOS is slow...) -nox */
- + if (strpbrk(ELVIS, "/\\") || !(argblk[0]=getenv("EDITOR")) ||
- + !strpbrk(argblk[0], "/\\") ||
- + (strcmp(argblk[0]+strlen(argblk[0])-sizeof(ELVIS)+1, ELVIS) &&
- + strcmp(argblk[0]+strlen(argblk[0])-sizeof(ELVIS)-3, ELVIS ".ttp")))
- +#endif
- argblk[0] = ELVIS;
- i = j = 1;
- switch (letter)
- @@ -98,4 +124,5 @@
- (void)execvp(argblk[0], argblk);
- perror(ELVIS);
- #endif
- + exit(2);
- }
- diff -ur ./atari.c /local/src/elvis/17/src/atari.c
- --- ./atari.c Thu Feb 4 12:48:42 1993
- +++ /local/src/elvis/17/src/atari.c Sun Apr 25 15:16:52 1993
- @@ -16,9 +16,20 @@
- #include "config.h"
- #include "vi.h"
-
- -#if TOS
- +#if TOS || MINT
- #include <osbind.h>
-
- +#if MINT
- +#include <ioctl.h>
- +
- +#ifndef TCURSBLINK
- +#define TCURSBLINK (('c'<< 8) | 2)
- +#define TCURSSTEADY (('c'<< 8) | 3)
- +#endif
- +#endif
- +
- +# if !MINT /* MiNT's library is a little more complete :-) */
- +
- /* vi uses mode==0 only ... */
- int access(file, mode)
- char *file;
- @@ -36,7 +47,9 @@
- return template;
- }
-
- -#ifndef __GNUC__
- +# endif
- +
- +# ifndef __GNUC__
- char *getcwd(buf, size)
- char *buf;
- {
- @@ -47,10 +60,11 @@
- Dgetpath(buf + 2, 0);
- return buf;
- }
- -#endif
- +# endif
-
- /* read -- text mode, compress \r\n to \n
- * warning: might fail when maxlen==1 and at eol
- + * ...no longer :-) -nox
- */
-
- int tread(fd, buf, maxlen)
- @@ -61,8 +75,16 @@
- int i, j, nread=read(fd, buf, (unsigned)maxlen);
-
- if (nread && buf[nread-1]=='\r')
- - { nread--;
- - lseek(fd, -1l, 1);
- + {
- + if (--nread)
- + lseek(fd, -1l, 1);
- + else {
- + if (read(fd, buf, 1) && *buf != '\n') {
- + *buf = '\r';
- + lseek(fd, -1l, 1);
- + }
- + return 1;
- + }
- }
- for (i=j=0; j<nread; i++,j++)
- { if (buf[j]=='\r' && buf[j+1]=='\n')
- @@ -77,6 +99,24 @@
- char *buf;
- int maxlen;
- {
- +# if 1
- + int i, j;
- + /* uh, we can have that easier... -nox */
- + static char writbuf[BLKSIZE*2];
- +
- + for (i=j=0; j<maxlen; )
- + {
- + if ((writbuf[i++]=buf[j++])=='\n')
- + { writbuf[i-1]='\r';
- + writbuf[i++]='\n';
- + }
- + }
- + /* ...and make the result a little bit more reasonable too :-) */
- + if (!i || !(maxlen = write(fd, writbuf, (unsigned)i)))
- + return 0;
- + return j - i + maxlen;
- +}
- +# else
- int i, j, nwritten=0, hadnl=0;
- char writbuf[BLKSIZE];
-
- @@ -104,6 +144,7 @@
- write(fd, writbuf, (unsigned)i);
- return j;
- }
- +# endif
-
-
- /* The "timer" variable is used as a shadow of the system's timer. Since the
- @@ -111,12 +152,14 @@
- * do a Supexec(gettime) to copy the system's timer in to the User-mode "timer"
- * variable.
- */
- -static int timer;
- -static gettime()
- +static long timer;
- +static void gettime()
- {
- timer = *(long *)(0x4ba);
- }
- +#endif /* TOS || MINT */
-
- +#if TOS
- /* This function implements a read-with-timeout from the keyboard. */
- /*ARGSUSED*/
- int ttyread(buf, len, time)
- @@ -129,11 +172,11 @@
- long endtime;
-
- /* compute the ending time, in increments of 1/200th seconds */
- - Supexec(gettime);
- + (void) Supexec(gettime);
- endtime = time * 20 + timer;
-
- /* wait until time runs out, or we get a keystroke */
- - while (!pos && (!time || timer < endtime))
- + while (!pos && (!time || (timer-endtime) < 0))
- {
- if (Bconstat(2))
- {
- @@ -145,7 +188,7 @@
- buf[pos++] = l >> 16;
- }
- }
- - Supexec(gettime);
- + (void) Supexec(gettime);
- }
- return pos;
- }
- @@ -158,4 +201,203 @@
- while (len--)
- Bconout(2, *buf++);
- }
- +#endif /* TOS */
- +
- +#if MINT
- +extern int __mint;
- +
- +# include <signal.h>
- +# include <setjmp.h>
- +
- +static jmp_buf env;
- +
- +/* ctputs(): same as tputs(), but recognizes #blink / #noblink to
- + set the cursormode (have to do it this way because those are not
- + available thru the ST's `VT52' emulator...) */
- +
- +void ctputs(cp, affcnt, outfn)
- + char *cp;
- + int affcnt;
- + int (*outfn)();
- +{
- + if (!strcmp(cp, "#blink")) {
- + if (__mint >= 96)
- + (void) ioctl (2, TCURSBLINK, (void *) NULL);
- + else
- + (void) Cursconf(2, 0);
- + return;
- + }
- + if (!strcmp(cp, "#noblink")) {
- + if (__mint >= 96)
- + (void) ioctl (2, TCURSSTEADY, (void *) NULL);
- + else
- + (void) Cursconf(3, 0);
- + return;
- + }
- + tputs(cp, affcnt, outfn);
- +}
- +
- +/* this turns those shifted cursor- / insert / home keys into
- + something useful (without this, they would return digits...) */
- +
- +static long fixkey(l)
- + long l;
- +{
- + if (l < 0 || !(char) l)
- + return l;
- + switch ((unsigned char) (l >> 16)) {
- + case 72: /* shift- ^ -> PgUp */
- + return 73l << 16;
- + case 80: /* shift- v -> PgDn */
- + return 81l << 16;
- + case 71: /* shift-Home -> End */
- + return 79l << 16;
- + case 75: /* shift- <- -> ctrl- <- */
- + return 115l << 16;
- + case 77: /* shift- -> -> ctrl- -> */
- + return 116l << 16;
- + case 82: /* shift-Insert -> Printscreen */
- + return 55l << 16;
- + }
- + return l;
- +}
- +
- +/*ARGSUSED*/
- +static void dummy(signo)
- + int signo;
- +{
- + longjmp(env, 1);
- +}
- +
- +/* This function implements a read-with-timeout from the keyboard. */
- +/*ARGSUSED*/
- +int ttyread(buf, len, time)
- + char *buf; /* where to store the gotten characters */
- + int len; /* maximum number of characters to get -- ignored on terminals */
- + int time; /* maximum time to allow for reading */
- +{
- + int pos=0;
- + long l;
- + long endtime;
- + static tty; /* 'y' if reading from tty, or 'n' if not a tty */
- + extern int got_winch; /* flag from our getsize() SIGWINCH handler */
- +
- + /* do we know whether this is a tty or not? */
- + if (!tty)
- + tty = (isatty(0) ? 'y' : 'n');
- +
- + if (tty != 'y')
- + return read(0, buf, (unsigned) len);
- +
- + if (!__mint) {
- + /* no MiNT -> eat cycles :-) */
- +
- + /* compute the ending time, in increments of 1/200th seconds */
- + (void) Supexec(gettime);
- + endtime = time * 20 + timer;
- +
- + /* wait until time runs out, or we get a keystroke */
- + while (!pos && (!time || (timer-endtime) < 0))
- + {
- + if (*o_stbios ? Bconstat(2) : Cconis())
- + {
- + l = fixkey(*o_stbios ? Bconin(2) : Crawcin());
- + if (l < 0)
- + return l;
- + buf[pos] = l;
- + if (buf[pos++] == '\0')
- + {
- + buf[pos-1] = '#';
- + buf[pos++] = l >> 16;
- + }
- + }
- + (void) Supexec(gettime);
- + }
- + return pos;
- + }
- + /* MiNT is there -> do it with alarm()
- + [yes MiNT also has select(), but as of MiNT version 0.94
- + that won't yet work over e.g. a serial line...] */
- +
- + /* arrange for timeout */
- + signal(SIGALRM, dummy);
- + alarm(time);
- +
- + if (setjmp(env))
- + return 0;
- +
- + /* if termcap doesn't use scancodes simply do an ordinary read()
- + then MiNT can convert them for us (XKEY)...
- + */
- + if (!has_KL || *has_KL != '#' || has_KL[1] != 'K' || has_KL[2]) {
- + pos = read(0, buf, (unsigned)len);
- + if (got_winch) {
- + got_winch = 0;
- + if (*o_lines != LINES || *o_columns != COLS) {
- +#ifndef CRUNCH
- + *o_nearscroll =
- #endif
- + *o_lines = LINES;
- + *o_columns = COLS;
- +#ifndef CRUNCH
- + if (!wset)
- + {
- + *o_window = LINES - 1;
- + }
- +#endif
- + if (mode != MODE_EX && mode != MODE_COLON)
- + /* pretend the user hit ^L */
- + buf[pos++] = ctrl('L');
- + }
- + }
- + }
- +
- + /* termcap does use scancodes, do the dos thing... */
- + else do {
- + l = fixkey(*o_stbios ? Bconin(2) : Crawcin());
- +
- + if (got_winch) {
- + got_winch = 0;
- + if (*o_lines != LINES || *o_columns != COLS) {
- +#ifndef CRUNCH
- + *o_nearscroll =
- +#endif
- + *o_lines = LINES;
- + *o_columns = COLS;
- +#ifndef CRUNCH
- + if (!wset)
- + {
- + *o_window = LINES - 1;
- + }
- +#endif
- + if (mode != MODE_EX && mode != MODE_COLON)
- + /* pretend the user hit ^L */
- + buf[pos++] = ctrl('L');
- + }
- + }
- + if (l > 0 && (buf[pos++]=l) == '\0')
- + {
- + buf[pos-1] = '#';
- + buf[pos++] = l>>16;
- + }
- + } while (!pos);
- +
- + /* cancel the alarm */
- + alarm(0);
- +
- + /* return the number of bytes read */
- + return pos;
- +}
- +
- +void ttywrite(buf, len)
- + char *buf;
- + int len;
- +{
- + if (!*o_stbios) {
- + write(1, buf, (unsigned) len);
- + return;
- + }
- + while (len--)
- + (void) Bconout(2, *buf++);
- +}
- +#endif /* MINT */
- diff -ur ./cmd1.c /local/src/elvis/17/src/cmd1.c
- --- ./cmd1.c Thu Feb 4 12:48:42 1993
- +++ /local/src/elvis/17/src/cmd1.c Thu Mar 25 23:32:20 1993
- @@ -30,6 +30,10 @@
- static int curr_tag = -1;
- #endif /* !NO_TAGSTACK */
-
- +#if MINT
- +extern int __mint;
- +#endif
- +
- #ifdef DEBUG
- /* print the selected lines with info on the blocks */
- /*ARGSUSED*/
- @@ -251,7 +255,11 @@
- scan[i++] = '\n';
-
- /* print the line */
- +#if MINT
- + if ((*o_crlf ? twrite : write)(fd, scan, i) < i)
- +#else
- if (twrite(fd, scan, i) < i)
- +#endif
- {
- msg("Write failed");
- break;
- @@ -1537,6 +1545,9 @@
- char *extra;
- {
- BLK buf;
- +#if MINT
- + int fd, old2, f2 = *REDIRECT == '>' ? 1 : 2;
- +#endif
-
- /* if the file hasn't been saved, then complain unless ! */
- if (tstflag(file, MODIFIED) && !bang)
- @@ -1546,8 +1557,16 @@
- }
-
- /* build the command */
- +#if MINT
- + /* some stupid TOS shells won't grok `2>' :-( -nox */
- + sprintf(buf.c, "%s %s ", (cmd == CMD_CC ? o_cc : o_make), extra);
- + qaddstr(buf.c);
- + qaddstr(REDIRECT);
- + qaddstr(ERRLIST);
- +#else
- sprintf(buf.c, "%s %s %s%s", (cmd == CMD_CC ? o_cc : o_make), extra, REDIRECT, ERRLIST);
- qaddstr(buf.c);
- +#endif
- addch('\n');
-
- /* close the old errlist file, if any */
- @@ -1566,10 +1585,10 @@
- return;
- }
- suspend_curses();
- - old2 = dup(2);
- - dup2(fd, 2);
- + old2 = dup(f2);
- + dup2(fd, f2);
- system(buf.c);
- - dup2(old2, 2);
- + dup2(old2, f2);
- close(old2);
- close(fd);
- #else
- @@ -1877,6 +1896,10 @@
- return;
- }
- #endif
- +#if MINT
- + if (!__mint)
- + return;
- +#endif
-
- move(LINES - 1, 0);
- if (tstflag(file, MODIFIED))
- @@ -1889,7 +1912,12 @@
- refresh();
- suspend_curses();
- func = signal(SIGTSTP, SIG_DFL);
- +#if MINT
- + /* earlier versions of MiNT had a problem with kill(0, ...) -nox */
- + killpg(getpgrp(), SIGTSTP);
- +#else
- kill (0, SIGTSTP);
- +#endif
-
- /* the process stops and resumes here */
-
- diff -ur ./cmd2.c /local/src/elvis/17/src/cmd2.c
- --- ./cmd2.c Thu Feb 4 12:48:44 1993
- +++ /local/src/elvis/17/src/cmd2.c Wed Mar 24 15:45:40 1993
- @@ -649,7 +649,11 @@
- add(tomark, "\n");
-
- /* for each chunk of text... */
- +#if MINT
- + while ((rc = (*o_crlf ? tread : read)(fd, tmpblk.c, BLKSIZE - 1)) > 0)
- +#else
- while ((rc = tread(fd, tmpblk.c, BLKSIZE - 1)) > 0)
- +#endif
- {
- /* count newlines, convert NULs, etc. ... */
- for (lines = 0, scan = tmpblk.c; rc > 0; rc--, scan++)
- diff -ur ./config.h /local/src/elvis/17/src/config.h
- --- ./config.h Thu Feb 4 12:48:44 1993
- +++ /local/src/elvis/17/src/config.h Wed Mar 24 15:45:44 1993
- @@ -85,6 +85,12 @@
- # endif
- #endif
-
- +#if MINT
- +# ifdef TOS
- +# undef TOS
- +# endif
- +#endif
- +
- /* OS9/68000 */
- #ifdef OSK
- # define COMPILED_BY "Microware C V2.3 Edition 40"
- @@ -140,6 +146,10 @@
- # define TOS 0 /* Atari ST */
- #endif
-
- +#ifndef MINT
- +# define MINT 0 /* Atari ST, gcc, MiNT */
- +#endif
- +
- #ifndef AMIGA
- # define AMIGA 0 /* Commodore Amiga */
- #endif
- @@ -161,7 +171,7 @@
- #endif
-
- /* Minix has no predefines */
- -#if !BSD && !UNIXV && !UNIX7 && !MSDOS && !TOS && !AMIGA && !OSK && !COHERENT && !VMS
- +#if !BSD && !UNIXV && !UNIX7 && !MSDOS && !TOS && !AMIGA && !OSK && !COHERENT && !VMS && !MINT
- # define MINIX 1
- #else
- # define MINIX 0
- @@ -244,7 +254,7 @@
- * a true function on all systems. The ttywrite() function is almost always
- * just a macro...
- */
- -#if !TOS && !AMIGA
- +#if !TOS && !AMIGA && !MINT
- # define ttywrite(buf, len) write(1, buf, (unsigned)(len)) /* raw write */
- #endif
-
- @@ -280,15 +290,22 @@
- extern char *getcwd();
-
- /* text versa binary mode for read/write */
- -#if !TOS
- +#if !TOS && !MINT
- #define tread(fd,buf,n) read(fd,buf,(unsigned)(n))
- #define twrite(fd,buf,n) write(fd,buf,(unsigned)(n))
- #endif
-
- +#if MINT
- +extern int read();
- +extern int tread();
- +extern int write();
- +extern int twrite();
- +#endif
- +
- /**************************** Compiler quirks *********************************/
-
- /* the UNIX version 7 and (some) TOS compilers, don't allow "void" */
- -#if UNIX7 || TOS
- +#if (UNIX7 || TOS) && !NEWSTYLE
- # define void int
- #endif
-
- @@ -427,16 +444,28 @@
- # define gethome(x) getenv("HOME")
- #endif
-
- -#if MSDOS || TOS
- +#if MSDOS || TOS || MINT
- /* do not change TMPNAME and SCRATCH*: they MUST begin with '%s\\'! */
- -# ifndef TMPDIR
- -# define TMPDIR "C:\\tmp" /* directory where temp files live */
- -# endif
- -# ifndef PRSVDIR
- -# define PRSVDIR "C:\\preserve" /* directory where preserved file live */
- -# endif
- -# ifndef PRSVINDEX
- -# define PRSVINDEX "C:\\preserve\\Index" /* index of files in PRSVDIR */
- +# if !MINT
- +# ifndef TMPDIR
- +# define TMPDIR "C:\\tmp" /* directory where temp files live */
- +# endif
- +# ifndef PRSVDIR
- +# define PRSVDIR "C:\\preserve" /* directory where preserved file live */
- +# endif
- +# ifndef PRSVINDEX
- +# define PRSVINDEX "C:\\preserve\\Index" /* index of files in PRSVDIR */
- +# endif
- +# else
- +# ifndef TMPDIR
- +# define TMPDIR "/tmp" /* directory where temp files live */
- +# endif
- +# ifndef PRSVDIR
- +# define PRSVDIR "/usr/preserve" /* directory where preserved file live */
- +# endif
- +# ifndef PRSVINDEX
- +# define PRSVINDEX "/usr/preserve/Index" /* index of files in PRSVDIR */
- +# endif
- # endif
- # define TMPNAME "%s\\elv_%x.%x" /* temp file */
- # if MSDOS
- @@ -454,16 +483,20 @@
- # endif /* MSDOS */
- # define SCRATCHIN "%s\\siXXXXXX" /* DOS ONLY - output of filter program */
- # define SCRATCHOUT "%s\\soXXXXXX" /* temp file used as input to filter */
- -# define SLASH '\\'
- +# if !MINT
- +# define SLASH '\\'
- +# else
- +# define SLASH '/'
- +# endif
- # ifndef SHELL
- -# if TOS
- +# if TOS || MINT
- # define SHELL "shell.ttp" /* default shell */
- # else
- # define SHELL "command.com" /* default shell */
- # endif
- # endif
- # define NEEDSYNC TRUE /* assume ":se sync" by default */
- -# if TOS && __GNUC__ /* probably on other systems, too */
- +# if (TOS || MINT) && __GNUC__ /* probably on other systems, too */
- # define REDIRECT "2>" /* GNUC reports on 2, others on 1 */
- # define CC_COMMAND "gcc -c"
- # else
- diff -ur ./ctags.c /local/src/elvis/17/src/ctags.c
- --- ./ctags.c Thu Feb 4 12:48:44 1993
- +++ /local/src/elvis/17/src/ctags.c Mon Apr 26 16:16:34 1993
- @@ -85,7 +85,7 @@
- /* try to open the file for reading. The file must be opened in
- * "binary" mode because otherwise fseek() would misbehave under DOS.
- */
- -#if MSDOS || TOS
- +#if MSDOS || TOS || MINT
- file_fp = fopen(name, "rb");
- #else
- file_fp = fopen(name, "r");
- @@ -129,6 +129,10 @@
- return ch;
- }
-
- + /* if no file is open return EOF */
- + if (!file_fp)
- + return EOF;
- +
- /* if previous character was a newline, then we're starting a line */
- if (file_afternl)
- {
- @@ -137,8 +141,8 @@
- file_lnum++;
- }
-
- - /* Get a character. If no file is open, then return EOF */
- - ch = (file_fp ? getc(file_fp) : EOF);
- + /* Get a character */
- + ch = getc(file_fp);
-
- /* if it is a newline, then remember that fact */
- if (ch == '\n')
- @@ -217,6 +221,7 @@
- int cpp_afternl; /* boolean: look for '#' character? */
- int cpp_prevch; /* an ungotten character, if any */
- int cpp_refsok; /* boolean: can we echo characters out to "refs"? */
- +int cpp_refsnl; /* boolean: dup next \n in "refs"? */
-
- /* This function opens the file & resets variables */
- void cpp_open(name)
- @@ -242,6 +247,14 @@
- /* try to avoid blank lines */
- if (ch == '\n')
- {
- + /* hack: double \n at end of declarations, to
- + help `ref' find the right starting point...
- + */
- + if (cpp_refsnl)
- + {
- + putc('\n', refs);
- + cpp_refsnl = FALSE;
- + }
- if (wasnl)
- {
- return;
- @@ -507,6 +520,7 @@
- cpp_echo('}');
-
- token = BODY;
- + cpp_refsnl = TRUE;
- break;
-
- case '[':
- @@ -764,14 +778,11 @@
- char **argv;
- {
- int i, j;
- -#if MSDOS || TOS
- - char **wildexpand();
- -#endif
-
- /* build the tables used by the ctype macros */
- _ct_init((uchar *)"");
-
- -#if MSDOS || TOS
- +#if MSDOS || TOS || MINT
- argv = wildexpand(&argc, argv);
- #endif
-
- @@ -845,7 +856,7 @@
- /*NOTREACHED*/
- }
-
- -#if MSDOS || TOS
- +#if MSDOS || TOS || MINT
- # define WILDCARD_NO_MAIN
- # include "wildcard.c"
- #endif
- diff -ur ./curses.c /local/src/elvis/17/src/curses.c
- --- ./curses.c Thu Feb 4 12:48:46 1993
- +++ /local/src/elvis/17/src/curses.c Fri Mar 26 14:42:20 1993
- @@ -17,7 +17,7 @@
- #include "config.h"
- #include "vi.h"
-
- -#if ANY_UNIX
- +#if ANY_UNIX || MINT
- # if UNIXV || COH_386
- # ifdef TERMIOS
- # include <termios.h>
- @@ -34,6 +34,9 @@
- # endif
- # else
- # include <sgtty.h>
- +# if MINT
- +extern int __mint;
- +# endif
- # endif
- #endif
-
- @@ -145,7 +148,7 @@
- # endif
- #endif
-
- -#if ANY_UNIX
- +#if ANY_UNIX || MINT
- # if UNIXV || COH_386
- # ifdef TERMIOS
- static struct termios oldtermio; /* original tty mode */
- @@ -209,7 +212,7 @@
- if (!termtype)
- #endif
- {
- -#if ANY_UNIX
- +#if ANY_UNIX || MINT
- write(2, "Environment variable TERM must be set\n", (unsigned)38);
- exit(2);
- #endif
- @@ -246,7 +249,7 @@
- stdscr = kbuf;
-
- /* change the terminal mode to cbreak/noecho */
- -#if ANY_UNIX
- +#if ANY_UNIX || MINT
- # if UNIXV || COH_386
- # ifdef TERMIOS
- tcgetattr(2, &oldtermio);
- @@ -254,6 +257,9 @@
- ioctl(2, TCGETA, &oldtermio);
- # endif
- # else
- +# if MINT
- + if (__mint)
- +# endif
- ioctl(2, TIOCGETP, &oldsgttyb);
- # endif
- #endif
- @@ -287,7 +293,7 @@
- /* Send any required termination strings. Turn off "raw" mode. */
- void suspend_curses()
- {
- -#if ANY_UNIX && !(UNIXV || COH_386)
- +#if (ANY_UNIX && !(UNIXV || COH_386)) || MINT
- struct tchars tbuf;
- # ifdef TIOCSLTC
- struct ltchars ltbuf;
- @@ -314,7 +320,7 @@
- refresh();
-
- /* change the terminal mode back the way it was */
- -#if ANY_UNIX
- +#if ANY_UNIX || MINT
- # if (UNIXV || COH_386)
- # ifdef TERMIOS
- tcsetattr(2, TCSADRAIN, &oldtermio);
- @@ -322,6 +328,9 @@
- ioctl(2, TCSETAW, &oldtermio);
- # endif
- # else
- +# if MINT
- + if (__mint) {
- +# endif
- ioctl(2, TIOCSETP, &oldsgttyb);
-
- ioctl(2, TIOCGETC, (struct sgttyb *) &tbuf);
- @@ -335,6 +344,9 @@
- ltbuf.t_lnextc = oldquote;
- ioctl(2, TIOCSLTC, <buf);
- # endif
- +# if MINT
- + }
- +# endif
- # endif
- #endif
- #if OSK
- @@ -363,7 +375,7 @@
- if (!curses_active)
- {
- /* change the terminal mode to cbreak/noecho */
- -#if ANY_UNIX
- +#if ANY_UNIX || MINT
- # if UNIXV || COH_386
- ospeed = (oldtermio.c_cflag & CBAUD);
- ERASEKEY = oldtermio.c_cc[VERASE];
- @@ -391,6 +403,9 @@
- struct ltchars ltbuf;
- # endif
-
- +# if MINT
- + if (__mint) {
- +# endif
- ospeed = oldsgttyb.sg_ospeed;
- ERASEKEY = oldsgttyb.sg_erase;
- newsgttyb = oldsgttyb;
- @@ -413,6 +428,9 @@
- ltbuf.t_lnextc = 0; /* disable ^V for elvis */
- ioctl(2, TIOCSLTC, <buf);
- # endif
- +# if MINT
- + }
- +# endif
-
- # endif
- #endif
- @@ -737,6 +755,9 @@
-
- }
-
- +#if MINT
- +int got_winch;
- +#endif
-
- /* This function gets the window size. It uses the TIOCGWINSZ ioctl call if
- * your system has it, or tgetnum("li") and tgetnum("co") if it doesn't.
- @@ -760,7 +781,19 @@
- /* get the window size, one way or another. */
- lines = cols = 0;
- #ifdef TIOCGWINSZ
- +# if !MINT
- if (ioctl(2, TIOCGWINSZ, &size) >= 0)
- +# else
- + if (signo)
- + got_winch = 1;
- +
- + /* only MiNT versions >= 0.9 know TIOCGWINSZ; for older versions
- + and when running under vanilla TOS mntlib would return the
- + settings of the ST BIOS screeen driver, and that at least
- + doesn't help when we're not running on the console. -nox */
- +
- + if (__mint >= 9 && ioctl(2, TIOCGWINSZ, &size) >= 0)
- +# endif
- {
- lines = size.ws_row;
- cols = size.ws_col;
- diff -ur ./curses.h /local/src/elvis/17/src/curses.h
- --- ./curses.h Thu Feb 4 12:48:48 1993
- +++ /local/src/elvis/17/src/curses.h Wed Mar 24 15:45:58 1993
- @@ -209,11 +209,19 @@
- #define do_TI() VOIDBIOS(;, (void)ttywrite(TI, (unsigned)strlen(TI)))
- #define do_TE() VOIDBIOS(;, (void)ttywrite(TE, (unsigned)strlen(TE)))
- #ifndef NO_CURSORSHAPE
- -# define do_CQ() VOIDBIOS(v_cs(), tputs(CQ, 1, faddch))
- -# define do_CX() VOIDBIOS(v_cs(), tputs(CX, 1, faddch))
- -# define do_CV() VOIDBIOS(v_cs(), tputs(CV, 1, faddch))
- -# define do_CI() VOIDBIOS(v_cb(), tputs(CI, 1, faddch))
- -# define do_CR() VOIDBIOS(v_cb(), tputs(CR, 1, faddch))
- +# if MINT /* ctputs() knows about #blink / #noblink and calling ST BIOS... */
- +# define do_CQ() VOIDBIOS(v_cs(), ctputs(CQ, 1, faddch))
- +# define do_CX() VOIDBIOS(v_cs(), ctputs(CX, 1, faddch))
- +# define do_CV() VOIDBIOS(v_cs(), ctputs(CV, 1, faddch))
- +# define do_CI() VOIDBIOS(v_cb(), ctputs(CI, 1, faddch))
- +# define do_CR() VOIDBIOS(v_cb(), ctputs(CR, 1, faddch))
- +# else
- +# define do_CQ() VOIDBIOS(v_cs(), tputs(CQ, 1, faddch))
- +# define do_CX() VOIDBIOS(v_cs(), tputs(CX, 1, faddch))
- +# define do_CV() VOIDBIOS(v_cs(), tputs(CV, 1, faddch))
- +# define do_CI() VOIDBIOS(v_cb(), tputs(CI, 1, faddch))
- +# define do_CR() VOIDBIOS(v_cb(), tputs(CR, 1, faddch))
- +# endif
- #endif
- #ifndef NO_COLOR
- # define do_aend() VOIDBIOS((vmode=A_NORMAL), endcolor())
- diff -ur ./cut.c /local/src/elvis/17/src/cut.c
- --- ./cut.c Thu Feb 4 12:48:48 1993
- +++ /local/src/elvis/17/src/cut.c Tue Sep 21 19:48:52 1993
- @@ -117,7 +117,7 @@
- /* if nobody else needs it, then discard the tmp file */
- if (i < 0)
- {
- -#if MSDOS || TOS
- +#if MSDOS || TOS || MINT
- strcpy(cutfname, o_directory);
- if ((i = strlen(cutfname)) && !strchr(":/\\", cutfname[i - 1]))
- cutfname[i++] = SLASH;
- @@ -181,12 +181,14 @@
- }
-
- /* This function should be called just before termination of vi */
- -void cutend()
- +void cutend(preserving)
- + int preserving; /* means `leave current tempfile alone' */
- {
- int i;
-
- - /* free the anonymous buffers, if they aren't already free */
- - cutswitch();
- + if (!preserving)
- + /* free the anonymous buffers, if they aren't already free */
- + cutswitch();
-
- /* free all named cut buffers, since they might be forcing an older
- * tmp file to be retained.
- @@ -196,8 +198,9 @@
- cutfree(&named[i]);
- }
-
- - /* delete the temp file */
- - maybezap(tmpnum);
- + if (!preserving)
- + /* delete the temp file */
- + maybezap(tmpnum);
- }
-
-
- @@ -424,7 +427,7 @@
- {
- char cutfname[50];/* name of an old temp file */
- int fd; /* either tmpfd or the result of open() */
- -#if MSDOS || TOS
- +#if MSDOS || TOS || MINT
- int i;
- #endif
-
- @@ -435,7 +438,7 @@
- }
- else
- {
- -#if MSDOS || TOS
- +#if MSDOS || TOS || MINT
- strcpy(cutfname, o_directory);
- if ((i = strlen(cutfname)) && !strchr(":/\\", cutfname[i-1]))
- cutfname[i++]=SLASH;
- diff -ur ./elvprsv.c /local/src/elvis/17/src/elvprsv.c
- --- ./elvprsv.c Thu Feb 4 12:48:50 1993
- +++ /local/src/elvis/17/src/elvprsv.c Fri Mar 26 00:07:38 1993
- @@ -74,12 +74,14 @@
- # undef sprintf
- #endif
-
- -#if ANY_UNIX || OSK
- +#if ANY_UNIX || OSK || MINT
- # include "prsvunix.c"
- #endif
-
- -#if MSDOS || TOS
- -# include "prsvdos.c"
- +#if MSDOS || TOS || MINT
- +# if !MINT
- +# include "prsvdos.c"
- +# endif
- # define WILDCARD_NO_MAIN
- # include "wildcard.c"
- #endif
- @@ -275,9 +277,9 @@
- int i;
- char *when = "the editor went away";
-
- -#if MSDOS || TOS
- - /* expand any wildcards in the command line */
- +#if MSDOS || TOS || MINT
- _ct_init("");
- + /* expand any wildcards in the command line */
- argv = wildexpand(&argc, argv);
- #endif
-
- @@ -310,4 +312,5 @@
- preserve(argv[i], when);
- i++;
- }
- + exit(0);
- }
- diff -ur ./elvrec.c /local/src/elvis/17/src/elvrec.c
- --- ./elvrec.c Thu Feb 4 12:48:50 1993
- +++ /local/src/elvis/17/src/elvrec.c Thu Mar 25 13:53:36 1993
- @@ -18,6 +18,10 @@
- void main P_((int, char **));
-
-
- +#if MINT
- +extern int __mint;
- +#endif
- +
- void recover(basename, outname)
- char *basename; /* the name of the file to recover */
- char *outname; /* the name of the file to write to */
- @@ -36,7 +40,12 @@
- if (basename)
- {
- #ifndef CRUNCH
- -# if MSDOS || TOS
- +# if MINT
- + for (ptr = basename; *ptr; ++ptr)
- + if (*ptr == '\\')
- + *ptr = '/';
- +# endif
- +# if MSDOS || TOS || MINT
- if (!basename[0] || basename[1] != ':')
- # else
- if (basename[0] != SLASH)
- @@ -48,6 +57,12 @@
- strcpy(pathname, ptr);
- }
- ptr = pathname + strlen(pathname);
- +# if MINT
- + if (__mint && *basename == '/' && (*pathname == '/' ||
- + ((*pathname | 0x20) == 'u' && pathname[1] == ':')))
- + ptr = pathname;
- + else
- +# endif
- *ptr++ = SLASH;
- strcpy(ptr, basename);
- }
- @@ -160,6 +175,11 @@
- fclose(from);
- setuid(0);
- #endif
- +#if TOS || MINT
- + /* GEMDOS doesn't know how to unlink a file thats still open...
- + * it might just trash the filesystem instead :-( -nox */
- + fclose(from);
- +#endif
- /* delete the /usr/preserve file */
- unlink(line);
- #if OSK
- diff -ur ./ex.c /local/src/elvis/17/src/ex.c
- --- ./ex.c Thu Feb 4 12:48:50 1993
- +++ /local/src/elvis/17/src/ex.c Thu Apr 22 00:11:24 1993
- @@ -100,7 +100,7 @@
- {"cd", CMD_CD, cmd_cd, EXRCOK+BANG+NAMEDF},
- {"copy", CMD_COPY, cmd_move, RANGE+EXTRA },
- #ifndef NO_DIGRAPH
- - {"digraph", CMD_DIGRAPH, cmd_digraph, EXRCOK+BANG+EXTRA},
- + {"digraph", CMD_DIGRAPH, cmd_digraph, EXRCOK+BANG+EXTRA+NOBAR},
- #endif
- #ifndef NO_ERRLIST
- {"errlist", CMD_ERRLIST, cmd_errlist, BANG+NAMEDF },
- @@ -676,6 +676,8 @@
- int len; /* length of the ".exrc" file */
-
- #ifdef CRUNCH
- +#undef TINYSTACK
- +#define TINYSTACK 0
- /* small address space - we need to conserve space */
-
- /* !!! kludge: we use U_text as the buffer. This has the side-effect
- diff -ur ./main.c /local/src/elvis/17/src/main.c
- --- ./main.c Thu Feb 4 12:48:54 1993
- +++ /local/src/elvis/17/src/main.c Tue Sep 21 19:15:18 1993
- @@ -27,6 +27,10 @@
- static init_digraphs();
- #endif
-
- +#if MINT
- +extern int __mint;
- +#endif
- +
- /*---------------------------------------------------------------------*/
-
- #if AMIGA
- @@ -49,8 +53,23 @@
- char *str;
- char *tag = (char *)0;
-
- +#if MINT
- + if (!__mint && isatty(0))
- + *o_stbios = 1;
- +
- + /* see if that helps against those strange redraw problems... -nox */
- +#if 0 /* doesn't seem so... */
- + _malloczero(1);
- +#endif
- +#endif
- +
- /* set mode to MODE_VI or MODE_EX depending on program name */
- +#if TOS || MINT
- + /* some TOS shells know nothing about argv[0]... -nox */
- + switch (**argv ? argv[0][strlen(argv[0]) - 1] : 's')
- +#else
- switch (argv[0][strlen(argv[0]) - 1])
- +#endif
- {
- case 'x': /* "ex" */
- mode = MODE_EX;
- @@ -91,17 +110,21 @@
- signal(SIGHUP, deathtrap);
- # endif
- # ifndef DEBUG
- -# ifdef SIGILL
- +# if !MINT
- + /* MiNT doesn't have `real' memory protection, so trying to preserve
- + files after one of these would be a bit risky... */
- +# ifdef SIGILL
- signal(SIGILL, deathtrap);
- -# endif
- -# ifdef SIGBUS
- +# endif
- +# ifdef SIGBUS
- signal(SIGBUS, deathtrap);
- -# endif
- -# ifdef SIGSEGV
- +# endif
- +# ifdef SIGSEGV
- signal(SIGSEGV, deathtrap);
- -# endif
- -# ifdef SIGSYS
- +# endif
- +# ifdef SIGSYS
- signal(SIGSYS, deathtrap);
- +# endif
- # endif
- # endif /* !DEBUG */
- # ifdef SIGPIPE
- @@ -170,6 +193,17 @@
- }
- # endif
- #endif
- +#if MINT
- + if (!strcmp(has_KL, "#K") && !strcmp(has_KR, "#M")) {
- + *o_keytime = 1;
- +
- + mapkey("#a", "u", WHEN_VICMD|WHEN_INMV, "<Undo>");
- + mapkey("#b", "\\", WHEN_VICMD|WHEN_INMV, "<Help>");
- + mapkey("#s", "B", WHEN_VICMD|WHEN_INMV, "^<Left>");
- + mapkey("#t", "W", WHEN_VICMD|WHEN_INMV, "^<Right>");
- + mapkey("#7", "v", WHEN_VICMD|WHEN_INMV, "sh-<Insrt>");
- + }
- +#endif
-
- #ifndef NO_DIGRAPH
- init_digraphs();
- @@ -285,7 +319,7 @@
- strcat(args, " ");
- strcat(args, argv[i]);
- }
- -#if MSDOS || TOS
- +#if MSDOS || TOS || MINT
- /* expand wildcard characters, if necessary */
- if (strchr(args, '*') || strchr(args, '?'))
- {
- @@ -405,7 +439,7 @@
- }
-
- /* free up the cut buffers */
- - cutend();
- + cutend(0);
-
- /* end curses */
- #ifndef NO_CURSORSHAPE
- diff -ur ./makefile /local/src/elvis/17/src/makefile
- --- ./makefile Thu Feb 4 12:48:38 1993
- +++ /local/src/elvis/17/src/makefile Tue Sep 21 21:30:12 1993
- @@ -364,6 +364,39 @@
- #DUMMY=
- #CFG=
-
- +#---- These settings are recommended for Atari TOS + gcc + MiNT libraries ----
- +OBJ=.o
- +EXE=.ttp
- +COM=.ttp
- +EXTRA= sysdos$(OBJ) atari$(OBJ)
- +EXTRA2=
- +BIN= c:\\bin
- +CC= gcc
- +LIBS= -lbcurses -lbiio
- +LIBIIO= -lbiio
- +#CFLAGS= -O2 -Wall -mbaserel -fomit-frame-pointer \
- +# -DMINT -DCS_IBMPC -DCS_SPECIAL -DSMOOTHREDRAW -DMAILER=\"rmail\"
- +#debugging:
- +CFLAGS= -g -O2 -Wall -mbaserel \
- + -DMINT -DCS_IBMPC -DCS_SPECIAL -DSMOOTHREDRAW -DMAILER=\"rmail\"
- +LFLAGS= -mbaserel
- +SMALL=
- +LARGE=
- +OF= -o
- +RF= -c
- +MYNAME= myname.c
- +PROGS= elvis$(EXE) ex$(COM) vi$(COM) view$(COM) input$(COM) \
- + ctags$(COM) ref$(COM) elvrec$(COM) wildcard$(COM) \
- + shell$(COM) fmt$(COM) elvprsv$(COM)
- +#CHMEM=
- +#debugging:
- +CHMEM= $(CC) $(CFLAGS) -B/usr/lib/sym- $(OF)elvis.sym $(OBJS) $(EXTRA) $(EXTRA2) $(LIBS)
- +SORT=
- +RM= rm -f
- +CP= cp
- +SYS= tos
- +DUMMY=
- +
- #---- These settings are recommended for OS-9/68K V2.3 ----
- #OBJ= .r
- #EXE=
- @@ -444,7 +477,7 @@
- ALIAS= alias$(OBJ)
-
- SRC1= Elvis.lnk Elvis.mak Elvis.prj Makefile.mix alias.c atari.c \
- - ctags.c pc.c ref.c shell.c sysdos.c
- + ctags.c pc.c ref.c shell.c sysdos.c myname.c
- SRC2= elvrec.c wildcard.c fmt.c profile.sh osk.c osk.h elvprsv.c unix.c \
- blk.c config.h instman.sh
- SRC3= cmd1.c cmd2.c curses.c
- @@ -464,13 +497,13 @@
- @echo "elvis linked."
-
- ctags$(COM): $(CFG) ctags.c wildcard.c
- - $(CC) $(CFLAGS) $(SMALL) $(SORT) $(OF)ctags$(COM) ctags.c $(EXTRA2)
- + $(CC) $(CFLAGS) $(SMALL) $(SORT) $(OF)ctags$(COM) ctags.c $(EXTRA2) $(LIBIIO)
-
- ref$(COM): $(CFG) ref.c
- - $(CC) $(CFLAGS) $(SMALL) $(OF)ref$(COM) ref.c
- + $(CC) $(CFLAGS) $(SMALL) $(OF)ref$(COM) ref.c $(LIBIIO)
-
- elvrec$(COM): $(CFG) elvrec.c
- - $(CC) $(CFLAGS) $(SMALL) $(OF)elvrec$(COM) elvrec.c $(EXTRA2)
- + $(CC) $(CFLAGS) $(SMALL) $(OF)elvrec$(COM) elvrec.c $(EXTRA2) $(LIBIIO)
-
- ex$(COM): linkex.$(SYS)
- @echo "ex done."
- @@ -485,16 +518,19 @@
- @echo "input done."
-
- shell$(COM): $(CFG) shell.c
- - $(CC) $(CFLAGS) $(SMALL) $(OF)shell$(COM) shell.c
- + $(CC) $(CFLAGS) $(SMALL) $(OF)shell$(COM) shell.c $(LIBIIO)
-
- wildcard$(COM): $(CFG) wildcard.c ctype.c
- - $(CC) $(CFLAGS) $(SMALL) $(OF)wildcard$(COM) wildcard.c
- + $(CC) $(CFLAGS) $(SMALL) $(OF)wildcard$(COM) wildcard.c $(LIBIIO)
-
- fmt$(COM): $(CFG) fmt.c
- - $(CC) $(CFLAGS) $(SMALL) $(OF)fmt$(COM) fmt.c $(EXTRA2)
- + $(CC) $(CFLAGS) $(SMALL) $(OF)fmt$(COM) fmt.c $(EXTRA2) $(LIBIIO)
-
- elvprsv$(COM): $(CFG) elvprsv.c amiprsv.c prsvunix.c prsvdos.c wildcard.c ctype.c
- - $(CC) $(CFLAGS) $(SMALL) $(OF)elvprsv$(COM) elvprsv.c
- + $(CC) $(CFLAGS) $(SMALL) $(OF)elvprsv$(COM) elvprsv.c $(LIBIIO)
- +#mntlib30 popen() needs a patch...
- +#elvprsv$(COM): $(CFG) elvprsv.c amiprsv.c prsvunix.c prsvdos.c wildcard.c ctype.c popen.o
- +# $(CC) $(CFLAGS) $(SMALL) $(OF)elvprsv$(COM) elvprsv.c popen.o $(LIBIIO)
-
- ##############################################################################
- # "It all depends..."
- @@ -548,29 +584,45 @@
- linkex.ami: alias.o
- $(LNK) $(LFLAGS) $(OF)ex$(EXE) alias.o $(LIBS)
-
- -linkex.unx linkex.tos linkex.xdos linkex.dos linkex.vms: $(CFG) alias.c
- +linkex.unx linkex.xdos linkex.dos linkex.vms: $(CFG) alias.c
- $(CC) $(CFLAGS) $(SMALL) $(OF)ex$(COM) alias.c
-
- +linkex.tos: $(CFG) alias$(OBJ) $(MYNAME)
- + $(CC) $(CFLAGS) $(SMALL) -DMYNAME=\"ex\" $(OF)ex$(COM) alias$(OBJ) $(MYNAME) $(LIBIIO)
- + @touch $@
- +
- linkex.os9: $(DUMMY)
- @echo done >/nil
-
- -linkvi.ami linkvi.unx linkvi.tos linkvi.xdos linkvi.dos linkvi.vms: ex$(COM)
- +linkvi.ami linkvi.unx linkvi.xdos linkvi.dos linkvi.vms: ex$(COM)
- $(CP) ex$(COM) vi$(COM)
-
- +linkvi.tos: $(CFG) alias$(OBJ) $(MYNAME)
- + $(CC) $(CFLAGS) $(SMALL) -DMYNAME=\"vi\" $(OF)vi$(COM) alias$(OBJ) $(MYNAME) $(LIBIIO)
- + @touch $@
- +
- linkvi.os9: alias.r
- $(CC) $(CFLAGS) $(OF)vi$(COM) alias.r
- @touch $@
-
- -linkview.ami linkview.unx linkview.tos linkview.xdos linkview.dos linkview.vms: ex$(COM)
- +linkview.ami linkview.unx linkview.xdos linkview.dos linkview.vms: ex$(COM)
- $(CP) ex$(COM) view$(COM)
-
- +linkview.tos: $(CFG) alias$(OBJ) $(MYNAME)
- + $(CC) $(CFLAGS) $(SMALL) -DMYNAME=\"view\" $(OF)view$(COM) alias$(OBJ) $(MYNAME) $(LIBIIO)
- + @touch $@
- +
- linkview.os9: alias.r
- $(CC) $(CFLAGS) $(OF)view$(COM) alias.r
- @touch $@
-
- -linkinput.ami linkinput.unx linkinput.tos linkinput.xdos linkinput.dos linkinput.vms: ex$(COM)
- +linkinput.ami linkinput.unx linkinput.xdos linkinput.dos linkinput.vms: ex$(COM)
- $(CP) ex$(COM) input$(COM)
-
- +linkinput.tos: $(CFG) alias$(OBJ) $(MYNAME)
- + $(CC) $(CFLAGS) $(SMALL) -DMYNAME=\"input\" $(OF)input$(COM) alias$(OBJ) $(MYNAME) $(LIBIIO)
- + @touch $@
- +
- linkinput.os9: alias.r
- $(CC) $(CFLAGS) $(OF)input$(COM) alias.r
- @touch $@
- @@ -629,6 +681,8 @@
-
- inst.tos: $(DUMMY)
- $(CP) $(PROGS) $(BIN)
- + -mkdir /usr/preserve
- + (cd $(BIN); xstrip -k $(PROGS))
-
- inst.os9: $(DUMMY)
- $(CP) $(PROGS) -rw=$(BIN)
- @@ -739,3 +793,9 @@
-
- elvis8.sh: $(SRC8)
- shar $(SRC8) >elvis7.sh
- +
- +##############################################################################
- +
- +elvis.tz: $(SRC1) $(SRC2) $(SRC3) $(SRC4) $(SRC5) $(SRC6) $(SRC7) $(SRC8)
- + tar cfv - $(SRC1) $(SRC2) $(SRC3) $(SRC4) $(SRC5) $(SRC6) $(SRC7) $(SRC8) \
- + Makefile |gzip >elvis.tz
- diff -ur ./opts.c /local/src/elvis/17/src/opts.c
- --- ./opts.c Thu Feb 4 12:48:56 1993
- +++ /local/src/elvis/17/src/opts.c Wed Mar 24 15:46:32 1993
- @@ -128,6 +128,10 @@
- char o_tagstack[1] = {TRUE};
- #endif
-
- +#if MINT
- +char o_stbios[1] = {FALSE};
- +char o_crlf[1] = {TRUE};
- +#endif
-
-
- /* The following describes the names & types of all options */
- @@ -165,6 +169,9 @@
- { "charattr", "ca", BOOL, CANSET|MR, o_charattr },
- #endif
- { "columns", "co", NUM, SET|NOSAVE|MR, o_columns },
- +#if MINT
- + { "crlf", "cr", BOOL, CANSET , o_crlf },
- +#endif
- #ifndef NO_DIGRAPH
- { "digraph", "dig", BOOL, CANSET, o_digraph },
- #endif
- @@ -237,6 +244,9 @@
- #endif
- { "shiftwidth", "sw", NUM, CANSET, o_shiftwidth },
- { "sidescroll", "ss", NUM, CANSET, o_sidescroll },
- +#if MINT
- + { "stbios", "st", BOOL, RCSET | SET , o_stbios },
- +#endif
- { "sync", "sy", BOOL, CANSET, o_sync },
- { "tabstop", "ts", NUM, CANSET|MR, o_tabstop },
- #ifndef CRUNCH
- @@ -291,7 +301,7 @@
- }
- #endif
-
- -#if AMIGA || MSDOS || TOS
- +#if AMIGA || MSDOS || TOS || MINT
- if ((val = getenv("TMP")) /* yes, ASSIGNMENT! */
- || (val = getenv("TEMP")))
- strcpy(o_directory, val);
- diff -ur ./profile.sh /local/src/elvis/17/src/profile.sh
- --- ./profile.sh Thu Feb 4 12:48:56 1993
- +++ /local/src/elvis/17/src/profile.sh Wed Mar 24 15:46:34 1993
- @@ -1,2 +1,3 @@
- -set PATH=.,\bin
- +set TERMCAP=/dev/e/etc/termcap
- +set TERM=st
- set SHELL=shell.ttp
- diff -ur ./prsvunix.c /local/src/elvis/17/src/prsvunix.c
- --- ./prsvunix.c Thu Feb 4 12:48:56 1993
- +++ /local/src/elvis/17/src/prsvunix.c Fri Mar 26 16:53:20 1993
- @@ -75,16 +75,36 @@
- #if OSK
- sprintf(cmd, "mail \"-s=%s preserved!\" %s", base, user);
- #else /* ANY_UNIX */
- +#if MINT
- + sprintf(cmd, "%s %s >/dev/null 2>/dev/null", MAILER, user);
- +#else
- sprintf(cmd, "mail %s >/dev/null 2>/dev/null", user);
- #endif
- +#endif
- m = popen(cmd, "w");
- if (!m)
- {
- /* Can't send mail! Hope the user figures it out. */
- +#if MINT
- + /* if can't send mail on MiNT, do the dos thing... */
- +
- + printf("A version of your file \"%s%c%s\"\n", file, SLASH, base);
- + printf("was preserved when %s.\n", when);
- + printf("To recover this file, do the following:\n");
- + printf("\n");
- + printf(" C:\\> cd %s\n", file);
- + printf(" %s> elvrec %s\n", file, base);
- + printf("\n");
- +#endif
- return;
- }
-
- /* Tell the user that the file was preserved */
- +#if MINT
- + /* well this is not so much #if MINT, more if MAILER doesn't know -s
- + but can read (and complete) a mail header from input... */
- + fprintf(m, "Subject: %s preserved!\n\n", base);
- +#endif
- fprintf(m, "A version of your file \"%s%c%s\"\n", file, SLASH, base);
- fprintf(m, "was preserved when %s.\n", when);
- fprintf(m, "To recover this file, do the following:\n");
- diff -ur ./redraw.c /local/src/elvis/17/src/redraw.c
- --- ./redraw.c Thu Feb 4 12:48:58 1993
- +++ /local/src/elvis/17/src/redraw.c Thu Apr 22 18:35:48 1993
- @@ -395,6 +395,10 @@
- tabstop = *o_tabstop;
- abnormal = FALSE;
-
- +#ifdef SMOOTHREDRAW
- +#define CRUNCH
- +#endif
- +/* ...or was it meant the other way around? :-) -nox */
- #ifndef CRUNCH
- if (clr)
- clrtoeol();
- @@ -624,6 +628,9 @@
- wqrefresh();
- }
-
- +#ifdef SMOOTHREDRAW
- +#undef CRUNCH
- +#endif
-
- #ifndef CRUNCH
- static void nudgecursor(same, scan, new, lno)
- @@ -960,8 +967,11 @@
-
- #ifndef NO_VISIBLE
- /* adjustments to hilited area may force extra lines to be redrawn. */
- - setviz(curs);
- +#ifndef CRUNCH
- + if (curs == cursor)
- #endif
- + setviz(curs);
- +#endif
-
- /* figure out which column the cursor will be in */
- l = markline(curs);
- @@ -1015,11 +1025,21 @@
- /* blank out the last line */
- move(LINES - 1, 0);
- clrtoeol();
- +
- + /* smartlno still on screen? -nox */
- + if (smartlno > botline)
- + smartlno = 0;
- }
- else
- {
- topline = l;
- redrawrange(0L, INFINITY, INFINITY);
- +#ifndef NO_VISIBLE
- +#ifndef CRUNCH
- + if (V_from && curs != cursor)
- + return;
- +#endif
- +#endif
- }
- }
- else if (l > topline && l <= botline + NEAR)
- @@ -1035,6 +1055,9 @@
- text = fetchline(botline);
- drawtext(text, botline, FALSE);
- }
- + /* smartlno still on screen? -nox */
- + if (topline > smartlno)
- + smartlno = 0;
- #ifndef CRUNCH
- showbottom = l;
- #endif
- @@ -1043,6 +1066,12 @@
- {
- topline = l - (LINES - 2);
- redrawrange(0L, INFINITY, INFINITY);
- +#ifndef NO_VISIBLE
- +#ifndef CRUNCH
- + if (V_from && curs != cursor)
- + return;
- +#endif
- +#endif
- }
- }
- else
- @@ -1055,6 +1084,12 @@
- }
- redrawrange(0L, INFINITY, INFINITY);
- smartlno = 0L;
- +#ifndef NO_VISIBLE
- +#ifndef CRUNCH
- + if (V_from && curs != cursor)
- + return;
- +#endif
- +#endif
- changes++;
- }
-
- diff -ur ./ref.c /local/src/elvis/17/src/ref.c
- --- ./ref.c Thu Feb 4 12:48:58 1993
- +++ /local/src/elvis/17/src/ref.c Thu Mar 25 01:40:02 1993
- @@ -33,8 +33,12 @@
- # if ANY_UNIX
- # define DEFTAGPATH ".:/usr/include:/usr/include/sys:/usr/src/lib:../lib:/usr/local/lib"
- # else
- -# if MSDOS || TOS
- -# define DEFTAGPATH ".;C:\\include;C:\\include\\sys;C:\\lib;..\\lib"
- +# if MSDOS || TOS || MINT
- +# if MINT
- +# define DEFTAGPATH ".;/usr/include;/usr/include/sys;/usr/src/lib;../lib;/usr/local/lib"
- +# else
- +# define DEFTAGPATH ".;C:\\include;C:\\include\\sys;C:\\lib;..\\lib"
- +# endif
- # define SEP ';'
- # else
- # if AMIGA
- @@ -143,7 +147,7 @@
-
- for (bytes = 0, ch = 0; ch != '\n' && --limit > 0 && (ch = getc(fp)) != EOF; bytes++)
- {
- -#if MSDOS || TOS
- +#if MSDOS || TOS || MINT
- /* since this is a binary file, we'll need to manually strip CR's */
- if (ch == '\r')
- {
- @@ -224,7 +228,7 @@
- * though we know it is a text file, because ftell() and fseek()
- * don't work on text files.
- */
- -#if MSDOS || TOS
- +#if MSDOS || TOS || MINT
- sfile = fopen(buf, "rb");
- #else
- # if AMIGA
- @@ -243,7 +247,7 @@
- else
- #endif
- sprintf(buf, "%s%crefs", dir, SLASH);
- -#if MSDOS || TOS
- +#if MSDOS || TOS || MINT
- sfile = fopen(buf, "rb");
- #else
- # if AMIGA
- diff -ur ./shell.c /local/src/elvis/17/src/shell.c
- --- ./shell.c Thu Feb 4 12:48:58 1993
- +++ /local/src/elvis/17/src/shell.c Fri Mar 26 15:18:40 1993
- @@ -21,10 +21,63 @@
- #include <stdio.h>
- #include <string.h>
- #include <osbind.h>
- +#ifdef __STDC__
- +#include <stdlib.h>
- +#else
- extern char *getenv(), *malloc();
- +#endif
- extern char **environ;
- long _stksize=16384;
- +
- +#if MINT
- +/* this is quite a bit MiNT library dependant... (although you
- + don't want to use this when actually _running_ under MiNT,
- + there are enough ports of `real' shells available now...) */
-
- +#define USEARGV 1
- +/* ...especially it depends on system() no relying on $SHELL! */
- +
- +#include <unistd.h>
- +
- +int xsystem(const char *cmd)
- +{
- + static int ret;
- + static const char *scmd;
- +
- + scmd = cmd;
- +
- + /* GEMDOS redirection bugs department... */
- + switch (vfork())
- + {
- + case -1: /* error */
- + ret = -1;
- + break;
- +
- + case 0: /* child */
- + ret = system(scmd);
- + _exit(0);
- +
- + default: /* parent */
- + wait((int *) NULL);
- + }
- +
- + return ret;
- +}
- +#endif
- +
- +#if USEARGV
- +#define INITBUFSIZ 0x400
- +#include <errno.h>
- +
- +size_t bufsiz = INITBUFSIZ;
- +char *buf = (char *) NULL;
- +
- +#ifndef __STDC__
- +extern char *putenv(), *realloc();
- +#endif
- +
- +#else
- +
- #define MAXENV 50
-
- struct
- @@ -32,8 +85,10 @@
- char *name;
- char *value;
- } myenv[MAXENV];
- +#endif
-
- -int cmd_set(), cmd_exit();
- +int cmd_set(), cmd_exit(), cmd_cd(), cmd_pwd();
- +char home[FILENAME_MAX];
-
- struct buildins
- {
- @@ -42,33 +97,116 @@
- } buildins[]=
- { "exit", cmd_exit,
- "set", cmd_set,
- + "cd", cmd_cd,
- + "pwd", cmd_pwd,
- 0,
- };
- +
- +#if USEARGV
- +char *getbuf(needed)
- + size_t needed;
- +{
- + if (buf && bufsiz >= needed)
- + return buf;
- + while (bufsiz < needed)
- + bufsiz *= 2;
- + if (!(buf = realloc(buf, bufsiz)))
- + exit(-ENOMEM);
- + return buf;
- +}
- +
- +char *bufgets(fp)
- + FILE *fp;
- +{
- + int c = EOF;
- + size_t p = 0, left = bufsiz-1;
- +
- + while(((c = getc(fp)) != EOF)) {
- + if (!--left) {
- + buf = getbuf(bufsiz * 2);
- + left = bufsiz-p-1;
- + }
- + if((buf[p++] = c) == '\n')
- + break;
- + }
- + buf[p] = '\0';
- + if (!p && c == EOF)
- + return NULL;
- + return buf;
- +}
- +#endif
-
- main(argc, argv)
- int argc;
- char **argv;
- {
- - char buf[128];
- int i;
- +#if USEARGV
- + size_t p, clen;
- + int interactive = isatty(0);
- + char *ch;
-
- + (void) getbuf((size_t) 1);
- +#else
- + char buf[128];
- +
- for (i=0; environ[i] && strncmp(environ[i],"ARGV=",5); i++)
- cmd_set(environ[i]);
- - script("profile.sh");
- +#endif
- + if (ch = getenv("HOME")) {
- + strcpy(home, ch);
- + ch = buf + strlen(strcpy(buf, ch));
- + if (!strchr("\\/", ch[-1]))
- + *ch++ = '/';
- + strcpy(ch, "profile.sh");
- + script(buf);
- + } else {
- + getcwd(home, sizeof(home));
- + script("profile.sh");
- + }
-
- if (argc>1 && !strcmp(argv[1], "-c"))
- {
- buf[0]='\0';
- +#if USEARGV
- + p = 0;
- for (i=2; i<argc; i++)
- + { if (i>2) {
- + buf[p++] = ' ';
- + buf[p] = '\0';
- + }
- + strcpy(getbuf(p+(clen=strlen(argv[i]))+2)+p, argv[i]);
- + p += clen;
- + }
- + i = execute(buf);
- + exit(i>=0 ? i : errno);
- +#else
- + for (i=2; i<argc; i++)
- { if (i>2)
- strcat(buf, " ");
- strcat(buf, argv[i]);
- }
- execute(buf);
- +#endif
- }
- else
- +#if USEARGV
- + while ((interactive ? fputs("$ ", stdout) : 0),
- + bufgets(stdin)) {
- + if ((ch=strchr(buf, '\n')) != 0)
- + *ch='\0';
- + errno = 0;
- + if (execute(buf) == -1 && interactive) {
- + if (errno == ENOENT)
- + printf("%s: not found\n", strtok(buf, " "));
- + else if (errno == ENOEXEC)
- + printf("%s: unable to exec\n", strtok(buf, " "));
- + }
- + }
- +#else
- while (fputs("$ ", stdout), gets(buf))
- execute(buf);
- +#endif
- exit(0);
- }
-
- @@ -76,9 +214,11 @@
- char *buf;
- {
- char *scan=buf;
- - char cmd[80];
- +#if !USEARGV
- + char cmd[FILENAME_MAX];
- char line[128];
- char env[4096], *ep=env;
- +#endif
- int i;
-
- while (*scan==' ')
- @@ -94,6 +234,11 @@
- if (!strcmp(buf, buildins[i].name))
- return (*buildins[i].func)(scan);
-
- +#if USEARGV
- + if (*scan && !scan[-1])
- + scan[-1] = ' ';
- + return xsystem(buf);
- +#else
- if (!searchpath(buf, cmd))
- { printf("%s: not found\n", buf);
- return -1;
- @@ -111,8 +256,10 @@
- *ep='\0';
-
- return Pexec(0, cmd, line, env);
- +#endif
- }
-
- +#if !USEARGV
- searchpath(from, to)
- char *from, *to;
- {
- @@ -163,6 +310,30 @@
- return 0;
- return 1;
- }
- +#endif
- +
- +cmd_cd(line)
- + char *line;
- +{
- + if (!*line)
- + line = home;
- + else
- + line = strtok(line, " ");
- + if (chdir(line) < 0) {
- + perror(line);
- + return 1;
- + }
- + return 0;
- +}
- +
- +cmd_pwd()
- +{
- + char cwd[FILENAME_MAX];
- +
- + getcwd(cwd, (int) sizeof(cwd));
- + puts(cwd);
- + return 0;
- +}
-
- cmd_exit()
- {
- @@ -173,12 +344,24 @@
- char *line;
- {
- char *value;
- +#if USEARGV
- + char **ep;
- +#else
- int i;
- +#endif
-
- if (!*line)
- {
- +#if USEARGV
- + if (environ)
- + for (ep = environ; *ep; ++ep) {
- + fputs(*ep, stdout);
- + fputs("\n", stdout);
- + }
- +#else
- for (i=0; i<MAXENV && myenv[i].name; i++)
- printf("%s=%s\n", myenv[i].name, myenv[i].value);
- +#endif
- return 0;
- }
-
- @@ -188,10 +371,17 @@
- { printf("Usage: set name=var\n");
- return -1;
- }
- +#if USEARGV
- + if (!(line = strdup(line)))
- + exit(-ENOMEM);
- + return putenv(line);
- +#else
- *value++='\0';
- return doset(line, value);
- +#endif
- }
-
- +#if !USEARGV
- doset(line, value)
- char *line, *value;
- {
- @@ -213,16 +403,25 @@
- strcpy(myenv[i].value, value);
- return 0;
- }
- +#endif
-
- script(name)
- char *name;
- {
- FILE *fp;
- +#if USEARGV
- + char *p;
- +#else
- char buf[128], *p;
- +#endif
-
- if ((fp=fopen(name, "r"))==0)
- return;
- - while (fgets(buf, sizeof buf, fp))
- +#if USEARGV
- + while (bufgets(fp))
- +#else
- + while (fgets(buf, (int) sizeof buf, fp))
- +#endif
- {
- if ((p=strchr(buf, '\n'))!=0)
- *p='\0';
- diff -ur ./sysdos.c /local/src/elvis/17/src/sysdos.c
- --- ./sysdos.c Thu Feb 4 12:48:58 1993
- +++ /local/src/elvis/17/src/sysdos.c Wed Mar 24 15:46:50 1993
- @@ -41,9 +41,14 @@
- #if TOS
- #include <osbind.h>
- #endif
- +#if MINT
- +#include <process.h>
- +#include <osbind.h>
- +#include <stdio.h>
- +#endif
-
-
- -#if MSDOS || TOS
- +#if MSDOS || TOS || MINT
- #include <string.h>
-
- /*
- @@ -60,11 +65,59 @@
- int system(cmd)
- const char *cmd;
- {
- -#if MSDOS
- +#if MSDOS || MINT
- +# if MINT
- + static char *extensions[] = { "ttp", "prg", "tos", NULL };
- + extern char *findfile (char *, char *, char **);
- + extern char *getenv();
- +
- + char **argv = 0, *cmdcopy = 0, **argp, *path, *p;
- + int ret;
- + size_t clen;
- + static char cmdpath[FILENAME_MAX];
- +
- + long ssp;
- + int (*shell)();
- +
- + if (cmd == o_shell)
- + return spawnlp(P_WAIT, o_shell, o_shell, (char *)0);
- +
- + if (!getenv("NO_SHELLP")) {
- + ssp = Super(0L);
- + shell = *((int (**)())0x4F6);
- + (void) Super(ssp);
- + if (shell)
- + return (*shell)(cmd);
- + }
- +
- + /* see if cmd is simple enough so that we don't need a shell */
- + if ((path = getenv("PATH")) && (clen = strlen(cmd)) &&
- + !strpbrk(cmd, "'\"`><;$~[*?&|(){}") &&
- + (argv = (char **) malloc((clen/2+2) * sizeof(char *))) &&
- + (cmdcopy = strdup(cmd)) &&
- + (p = findfile(strtok(cmdcopy, " \t"), path, extensions))) {
- + argp = argv;
- + *argp++ = strcpy(cmdpath, p);
- + while (*argp++ = strtok((char *) NULL, " \t"))
- + ;
- + errno = 0;
- + ret = spawnv(P_WAIT, p, argv);
- + free(argv);
- + free(cmdcopy);
- + if (ret != -1 || errno != ENOEXEC)
- + return ret;
- + }
- + if (argv)
- + free(argv);
- + if (cmdcopy)
- + free(cmdcopy);
- + return spawnlp(P_WAIT, o_shell, o_shell, "-c", cmd, (char *)0);
- +# else
- char *cmdswitch="/c";
- if (_osmajor<4)
- cmdswitch[0]=switchar();
- return spawnle(P_WAIT, o_shell, o_shell, cmdswitch, cmd, (char *)0, environ);
- +# endif
- #else
- long ssp;
- int (*shell)();
- @@ -109,7 +162,12 @@
- static int cmdstate;
- static char output[80];
-
- +#if MINT
- +/* MiNT uses real pipes if it can... (wich means unless running vanilla TOS.) */
- +int trpipe(cmd, in)
- +#else
- int rpipe(cmd, in)
- +#endif
- char *cmd; /* the filter command to use */
- int in; /* the fd to use for stdin */
- {
- @@ -131,12 +189,19 @@
- /* save and redirect stdin, stdout, and stderr */
- old0=dup(0);
- old1=dup(1);
- +#if MINT
- + /* ... and stderr :-) */
- + old2=dup(2);
- +#endif
- if (in)
- {
- dup2(in, 0);
- close(in);
- }
- dup2(fd, 1);
- +#if MINT
- + dup2(fd, 2);
- +#endif
-
- /* call command */
- cmdstate=system(cmd);
- @@ -144,18 +209,29 @@
- /* restore old std... */
- dup2(old0, 0); close(old0);
- dup2(old1, 1); close(old1);
- +#if MINT
- + dup2(old2, 2); close(old2);
- +#endif
-
- /* rewind command output */
- +#if TOS || MINT
- + /* GEMDOS redirection bugs department... */
- + close(fd);
- + fd=open(output, O_RDWR);
- +#else
- lseek(fd, 0L, 0);
- +#endif
- return fd;
- }
-
- /* This function closes the pipe opened by rpipe(), and returns 0 for success */
- +#if MINT
- +int trpclose(fd)
- +#else
- int rpclose(fd)
- +#endif
- int fd;
- {
- - int status;
- -
- close(fd);
- unlink(output);
- return cmdstate;
- diff -ur ./system.c /local/src/elvis/17/src/system.c
- --- ./system.c Thu Feb 4 12:49:00 1993
- +++ /local/src/elvis/17/src/system.c Wed Mar 24 15:46:54 1993
- @@ -25,9 +25,14 @@
- #ifndef XDOS
- extern char **environ;
- #endif
- +#if MINT
- +#include "ctype.h"
- +extern int __mint;
- +#endif
-
- -#if ANY_UNIX
- +#if ANY_UNIX || MINT
-
- +#if !MINT
- /* This is a new version of the system() function. The only difference
- * between this one and the library one is: this one uses the o_shell option.
- */
- @@ -83,6 +88,7 @@
-
- return status;
- }
- +#endif
-
- /* This private function opens a pipe from a filter. It is similar to the
- * system() function above, and to popen(cmd, "r").
- @@ -93,6 +99,25 @@
- {
- int r0w1[2];/* the pipe fd's */
-
- +#if MINT
- +/* maximum commandline length that we try to parse ourselves */
- +#define MAXCMDLEN 0x400
- +
- + static char *extensions[] = { "ttp", "prg", "tos", (char *) NULL};
- + extern char *findfile (char *, char *, char **);
- + extern char *getenv();
- +
- + static char *argv[MAXCMDLEN/2+2];
- + static char cmdcopy[MAXCMDLEN+2];
- + static char cmdpath[FILENAME_MAX];
- + char **argp, *path, *p;
- + size_t clen;
- +
- + /* if MiNT is not running, we have to use a tempfile */
- + if (!__mint)
- + return trpipe(cmd, in);
- +#endif
- +
- /* make the pipe */
- if (pipe(r0w1) < 0)
- {
- @@ -105,6 +130,25 @@
- */
- signal(SIGINT, SIG_IGN);
-
- +#if MINT
- + /* MiNT <= 0.8 had a problem with broken pipes... */
- + if (__mint <= 8) {
- + signal(SIGTTIN, SIG_IGN);
- + signal(SIGTTOU, SIG_IGN);
- + }
- +
- + /* see if cmd is simple enough so that we don't need a shell */
- + if ((path = getenv("PATH")) && (clen = strlen(cmd)) &&
- + clen < MAXCMDLEN && !strpbrk(cmd, "'\"`><;$~[*?&|(){}") &&
- + (p = findfile(strtok(strcpy(cmdcopy, cmd), " \t"), path, extensions))) {
- + argp = argv;
- + *argp++ = strcpy(cmdpath, p);
- + while (*argp++ = strtok((char *) NULL, " \t"))
- + ;
- + } else
- + p = 0;
- +#endif
- +
- switch (fork())
- {
- case -1: /* error */
- @@ -115,6 +159,19 @@
- close(r0w1[0]);
-
- /* redirect stdout to go to the "write" end of the pipe */
- +#if MINT
- + /* GEMDOS redirection bugs department... */
- + dup2(r0w1[1], 1);
- + dup2(r0w1[1], 2);
- + close(r0w1[1]);
- +
- + /* redirect stdin */
- + if (in != 0)
- + {
- + dup2(in, 0);
- + close(in);
- + }
- +#else
- close(1);
- dup(r0w1[1]);
- close(2);
- @@ -128,12 +185,19 @@
- dup(in);
- close(in);
- }
- +#endif
-
- /* the filter should accept SIGINT signals */
- signal(SIGINT, SIG_DFL);
-
- /* exec the shell to run the command */
- +#if MINT
- + errno = 0;
- + if (!p || (execv(p, argv) == -1 && errno == ENOEXEC))
- + execlp(o_shell, o_shell, "-c", cmd, (char *)0);
- +#else
- execle(o_shell, o_shell, "-c", cmd, (char *)0, environ);
- +#endif
- exit(1); /* if we get here, exec failed */
-
- default: /* parent */
- @@ -159,7 +223,7 @@
- }
- #endif
-
- -#if ANY_UNIX || OSK
- +#if ANY_UNIX || OSK || MINT
-
- /* This function closes the pipe opened by rpipe(), and returns 0 for success */
- int rpclose(fd)
- @@ -167,6 +231,10 @@
- {
- int status;
-
- +#if MINT
- + if (!__mint)
- + return trpclose(fd);
- +#endif
- close(fd);
- wait(&status);
- signal(SIGINT, trapint);
- @@ -210,6 +278,11 @@
- int i, j, fd;
- REG char *s, *d;
-
- +#if 1
- + /* before we do anything, see if there are wildcards at all -nox */
- + if (!strpbrk(names, "*?[`{$~"))
- + return names;
- +#endif
-
- /* build the echo command */
- if (names != tmpblk.c)
- @@ -243,7 +316,14 @@
- /* successful? */
- if (rpclose(fd) == 0 && j == 0 && i < BLKSIZE && i > 0)
- {
- +#if MINT
- + /* strange shells doing strange things... */
- + while (isspace(tmpblk.c[--i]))
- + ;
- + tmpblk.c[++i] = '\0';
- +#else
- tmpblk.c[i-1] = '\0'; /* "i-1" so we clip off the newline */
- +#endif
- return tmpblk.c;
- }
- else
- @@ -275,7 +355,7 @@
- if (to)
- {
- /* we have lines */
- -#if MSDOS || TOS
- +#if MSDOS || TOS || MINT
- strcpy(scrout, o_directory);
- if ((i=strlen(scrout)) && !strchr("\\/:", scrout[i-1]))
- scrout[i++]=SLASH;
- diff -ur ./tmp.c /local/src/elvis/17/src/tmp.c
- --- ./tmp.c Thu Feb 4 12:49:02 1993
- +++ /local/src/elvis/17/src/tmp.c Tue Sep 21 19:45:30 1993
- @@ -30,6 +30,18 @@
- # include <process.h>
- #endif
-
- +/* a quick hack 'cause close(-1) wasn't a no-op on early versions of MiNT -nox */
- +#if MINT
- +int mclose(fd)
- + int fd;
- +{
- + if (fd >= 0)
- + return close(fd);
- + return 0;
- +}
- +#define close mclose
- +#endif
- +
- #ifndef NO_MODELINES
- static void do_modelines(l, stop)
- long l; /* line number to start at */
- @@ -156,7 +168,7 @@
- if (*o_readonly || (statb.st_mode & S_IJRON))
- # endif
- #endif
- -#if ANY_UNIX
- +#if ANY_UNIX || MINT
- if (*o_readonly || !(statb.st_mode &
- ((geteuid() == 0) ? 0222 :
- ((statb.st_uid != geteuid() ? 0022 : 0200)))))
- @@ -185,7 +197,7 @@
- do
- {
- tmpnum++;
- -#if MSDOS || TOS
- +#if MSDOS || TOS || MINT
- /* MS-Dos doesn't allow multiple slashes, but supports drives
- * with current directories.
- * This relies on TMPNAME beginning with "%s\\"!!!!
- @@ -214,7 +226,7 @@
- */
-
- /* create the temp file */
- -#if ANY_UNIX
- +#if ANY_UNIX || MINT
- close(creat(tmpname, 0600)); /* only we can read it */
- #else
- close(creat(tmpname, FILEPERMS)); /* anybody body can read it, alas */
- @@ -284,7 +296,12 @@
- this = next;
-
- /* read [more] text into this block */
- +#if MINT
- + nread = (*o_crlf ? tread : read)
- + (origfd, &this->c[inbuf], BLKSIZE - 1 - inbuf);
- +#else
- nread = tread(origfd, &this->c[inbuf], BLKSIZE - 1 - inbuf);
- +#endif
- if (nread < 0)
- {
- close(origfd);
- @@ -332,7 +349,7 @@
- goto FoundEOF;
- }
-
- -#if MSDOS || TOS
- +#if MSDOS || TOS || MINT
- /* BAH! MS text mode read fills inbuf, then compresses eliminating \r
- but leaving garbage at end of buf. The same is true for TURBOC. GB. */
-
- @@ -404,7 +421,10 @@
- nbytes = 1;
- }
-
- -#if MSDOS || TOS
- +#if MSDOS || TOS || MINT
- +# if MINT
- + if (*o_crlf)
- +# endif
- /* each line has an extra CR that we didn't count yet */
- nbytes += nlines;
- #endif
- @@ -547,7 +567,11 @@
- for (len = 0; len < BLKSIZE && this->c[len]; len++)
- {
- }
- +#if MINT
- + if ((*o_crlf ? twrite : write)(fd, this->c, len) < len)
- +#else
- if (twrite(fd, this->c, len) < len)
- +#endif
- {
- msg("Trouble writing to \"%s\"", filename);
- if (!strcmp(filename, origname))
- @@ -569,7 +593,10 @@
- }
-
- /* report lines & characters */
- -#if MSDOS || TOS
- +#if MSDOS || TOS || MINT
- +# if MINT
- + if (*o_crlf)
- +# endif
- bytes += nlines; /* for the inserted carriage returns */
- #endif
- msg("Wrote \"%s\" %ld lines, %ld characters", filename, nlines, bytes);
- @@ -644,7 +671,7 @@
- * changes to be written to the disk, so that the tmp file will survive a
- * system crash or power failure.
- */
- -#if AMIGA || MSDOS || TOS
- +#if AMIGA || MSDOS || TOS || MINT
- sync()
- {
- /* MS-DOS and TOS don't flush their buffers until the file is closed,
- @@ -707,6 +734,12 @@
- strncpy(U_text, *name ? name : "foo", BLKSIZE);
- }
-
- +#if MINT
- + for (ptr=U_text; *ptr && ptr < U_text+BLKSIZE; ++ptr) {
- + if (*ptr == '\\')
- + *ptr = '/';
- + }
- +#endif
- if (tmpfd >= 0)
- {
- /* write the name out to second block of the temp file */
- @@ -784,7 +817,11 @@
- }
-
- /* delete any old temp files */
- - cutend();
- + /* ..but not the current one because its closed and elvprsv just
- + unlinked it already. (-> `Error stuffing name into tempfile'...)
- + also if elvprsv just failed/got killed somehow and did not
- + unlink it you don't want it removed. -nox */
- + cutend(1);
-
- /* exit with the proper exit status */
- exit(sig);
- diff -ur ./vars.c /local/src/elvis/17/src/vars.c
- --- ./vars.c Thu Feb 4 12:49:02 1993
- +++ /local/src/elvis/17/src/vars.c Wed Mar 24 15:47:06 1993
- @@ -106,7 +106,7 @@
-
- /* Bigger stack req'ed for TOS and TURBOC */
-
- -#if TOS
- +#if TOS || MINT
- long _stksize = 16384;
- #endif
-
- diff -ur ./vi.h /local/src/elvis/17/src/vi.h
- --- ./vi.h Thu Feb 4 12:49:04 1993
- +++ /local/src/elvis/17/src/vi.h Tue Sep 21 20:53:02 1993
- @@ -57,7 +57,7 @@
- # include <string.h> /* for str* prototypes */
- # include <stdlib.h> /* for atoi, system, malloc, free */
- # include <stdarg.h> /* for vararg definitions */
- -# if ANY_UNIX
- +# if ANY_UNIX || MINT
- # include <unistd.h> /* for read, write, ... prototypes */
- # include <sys/wait.h> /* for wait prototype */
- # endif
- @@ -202,6 +202,11 @@
- extern char o_pcbios[1];
- #endif
-
- +#if MINT
- +extern char o_stbios[1];
- +extern char o_crlf[1];
- +#endif
- +
- #ifndef NO_SHOWMATCH
- extern char o_showmatch[1];
- #endif
- @@ -316,7 +321,7 @@
- extern void savecolor P_((int)); /* save current color settings (if any) to fd */
- extern void cutname P_((int)); /* select cut buffer for next cut/paste */
- extern void initopts P_((void)); /* initialize options */
- -extern void cutend P_((void)); /* free all cut buffers & delete temp files */
- +extern void cutend P_((int)); /* free all cut buffers & delete temp files */
- extern int storename P_((char *)); /* stamp temp file with pathname of text file */
- extern int tmpstart P_((char *)); /* load a text file into edit buffer */
- extern int tmpsave P_((char *, int)); /* write edit buffer out to text file */
- diff -ur ./wildcard.c /local/src/elvis/17/src/wildcard.c
- --- ./wildcard.c Thu Feb 4 12:49:06 1993
- +++ /local/src/elvis/17/src/wildcard.c Tue Sep 21 17:27:34 1993
- @@ -63,7 +63,7 @@
- #endif
-
- /* Atari TOS, GNU-C */
- -#ifdef __m68k__
- +#if defined(MINT) || defined(__m68k__)
- #include <stat.h>
- #include <osbind.h>
- #define findfirst(a,b,c) (Fsetdta(b), (Fsfirst(a,c)))
- @@ -121,7 +121,7 @@
- {
- char *filespec;
- int wildcard=0;
- -#if defined(M68000) || defined(__m68k__)
- +#if defined(M68000) || defined(MINT) || defined(__m68k__)
- DMABUFFER findbuf;
- #else
- struct ffblk findbuf;
-