home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
GEMini Atari
/
GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso
/
files
/
editors
/
elv1beta
/
diffs
< prev
next >
Wrap
Text File
|
1993-08-08
|
90KB
|
3,820 lines
diff -c ./alias.c ../src/alias.c
*** ./alias.c Tue May 12 14:18:48 1992
--- ../src/alias.c Thu May 14 01:28:50 1992
***************
*** 27,32 ****
--- 27,41 ----
#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,45 ****
--- 49,57 ----
#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,63 ****
exit(2);
}
/* find the last letter in the invocation name of this program */
i = strlen(argv[0]);
! #if MSDOS || TOS
/* we almost certainly must bypass ".EXE" or ".TTP" from argv[0] */
if (i > 4 && argv[0][i - 4] == '.')
i -= 4;
--- 67,81 ----
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 || MINT
/* we almost certainly must bypass ".EXE" or ".TTP" from argv[0] */
if (i > 4 && argv[0][i - 4] == '.')
i -= 4;
***************
*** 65,70 ****
--- 83,96 ----
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,101 ****
--- 124,128 ----
(void)execvp(argblk[0], argblk);
perror(ELVIS);
#endif
+ exit(2);
}
diff -c ./atari.c ../src/atari.c
*** ./atari.c Tue May 12 14:18:50 1992
--- ../src/atari.c Thu May 14 01:10:26 1992
***************
*** 16,24 ****
#include "config.h"
#include "vi.h"
! #if TOS
#include <osbind.h>
/* vi uses mode==0 only ... */
int access(file, mode)
char *file;
--- 16,26 ----
#include "config.h"
#include "vi.h"
! #if TOS || MINT
#include <osbind.h>
+ # if !MINT /* MiNT's library is a little more complete :-) */
+
/* vi uses mode==0 only ... */
int access(file, mode)
char *file;
***************
*** 36,42 ****
return template;
}
! #ifndef __GNUC__
char *getcwd(buf, size)
char *buf;
{
--- 38,46 ----
return template;
}
! # endif
!
! # ifndef __GNUC__
char *getcwd(buf, size)
char *buf;
{
***************
*** 47,56 ****
Dgetpath(buf + 2, 0);
return buf;
}
! #endif
/* read -- text mode, compress \r\n to \n
* warning: might fail when maxlen==1 and at eol
*/
int tread(fd, buf, maxlen)
--- 51,61 ----
Dgetpath(buf + 2, 0);
return buf;
}
! # 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,68 ****
int i, j, nread=read(fd, buf, (unsigned)maxlen);
if (nread && buf[nread-1]=='\r')
! { nread--;
! lseek(fd, -1l, 1);
}
for (i=j=0; j<nread; i++,j++)
{ if (buf[j]=='\r' && buf[j+1]=='\n')
--- 66,81 ----
int i, j, nread=read(fd, buf, (unsigned)maxlen);
if (nread && buf[nread-1]=='\r')
! {
! 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,82 ****
--- 90,113 ----
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,122 ****
write(fd, writbuf, (unsigned)i);
return j;
}
-
/* The "timer" variable is used as a shadow of the system's timer. Since the
* system's timer can only be accessed in Supervisor mode, we are forced to
* do a Supexec(gettime) to copy the system's timer in to the User-mode "timer"
* variable.
*/
! static int timer;
! static gettime()
{
timer = *(long *)(0x4ba);
}
/* This function implements a read-with-timeout from the keyboard. */
/*ARGSUSED*/
int ttyread(buf, len, time)
--- 135,155 ----
write(fd, writbuf, (unsigned)i);
return j;
}
+ # endif
/* The "timer" variable is used as a shadow of the system's timer. Since the
* system's timer can only be accessed in Supervisor mode, we are forced to
* do a Supexec(gettime) to copy the system's timer in to the User-mode "timer"
* variable.
*/
! 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,139 ****
long endtime;
/* compute the ending time, in increments of 1/200th seconds */
! Supexec(gettime);
endtime = time * 20 + timer;
/* wait until time runs out, or we get a keystroke */
! while (!pos && (!time || timer < endtime))
{
if (Bconstat(2))
{
--- 162,172 ----
long endtime;
/* 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 (Bconstat(2))
{
***************
*** 145,151 ****
buf[pos++] = l >> 16;
}
}
! Supexec(gettime);
}
return pos;
}
--- 178,184 ----
buf[pos++] = l >> 16;
}
}
! (void) Supexec(gettime);
}
return pos;
}
***************
*** 158,161 ****
--- 191,360 ----
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")) {
+ (void) Cursconf(2, 0);
+ return;
+ }
+ if (!strcmp(cp, "#noblink")) {
+ (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 */
+ # if __GNUC__
+ signal(SIGALRM, (void (*)()) dummy);
+ # else
+ signal(SIGALRM, dummy);
+ # endif
+ alarm(time);
+
+ if (setjmp(env))
+ return 0;
+ do {
+ l = fixkey(*o_stbios ? Bconin(2) : Crawcin());
+
+ if (got_winch) {
+ got_winch = 0;
+ if (*o_lines != LINES || *o_columns != COLS) {
+ *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 -c ./cmd1.c ../src/cmd1.c
*** ./cmd1.c Tue May 12 14:18:52 1992
--- ../src/cmd1.c Wed May 13 23:26:24 1992
***************
*** 17,22 ****
--- 17,26 ----
#include "vi.h"
#include "regexp.h"
+ #if MINT
+ extern int __mint;
+ #endif
+
#ifdef DEBUG
/* print the selected lines with info on the blocks */
/*ARGSUSED*/
***************
*** 197,203 ****
}
/* either the file must not exist, or we must have a ! or be appending */
! if (access(extra, 0) == 0 && !bang && !append)
{
msg("File already exists - Use :w! to overwrite");
return;
--- 201,207 ----
}
/* either the file must not exist, or we must have a ! or be appending */
! if (*extra && access(extra, 0) == 0 && !bang && !append)
{
msg("File already exists - Use :w! to overwrite");
return;
***************
*** 238,244 ****
--- 242,252 ----
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;
***************
*** 1247,1253 ****
}
/* if the number is part of a larger word, then ignore this line */
! if (*text && isalpha(text[-1]))
{
return (char *)0;
}
--- 1255,1262 ----
}
/* if the number is part of a larger word, then ignore this line */
! /* '_' included so it catches `...in function v_1ex:' -nox */
! if (*text && (isalpha(text[-1]) || text[-1]=='_'))
{
return (char *)0;
}
***************
*** 1431,1436 ****
--- 1440,1448 ----
char *extra;
{
BLK buf;
+ #if MINT
+ int fd, old2;
+ #endif
/* if the file hasn't been saved, then complain unless ! */
if (tstflag(file, MODIFIED) && !bang)
***************
*** 1440,1447 ****
--- 1452,1467 ----
}
/* build the command */
+ #if MINT
+ /* some stupid 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 */
***************
*** 1451,1465 ****
--- 1471,1510 ----
errfd = -3;
}
+ #if MINT
+ close(creat(ERRLIST, 0666));
+ if ((fd=open(ERRLIST, O_RDWR))==-1)
+ {
+ unlink(ERRLIST);
+ return;
+ }
+ suspend_curses();
+ old2=dup(2);
+ dup2(fd, 2);
+ system(buf.c);
+ dup2(old2, 2); close(old2);
+ close(fd);
+ #else
/* run the command, with curses temporarily disabled */
suspend_curses();
system(buf.c);
+ #endif
resume_curses(mode == MODE_EX);
if (mode == MODE_COLON)
+ #if 1
+ /* `:' hit instead of CR, so let him escape... -nox */
+ return;
+ #else
mode = MODE_VI;
+ #endif
/* run the "errlist" command */
cmd_errlist(MARK_UNSET, MARK_UNSET, cmd, bang, ERRLIST);
+
+ /* avoid spurious `Hit <RETURN>' after 1st error message -nox */
+ /* (wich happened when cmd_errlist didn't have to change files...) */
+ if (mode == MODE_VI)
+ refresh();
}
#endif
***************
*** 1748,1753 ****
--- 1793,1802 ----
return;
}
#endif
+ #if MINT
+ if (!__mint)
+ return;
+ #endif
move(LINES - 1, 0);
if (tstflag(file, MODIFIED))
***************
*** 1760,1766 ****
--- 1809,1820 ----
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 -c ./cmd2.c ../src/cmd2.c
*** ./cmd2.c Tue May 12 14:18:52 1992
--- ../src/cmd2.c Wed May 13 18:28:12 1992
***************
*** 649,655 ****
--- 649,659 ----
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 -c ./config.h ../src/config.h
*** ./config.h Tue May 12 14:18:54 1992
--- ../src/config.h Wed May 13 18:33:10 1992
***************
*** 82,87 ****
--- 82,93 ----
# endif
#endif
+ #if MINT
+ # ifdef TOS
+ # undef TOS
+ # endif
+ #endif
+
/* OS9/68000 */
#ifdef OSK
# define COMPILED_BY "Microware C V2.3 Edition 40"
***************
*** 125,130 ****
--- 131,140 ----
# define TOS 0 /* Atari ST */
#endif
+ #ifndef MINT
+ # define MINT 0 /* Atari ST, gcc, MiNT */
+ #endif
+
#ifndef AMIGA
# define AMIGA 0 /* Commodore Amiga */
#endif
***************
*** 146,152 ****
#endif
/* Minix has no predefines */
! #if !BSD && !UNIXV && !UNIX7 && !MSDOS && !TOS && !AMIGA && !OSK && !COHERENT && !VMS
# define MINIX 1
#else
# define MINIX 0
--- 156,162 ----
#endif
/* Minix has no predefines */
! #if !BSD && !UNIXV && !UNIX7 && !MSDOS && !TOS && !AMIGA && !OSK && !COHERENT && !VMS && !MINT
# define MINIX 1
#else
# define MINIX 0
***************
*** 229,235 ****
* a true function on all systems. The ttywrite() function is almost always
* just a macro...
*/
! #if !TOS && !AMIGA
# define ttywrite(buf, len) write(1, buf, (unsigned)(len)) /* raw write */
#endif
--- 239,245 ----
* a true function on all systems. The ttywrite() function is almost always
* just a macro...
*/
! #if !TOS && !AMIGA && !MINT
# define ttywrite(buf, len) write(1, buf, (unsigned)(len)) /* raw write */
#endif
***************
*** 259,273 ****
extern char *getcwd();
/* text versa binary mode for read/write */
! #if !TOS
#define tread(fd,buf,n) read(fd,buf,(unsigned)(n))
#define twrite(fd,buf,n) write(fd,buf,(unsigned)(n))
#endif
/**************************** Compiler quirks *********************************/
/* the UNIX version 7 and (some) TOS compilers, don't allow "void" */
! #if UNIX7 || TOS
# define void int
#endif
--- 269,290 ----
extern char *getcwd();
/* text versa binary mode for read/write */
! #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) && !NEWSTYLE
# define void int
#endif
***************
*** 378,393 ****
# endif
#endif
! #if MSDOS || TOS
/* 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 */
# endif
# define TMPNAME "%s\\elv_%x.%x" /* temp file */
# if MSDOS
--- 395,422 ----
# endif
#endif
! #if MSDOS || TOS || MINT
/* do not change TMPNAME and SCRATCH*: they MUST begin with '%s\\'! */
! # 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
***************
*** 405,413 ****
# 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 '\\'
# ifndef SHELL
! # if TOS
# define SHELL "shell.ttp" /* default shell */
# else
# define SHELL "command.com" /* default shell */
--- 434,446 ----
# endif /* MSDOS */
# define SCRATCHIN "%s\\siXXXXXX" /* DOS ONLY - output of filter program */
# define SCRATCHOUT "%s\\soXXXXXX" /* temp file used as input to filter */
! # if !MINT
! # define SLASH '\\'
! # else
! # define SLASH '/'
! # endif
# ifndef SHELL
! # if TOS || MINT
# define SHELL "shell.ttp" /* default shell */
# else
# define SHELL "command.com" /* default shell */
***************
*** 414,420 ****
# endif
# endif
# define NEEDSYNC TRUE /* assume ":se sync" by default */
! # if TOS && __GNUC__ /* probably on other systems, too */
# define REDIRECT "2>" /* GNUC reports on 2, others on 1 */
# define CC_COMMAND "gcc -c"
# else
--- 447,453 ----
# endif
# endif
# define NEEDSYNC TRUE /* assume ":se sync" by default */
! # 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 -c ./ctags.c ../src/ctags.c
*** ./ctags.c Tue May 12 14:18:54 1992
--- ../src/ctags.c Wed May 13 22:13:48 1992
***************
*** 85,91 ****
/* 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
file_fp = fopen(name, "rb");
#else
file_fp = fopen(name, "r");
--- 85,91 ----
/* 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 || MINT
file_fp = fopen(name, "rb");
#else
file_fp = fopen(name, "r");
***************
*** 764,770 ****
char **argv;
{
int i, j;
! #if MSDOS || TOS
char **wildexpand();
#endif
--- 764,770 ----
char **argv;
{
int i, j;
! #if MSDOS || TOS || MINT
char **wildexpand();
#endif
***************
*** 771,777 ****
/* build the tables used by the ctype macros */
_ct_init("");
! #if MSDOS || TOS
argv = wildexpand(&argc, argv);
#endif
--- 771,777 ----
/* build the tables used by the ctype macros */
_ct_init("");
! #if MSDOS || TOS || MINT
argv = wildexpand(&argc, argv);
#endif
***************
*** 845,851 ****
/*NOTREACHED*/
}
! #if MSDOS || TOS
# define WILDCARD_NO_MAIN
# include "wildcard.c"
#endif
--- 845,851 ----
/*NOTREACHED*/
}
! #if MSDOS || TOS || MINT
# define WILDCARD_NO_MAIN
# include "wildcard.c"
#endif
diff -c ./curses.c ../src/curses.c
*** ./curses.c Tue May 12 14:18:56 1992
--- ../src/curses.c Wed May 13 18:28:26 1992
***************
*** 38,43 ****
--- 38,46 ----
#if TOS
# include <osbind.h>
#endif
+ #if MINT
+ # include <ioctl.h>
+ #endif
#if OSK
# include <sgstat.h>
***************
*** 206,212 ****
if (!termtype)
#endif
{
! #if ANY_UNIX
write(2, "Environment variable TERM must be set\n", (unsigned)38);
exit(2);
#endif
--- 209,215 ----
if (!termtype)
#endif
{
! #if ANY_UNIX || MINT
write(2, "Environment variable TERM must be set\n", (unsigned)38);
exit(2);
#endif
***************
*** 276,284 ****
#endif
}
-
static int curses_active = FALSE;
/* Send any required termination strings. Turn off "raw" mode. */
void suspend_curses()
{
--- 279,288 ----
#endif
}
static int curses_active = FALSE;
+ extern int oldcurs;
+
/* Send any required termination strings. Turn off "raw" mode. */
void suspend_curses()
{
***************
*** 292,297 ****
--- 296,302 ----
if (has_CQ)
{
do_CQ();
+ oldcurs = 0;
}
#endif
if (has_TE) /* GB */
***************
*** 726,731 ****
--- 731,740 ----
}
+ #if MINT
+ extern int __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.
***************
*** 743,755 ****
--- 752,780 ----
#ifdef SIGWINCH
/* reset the signal vector */
+ # if __GNUC__
+ signal(SIGWINCH, (void(*)()) getsize);
+ # else
signal(SIGWINCH, getsize);
+ # endif
#endif
/* 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 -c ./curses.h ../src/curses.h
*** ./curses.h Tue May 12 14:18:56 1992
--- ../src/curses.h Wed May 13 18:28:30 1992
***************
*** 205,215 ****
#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))
#endif
#ifndef NO_COLOR
# define do_aend() VOIDBIOS((vmode=A_NORMAL), endcolor())
--- 205,223 ----
#define do_TI() VOIDBIOS(;, (void)ttywrite(TI, (unsigned)strlen(TI)))
#define do_TE() VOIDBIOS(;, (void)ttywrite(TE, (unsigned)strlen(TE)))
#ifndef NO_CURSORSHAPE
! # 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 -c ./cut.c ../src/cut.c
*** ./cut.c Tue May 12 14:18:56 1992
--- ../src/cut.c Wed May 13 18:28:34 1992
***************
*** 117,123 ****
/* if nobody else needs it, then discard the tmp file */
if (i < 0)
{
! #if MSDOS || TOS
strcpy(cutfname, o_directory);
if ((i = strlen(cutfname)) && !strchr(":/\\", cutfname[i - 1]))
cutfname[i++] = SLASH;
--- 117,123 ----
/* if nobody else needs it, then discard the tmp file */
if (i < 0)
{
! #if MSDOS || TOS || MINT
strcpy(cutfname, o_directory);
if ((i = strlen(cutfname)) && !strchr(":/\\", cutfname[i - 1]))
cutfname[i++] = SLASH;
***************
*** 424,430 ****
{
char cutfname[50];/* name of an old temp file */
int fd; /* either tmpfd or the result of open() */
! #if MSDOS || TOS
int i;
#endif
--- 424,430 ----
{
char cutfname[50];/* name of an old temp file */
int fd; /* either tmpfd or the result of open() */
! #if MSDOS || TOS || MINT
int i;
#endif
***************
*** 435,441 ****
}
else
{
! #if MSDOS || TOS
strcpy(cutfname, o_directory);
if ((i = strlen(cutfname)) && !strchr(":/\\", cutfname[i-1]))
cutfname[i++]=SLASH;
--- 435,441 ----
}
else
{
! #if MSDOS || TOS || MINT
strcpy(cutfname, o_directory);
if ((i = strlen(cutfname)) && !strchr(":/\\", cutfname[i-1]))
cutfname[i++]=SLASH;
diff -c ./elvprsv.c ../src/elvprsv.c
*** ./elvprsv.c Tue May 12 14:18:58 1992
--- ../src/elvprsv.c Wed May 13 18:28:38 1992
***************
*** 71,77 ****
# include "prsvunix.c"
#endif
! #if MSDOS || TOS
# include "prsvdos.c"
# define WILDCARD_NO_MAIN
# include "wildcard.c"
--- 71,77 ----
# include "prsvunix.c"
#endif
! #if MSDOS || TOS || MINT
# include "prsvdos.c"
# define WILDCARD_NO_MAIN
# include "wildcard.c"
***************
*** 256,264 ****
int i;
char *when = "the editor went away";
! #if MSDOS || TOS
! /* expand any wildcards in the command line */
_ct_init("");
argv = wildexpand(&argc, argv);
#endif
--- 256,264 ----
int i;
char *when = "the editor went away";
! #if MSDOS || TOS || MINT
_ct_init("");
+ /* expand any wildcards in the command line */
argv = wildexpand(&argc, argv);
#endif
***************
*** 291,294 ****
--- 291,295 ----
preserve(argv[i], when);
i++;
}
+ exit(0);
}
diff -c ./elvrec.c ../src/elvrec.c
*** ./elvrec.c Tue May 12 14:18:58 1992
--- ../src/elvrec.c Wed May 13 22:10:18 1992
***************
*** 18,23 ****
--- 18,27 ----
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,53 ****
if (basename)
{
#ifndef CRUNCH
! # if MSDOS || TOS
if (!basename[0] || basename[1] != ':')
# else
if (basename[0] != SLASH)
# endif
{
! ptr = getcwd(pathname, sizeof pathname);
if (ptr != pathname)
{
strcpy(pathname, ptr);
}
ptr = pathname + strlen(pathname);
*ptr++ = SLASH;
strcpy(ptr, basename);
}
--- 40,62 ----
if (basename)
{
#ifndef CRUNCH
! # if MSDOS || TOS || MINT
if (!basename[0] || basename[1] != ':')
# else
if (basename[0] != SLASH)
# endif
{
! ptr = getcwd(pathname, (int) sizeof pathname);
if (ptr != pathname)
{
strcpy(pathname, ptr);
}
ptr = pathname + strlen(pathname);
+ #if MINT
+ if (__mint && (*basename == '/' || *basename == '\\') &&
+ (*pathname | 0x20) == 'u' && pathname[1] == ':')
+ ptr = pathname;
+ #endif
*ptr++ = SLASH;
strcpy(ptr, basename);
}
***************
*** 159,164 ****
--- 168,178 ----
#if OSK
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);
diff -c ./ex.c ../src/ex.c
*** ./ex.c Tue May 12 14:18:58 1992
--- ../src/ex.c Sun Aug 9 23:05:02 1992
***************
*** 301,309 ****
{
/* read a line */
#ifdef CRUNCH
! cmdlen = vgets(':', cmdbuf, sizeof(cmdbuf));
#else
! cmdlen = vgets(*o_prompt ? ':' : '\0', cmdbuf, sizeof(cmdbuf));
#endif
if (cmdlen < 0)
{
--- 301,309 ----
{
/* read a line */
#ifdef CRUNCH
! cmdlen = vgets(':', cmdbuf, (int) sizeof(cmdbuf));
#else
! cmdlen = vgets(*o_prompt ? ':' : '\0', cmdbuf, (int) sizeof(cmdbuf));
#endif
if (cmdlen < 0)
{
***************
*** 665,670 ****
--- 665,672 ----
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
***************
*** 675,684 ****
--- 677,695 ----
# if TINYSTACK
/* small stack - we need to conserve space */
+ # if TOS || MINT
+ /* TOS too has a limited stack, but enuf space on heap... -nox */
+ char *U_text = malloc(4096);
+
+ if (!U_text)
+ /* ...well, usually. :-) */
+ return 0;
+ # else
/* !!! kludge: we use U_text as the buffer. This has the side-effect
* of interfering with the shift-U visual command. Disable shift-U.
*/
U_line = 0L;
+ # endif
# else
/* This is how we would *like* to do it -- with a large buffer on the
* stack, so we can handle large .exrc files and also recursion.
***************
*** 693,704 ****
--- 704,722 ----
{
return 0;
}
+ #if TINYSTACK && (TOS || MINT)
+ len = tread(fd, U_text, 4096);
+ #else
len = tread(fd, U_text, sizeof U_text);
+ #endif
close(fd);
/* execute the string */
exstring(U_text, len, ctrl('V'));
+ #if TINYSTACK && (TOS || MINT)
+ free(U_text);
+ #endif
return 1;
}
diff -c ./input.c ../src/input.c
*** ./input.c Tue May 12 14:19:00 1992
--- ../src/input.c Wed May 13 21:11:16 1992
***************
*** 338,344 ****
--- 338,349 ----
key[0] = getkey(when);
#endif
#ifndef NO_VISIBLE
+ #if 0
+ /* hmm :-) -nox */
if (key[0] != '\0' && V_from != MARK_UNSET)
+ #else
+ if (*key && *key != ctrl('O') && V_from != MARK_UNSET)
+ #endif
{
msg("Can't modify text during a selection");
beep();
***************
*** 575,581 ****
--- 580,591 ----
if (m != cursor)
{
m = adjmove(cursor, m, (*key == 'j' || *key == 'k' ? NCOL|FINL : FINL));
+ #if 0
+ /* try typing characters after <cursor right> on an empty line :-) -nox */
if (*key == '$' || (*key == 'l' && m <= cursor))
+ #else
+ if (plen && (*key == '$' || (*key == 'l' && m <= cursor)))
+ #endif
{
m++;
}
diff -c ./main.c ../src/main.c
*** ./main.c Tue May 12 14:19:00 1992
--- ../src/main.c Wed May 13 18:28:54 1992
***************
*** 28,33 ****
--- 28,37 ----
static init_digraphs();
#endif
+ #if MINT
+ extern int __mint;
+ #endif
+
/*---------------------------------------------------------------------*/
#if AMIGA
***************
*** 50,57 ****
--- 54,74 ----
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 */
+ _malloczero(1);
+ #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;
***************
*** 92,108 ****
signal(SIGHUP, (void(*)()) deathtrap);
# endif
# ifndef DEBUG
! # ifdef SIGILL
signal(SIGILL, (void(*)()) deathtrap);
! # endif
! # ifdef SIGBUS
signal(SIGBUS, (void(*)()) deathtrap);
! # endif
! # ifdef SIGSEGV
signal(SIGSEGV, (void(*)()) deathtrap);
! # endif
! # ifdef SIGSYS
signal(SIGSYS, (void(*)()) deathtrap);
# endif
# endif /* !DEBUG */
# ifdef SIGPIPE
--- 109,129 ----
signal(SIGHUP, (void(*)()) deathtrap);
# endif
# ifndef DEBUG
! # if !MINT
! /* MiNT doesn't have memory protection, so trying to preserve files
! after one of these would be a bit risky... */
! # ifdef SIGILL
signal(SIGILL, (void(*)()) deathtrap);
! # endif
! # ifdef SIGBUS
signal(SIGBUS, (void(*)()) deathtrap);
! # endif
! # ifdef SIGSEGV
signal(SIGSEGV, (void(*)()) deathtrap);
! # endif
! # ifdef SIGSYS
signal(SIGSYS, (void(*)()) deathtrap);
+ # endif
# endif
# endif /* !DEBUG */
# ifdef SIGPIPE
***************
*** 171,176 ****
--- 192,208 ----
}
# 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();
***************
*** 286,292 ****
strcat(args, " ");
strcat(args, argv[i]);
}
! #if MSDOS || TOS
/* expand wildcard characters, if necessary */
if (strchr(args, '*') || strchr(args, '?'))
{
--- 318,324 ----
strcat(args, " ");
strcat(args, argv[i]);
}
! #if MSDOS || TOS || MINT
/* expand wildcard characters, if necessary */
if (strchr(args, '*') || strchr(args, '?'))
{
***************
*** 338,344 ****
str = getenv(EXINIT);
if (str)
{
! exstring(str, strlen(str), ctrl('V'));
}
#endif
--- 370,376 ----
str = getenv(EXINIT);
if (str)
{
! exstring(str, (int) strlen(str), ctrl('V'));
}
#endif
diff -c ./makefile ../src/makefile
*** ./makefile Mon Aug 10 00:30:22 1992
--- ../src/makefile Sun Aug 9 21:16:50 1992
***************
*** 0 ****
--- 1,741 ----
+ # combined Makefile for ELVIS - a clone of `vi`
+ #
+ # After editing this Makefile as described below, you should...
+ #
+ # Use `make` to compile all programs
+ # Use `make install` to copy the programs to the BIN directory
+ # Use `make clean` to remove all object files
+ # Use `make clobber` to remove everything except source & documentation
+ # Use `make uue` to produce uuencoded compressed tar archives of the source
+ # Use `make sh` to produce shar archives of the source
+ #
+ # Several groups of Makefile settings are included below. Choose *ONE* group
+ # of settings for your particular system, and leave the others commented out.
+ # The meanings of these settings are:
+ # OBJ the filename extension for unlinked object files -- usually .o
+ # EXE filename extension for elvis executable file -- .exe, .tpp or null
+ # COM filename extension for executable support files -- .com, .tpp or null
+ # EXTRA version-specific object files used in elvis
+ # EXTRA2 version-specific object files used in elvis & elvrec
+ # LIBS any special libraries, such as "-ltermcap"
+ # BIN directory where executables should be installed
+ # CC the C compiler command, possibly with "memory model" flags
+ # CFLAGS compiler flags used to select compile-time options
+ # LNK the linker command needed to link OBJ files (if not cc)
+ # LFLAGS linker flags used to select link-time options
+ # SMALL flag for special small memory model compilation -- usually null
+ # OF link flag to control the output file's name -- usually -o<space>
+ # RF flag used to denote "compile but don't link" -- usually -c
+ # PROGS the list of all programs
+ # CHMEM any extra commands to be run after ELVIS is linked
+ # SORT if the "tags" file must be sorted, then SORT=-DSORT
+ # RM the name of a program that deletes files
+ # CP name of a program that copies files -- copy or cp, usually
+ # SYS type of system & compiler: unx/tos/os9/dos (maybe vms?)
+ # DUMMY usually nothing, but OS9 needs "dummy"
+ # CFG name of compiler configuration file -- usually null
+
+ #---- These settings are recommended for System-V UNIX and SCO XENIX-386 ----
+ #OBJ= .o
+ #EXE=
+ #COM=
+ #EXTRA= unix$(OBJ)
+ #EXTRA2=
+ #LIBS= -lterm
+ #BIN= /usr/local/bin
+ #CC= cc
+ #CFLAGS= -DM_SYSV -O -DNO_SHIFT_FKEYS
+ #SMALL=
+ #OF= -o ""
+ #RF= -c
+ #EVAL= eval
+ #PROGS= elvis$(EXE) ctags$(COM) ref$(COM) elvrec$(COM) fmt$(COM) \
+ # elvprsv$(COM)
+ #CHMEM=
+ #SORT= -DSORT
+ #RM= rm -f
+ #CP= cp
+ #SYS= unx
+ #DUMMY=
+ #CFG=
+
+ #---- These settings are recommended for SCO XENIX-286 ----
+ #OBJ= .o
+ #EXE=
+ #COM=
+ #EXTRA= unix$(OBJ)
+ #EXTRA2=
+ #LIBS= -ltcap
+ #BIN= /usr/local/bin
+ #CC= cc -M2m -i
+ #CFLAGS= -Ox -DCS_IBMPC
+ #SMALL=
+ #OF= -o ""
+ #RF= -c
+ #EVAL= eval
+ #PROGS= elvis$(EXE) ctags$(COM) ref$(COM) elvrec$(COM) fmt$(COM) \
+ # elvprsv$(COM)
+ #CHMEM=
+ #SORT= -DSORT
+ #RM= rm -f
+ #CP= cp
+ #SYS= unx
+ #DUMMY=
+ #CFG=
+
+ #---- These settings are recommended for BSD 4.3 UNIX and SunOS ----
+ #OBJ= .o
+ #EXE=
+ #COM=
+ #EXTRA= unix$(OBJ)
+ #EXTRA2=
+ #LIBS= -ltermcap
+ #BIN= /usr/local/bin
+ #CC= cc
+ #CFLAGS= -Dbsd -O
+ #SMALL=
+ #OF= -o ""
+ #RF= -c
+ #EVAL= eval
+ #PROGS= elvis$(EXE) ctags$(COM) ref$(COM) elvrec$(COM) elvprsv$(COM)
+ #CHMEM=
+ #SORT= -DSORT
+ #RM= rm -f
+ #CP= cp
+ #SYS= unx
+ #DUMMY=
+ #CFG=
+
+ #---- These settings are recommended for Coherent ----
+ #OBJ=.o
+ #EXE=
+ #COM=
+ #EXTRA= unix$(OBJ) tinyprnt$(OBJ)
+ #EXTRA2=
+ #LIBS= -lterm
+ #BIN= /usr/bin
+ #CC= cc
+ #CFLAGS= -O -DCOHERENT -VSUVAR -DCRUNCH -DNO_CHARATTR -DNO_CURSORSHAPE \
+ # -DNO_DIGRAPH -DNO_MKEXRC -DNO_POPUP -DNO_FKEYS -DNO_ABBR
+ #SMALL=
+ #OF= -o ""
+ #RF= -c
+ #EVAL= eval
+ #PROGS= elvis$(EXE) ctags$(COM) ref$(COM) elvrec$(COM) fmt$(COM) \
+ # elvprsv$(COM)
+ #CHMEM= fixstack 2000 elvis$(EXE)
+ #SORT=
+ #RM= rm -f
+ #CP= cp
+ #SYS= unx
+ #DUMMY=
+ #CFG=
+
+ #---- These settings are recommended for Minix-ST ----
+ #OBJ= .o
+ #EXE=
+ #COM=
+ #EXTRA= unix$(OBJ)
+ #EXTRA2=
+ #LIBS=
+ #BIN= /usr/bin
+ #CC= cc
+ ##CC= gcc -s
+ #CFLAGS=
+ #SMALL=
+ #OF= -o ""
+ #RF= -c
+ #EVAL= eval
+ #PROGS= elvis$(EXE) ctags$(COM) ref$(COM) elvrec$(COM) fmt$(COM) \
+ # elvprsv$(COM)
+ #CHMEM= chmem =18000 elvis$(EXE)
+ #SORT=
+ #RM= rm -f
+ #CP= cp
+ #SYS= unx
+ #DUMMY=
+ #CFG=
+
+ #---- These settings are recommended for Minix-PC ----
+ #OBJ= .s
+ #EXE=
+ #COM=
+ #EXTRA= tinytcap$(OBJ) unix$(OBJ) tinyprnt$(OBJ)
+ #EXTRA2=
+ #LIBS=
+ #BIN= /usr/bin
+ #CC= cc -i
+ #CFLAGS= -O -DCRUNCH \
+ # -DNO_MKEXRC -DNO_CURSORSHAPE -DNO_CHARATTR -DNO_SHOWMODE \
+ # -DNO_MODELINE -DNO_OPTCOLS -DNO_DIGRAPH -DNO_EXTENSIONS \
+ # -DNO_ERRLIST -DNO_FKEY -DNO_VISIBLE -DNO_COLOR -DNO_POPUP
+ ###(not -NO_AT -DNO_SENTENCE -DNO_ABBR -DNO_RECYCLE -DNO_MAGIC -DNO_CHARSEARCH)
+ #SMALL=
+ #OF= -o ""
+ #RF= -c
+ #EVAL= eval
+ #PROGS= elvis$(EXE) ctags$(COM) ref$(COM) elvrec$(COM) fmt$(COM) \
+ # elvprsv$(COM)
+ #CHMEM=
+ #SORT=
+ #RM= rm -f
+ #CP= cp
+ #SYS= unx
+ #DUMMY=
+ #CFG=
+
+ #---- These settings are recommended for Amiga port done using Aztec 5.2b ----
+ # For AmigaDOS 2.04, you're all set! Its the default target!
+ #OBJ= .o
+ #EXE=
+ #COM=
+ #EXTRA= amiga$(OBJ) amitty$(OBJ) amisysio$(OBJ)
+ #EXTRA2= tinytcap$(OBJ)
+ #LIBS= -lc
+ #BIN= sys:utilities
+ #CC= cc
+ #CFLAGS= -sob -Damiga
+ #LNK= ln
+ #LFLAGS=
+ #SMALL=
+ #OF= -o
+ #RF=
+ #EVAL=
+ #PROGS1= elvis$(EXE) ctags$(COM) ref$(COM) elvrec$(COM) fmt$(COM)
+ #PROGS2= elvprsv$(COM) ex$(COM) vi$(COM) view$(COM) input$(COM)
+ #PROGS= $(PROGS1) $(PROGS2)
+ #CHMEM=
+ #SORT=
+ #RM= delete
+ #CP= copy
+ #SYS= ami
+ #DUMMY=
+ #CFG=
+
+ #---- These settings are recommended for MS-DOS + MS-C + NDMAKE ----
+ #OBJ= .obj
+ #EXE= .exe
+ #COM= .exe # .com might work, try it
+ #EXTRA= pc$(OBJ) sysdos$(OBJ) tinytcap$(OBJ)
+ #EXTRA2=
+ #LIBS=
+ #BIN= c:\dos
+ #CC= cl
+ #CFLAGS= -O -DCS_IBMPC -DCS_SPECIAL -DINTERNAL_TAGS
+ #SMALL= /AM
+ #OF= -o
+ #RF= -c
+ #EVAL=
+ #PROGS1= elvis$(EXE) ex$(COM) ctags$(COM) ref$(COM) elvrec$(COM)
+ #PROGS2= wildcard$(COM) fmt$(COM) elvprsv$(COM)
+ #PROGS= $(PROGS1) $(PROGS2)
+ #CHMEM=
+ #SORT=
+ #RM= del
+ #CP= copy
+ #SYS= dos
+ #DUMMY=
+ #CFG=
+
+ ##---- These settings are recommended for MS-DOS + TURBO/BORLAND C ----
+ ## CFG: name of the compiler config and response files
+ ## TC_LIB & TC_INC: location of standard libraries and header files.
+ #OBJ= .obj
+ #EXE= .exe
+ #COM= .com
+ #EXTRA= pc$(OBJ) sysdos$(OBJ) tinytcap$(OBJ)
+ #EXTRA2=
+ #LIBS=@borland.rsp
+ #BIN= c:\bin
+ #CFG= borland.cfg borland.rsp
+ #CC= bcc
+ #TC_LIB= c:\bcc\lib
+ #TC_INC= c:\bcc\include
+ #CFLAGS= +borland.cfg
+ ## uncomment next line iff using bcc, and you want to use pre-compiled headers
+ #HDRS= -H -H=borland.hdr
+ ## uncomment next line to use med memory model for elvis
+ ##CRNCH= -DCRUNCH -mm
+ #TC_CFLAGS1= -ml -O -f- -w- -v -vi- -G- -DCS_IBMPC -DCS_SPECIAL -DINTERNAL_TAGS
+ #TC_CFLAGS2= $(HDRS) $(CRNCH) -I$(TC_INC) -L$(TC_LIB)
+ ## extra flags for compiling support programs
+ #SMALL= -mt -lt -H- -v-
+ ## extra flags for linking elvis (strip symbols)
+ #EFLAGS= -v-
+ #OF= -e
+ #RF= -c
+ #EVAL=
+ #PROGS1= elvis$(EXE) ex$(COM) ctags$(COM) ref$(COM) elvrec$(COM)
+ #PROGS2= wildcard$(COM) fmt$(COM) elvprsv$(COM)
+ #PROGS= $(PROGS1) $(PROGS2)
+ #CHMEM=
+ #SORT=
+ #RM= del
+ #CP= copy
+ #SYS= dos
+ #DUMMY=
+ ##source file compilation rule:
+ #.c.obj:
+ # $(CC) $(CFLAGS) $(RF) {$< }
+
+ #---- These settings can almost make DOS executables using the XENIX compiler
+ #OBJ= .o
+ #EXE= .exe
+ #COM= .exe # .com might work, try it
+ #EXTRA= pc$(OBJ) sysdos$(OBJ) tinytcap$(OBJ)
+ #EXTRA2=
+ #LIBS=
+ #BIN= a:
+ #CC= cc -M2m -dos -F 4000
+ #CFLAGS= -O -DCS_IBMPC -DCS_SPECIAL -DINTERNAL_TAGS -Dvolatile= -Dconst=
+ #SMALL=
+ #OF= -o ""
+ #RF= -c
+ #EVAL=
+ #PROGS1= elvis$(EXE) ex$(COM) ctags$(COM) ref$(COM) elvrec$(COM)
+ #PROGS2= wildcard$(COM) fmt$(COM) elvprsv$(COM)
+ #PROGS= $(PROGS1) $(PROGS2)
+ #CHMEM=
+ #SORT=
+ #RM= rm -f
+ #CP= doscp -r
+ #SYS= xdos
+ #DUMMY=
+ #CFG=
+
+ #--- These settings are recommended for Atari TOS + Mark Williams C or Gnu C ----
+ #OBJ= .o
+ #EXE= .ttp
+ #COM= .ttp
+ #EXTRA= sysdos$(OBJ) tinytcap$(OBJ)
+ #EXTRA2= atari$(OBJ)
+ #LIBS=
+ #BIN= c:\ #
+ #CC= cc -VPEEP
+ ##CC= gcc -s
+ #CFLAGS= -O -DCS_IBMPC -DCS_SPECIAL
+ #SMALL=
+ #OF= -o
+ #RF= -c
+ #EVAL=
+ #PROGS= elvis$(EXE) ctags$(COM) ref$(COM) elvrec$(COM) wildcard$(COM) \
+ # shell$(COM) fmt$(COM) elvprsv$(COM)
+ #CHMEM= @echo -n
+ #SORT=
+ #RM= rm -f
+ #CP= copy
+ #SYS= tos
+ #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= -ltermcap -liio
+ LIBIIO= -liio
+ CFLAGS= -O -Wall -fomit-frame-pointer -fcombine-regs -fstrength-reduce -DMINT -DCS_IBMPC -DCS_SPECIAL -DSMOOTHREDRAW
+ SMALL=
+ 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= makefast elvis$(EXE)
+ SORT=
+ RM= rm -f
+ CP= cp
+ SYS= tos
+ DUMMY=
+
+ #---- These settings are recommended for OS-9/68K V2.3 ----
+ #OBJ= .r
+ #EXE=
+ #COM=
+ #EXTRA= tinyprnt$(OBJ)
+ #EXTRA2= osk$(OBJ)
+ #LIBS= -l=/dd/lib/termlib.l
+ #BIN= /dd/usr/cmds
+ #CC= cc
+ #ODIR= /dd/usr/src/elvis
+ #CFLAGS= -gq -m=2 -DNO_CURSORSHAPE
+ #SMALL=
+ #OF= -f=$(ODIR)/
+ #RF= -r
+ #EVAL=
+ #PROGS= elvis$(EXE) vi$(COM) view$(COM) input$(COM) ctags$(COM) ref$(COM) \
+ # elvrec$(COM) fmt$(COM) elvprsv$(COM)
+ #PROGS1=
+ #PROGS2=
+ #CHMEM= touch elvis$(EXE)
+ #SORT=
+ #RM= del *.stb *.dbg
+ #CP= copy
+ #SYS= os9
+ #DUMMY= dummy
+ #CFG=
+ #TC_CFLAGS1=
+ #TC_CFLAGS2=
+ #EFLAGS=
+ #LNK=
+ #LFLAGS=
+
+ ##---- These settings probably won't work for VAX/VMS, but they might ----
+ #OBJ= .obj
+ #EXE= .exe
+ #COM= .exe
+ #EXTRA= tinytcap$(OBJ)
+ #EXTRA2= vmsio$(OBJ)
+ #LIBS=
+ #BIN
+ #CC= cc
+ #CFLAGS= /define=NO_CURSORSHAPE /define=INTERNAL_TAGS
+ #SMALL=
+ #OF= /exe=
+ #RF=
+ #PROGS= elvis.exe elvprsv.exe elvrec.exe ctags.exe ref.exe
+ #CHMEM=
+ #SORT=
+ #RM= del
+ #CP= copy
+ #SYS= vms
+ #DUMMY=
+ #CFG= vmsopt.opt
+ #
+ ##compilation rules
+ #.exe.c:
+ # $(CC) $<.c
+ # link $(OF)$<.exe,vmslink/opt
+ #.obj.c:
+ # $(CC) $(CFLAGS) $<.c
+
+ ###########################################################################
+ ###########################################################################
+ ### ###
+ ### The rest of this Makefile contains no user-serviceable parts ###
+ ### ###
+ ###########################################################################
+ ###########################################################################
+
+ OBJS1= blk$(OBJ) cmd1$(OBJ) cmd2$(OBJ) ctype$(OBJ) curses$(OBJ) cut$(OBJ)
+ OBJS2= ex$(OBJ) input$(OBJ) main$(OBJ) misc$(OBJ) modify$(OBJ) move1$(OBJ)
+ OBJS3= move2$(OBJ) move3$(OBJ) move4$(OBJ) move5$(OBJ) opts$(OBJ) recycle$(OBJ)
+ OBJS4= redraw$(OBJ) regexp$(OBJ) regsub$(OBJ) system$(OBJ) tio$(OBJ) tmp$(OBJ)
+ OBJS5= vars$(OBJ) vcmd$(OBJ) vi$(OBJ)
+ OBJS= $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(OBJS5)
+
+ 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 myname.c
+ SRC2= elvrec.c wildcard.c fmt.c profile.sh osk.c osk.h elvprsv.c unix.c \
+ blk.c config.h
+ SRC3= cmd1.c cmd2.c curses.c
+ SRC4= curses.h cut.c ex.c input.c main.c misc.c
+ SRC5= modify.c move1.c move2.c move3.c move4.c move5.c opts.c recycle.c redraw.c
+ SRC6= regexp.c regexp.h regsub.c tinytcap.c tio.c tmp.c
+ SRC7= system.c vars.c vcmd.c vi.c vi.h tinyprnt.c
+ SRC8= ctype.c ctype.h borland.h novice.rc prsvdos.c prsvunix.c \
+ vmsbuild.com vmsio.c vmslink.opt vmsread.me vmssetup.com vmswild.c \
+ amiga.c amiprsv.c amistat.h amisysio.c amitty.c amiwild.c
+
+ ###########################################################################
+ all: $(PROGS)
+ @echo done.
+
+ elvis$(EXE): linkelv.$(SYS)
+ @echo "elvis linked."
+
+ ctags$(COM): $(CFG) ctags.c wildcard.c
+ $(CC) $(CFLAGS) $(SMALL) $(SORT) $(OF)ctags$(COM) ctags.c $(EXTRA2) $(LIBIIO)
+
+ ref$(COM): $(CFG) 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) $(LIBIIO)
+
+ ex$(COM): linkex.$(SYS)
+ @echo "ex done."
+
+ vi$(COM): linkvi.$(SYS)
+ @echo "vi done."
+
+ view$(COM): linkview.$(SYS)
+ @echo "view done."
+
+ input$(COM): linkinput.$(SYS)
+ @echo "input done."
+
+ shell$(COM): $(CFG) shell.c
+ $(CC) $(CFLAGS) $(SMALL) $(OF)shell$(COM) shell.c $(LIBIIO)
+
+ wildcard$(COM): $(CFG) wildcard.c
+ $(CC) $(CFLAGS) $(SMALL) $(OF)wildcard$(COM) wildcard.c ctype$(OBJ) $(LIBIIO)
+
+ fmt$(COM): $(CFG) fmt.c
+ $(CC) $(CFLAGS) $(SMALL) $(OF)fmt$(COM) fmt.c $(EXTRA2) $(LIBIIO)
+
+ elvprsv$(COM): $(CFG) elvprsv.c amiprsv.c prsvunix.c prsvdos.c wildcard.c
+ $(CC) $(CFLAGS) $(SMALL) $(OF)elvprsv$(COM) elvprsv.c ctype$(OBJ) $(LIBIIO)
+
+ ##############################################################################
+ # "It all depends..."
+
+ $(OBJS): vi.h curses.h config.h regexp.h ctype.h
+
+ ##############################################################################
+ # The way to link elvis is system dependent, and maybe compiler dependent too.
+
+ # elvis executable compilation rule for: AmigaDOS
+ linkelv.ami: $(OBJS) $(EXTRA) $(EXTRA2)
+ $(LNK) $(LFLAGS) $(OF)elvis$(EXE) $(OBJS) $(EXTRA) $(EXTRA2) $(LIBS)
+ $(CHMEM)
+ @touch $@
+
+ # elvis executable compilation rule for: all unix, os9, tos, msc dos
+ linkelv.unx linkelv.tos linkelv.os9 linkelv.cl: $(OBJS) $(EXTRA) $(EXTRA2)
+ $(CC) $(CFLAGS) $(OF)elvis$(EXE) $(OBJS) $(EXTRA) $(EXTRA2) $(LIBS)
+ $(CHMEM)
+ @touch $@
+
+ linkelv.dos: linkelv.$(CC)
+
+ # elvis executable compilation rule for: borland tcc, bcc
+ linkelv.bcc linkelv.tcc: $(CFG) $(OBJS) $(EXTRA) $(EXTRA2)
+ $(CC) $(CFLAGS) $(LIBS)
+ @echo done > linkelv.$(CC)
+
+ linkelv.vms: $(OBJS) $(EXTRA) $(EXTRA2)
+ link$(OF)elvis.exe main,$(CFG)/opt
+
+ ##############################################################################
+
+ # borland/turbo c config files
+ borland.cfg: $(DUMMY)
+ echo $(TC_CFLAGS1)> borland.cfg
+ echo $(TC_CFLAGS2)>> borland.cfg
+
+ borland.rsp: $(DUMMY)
+ echo $(EFLAGS) $(OF)elvis$(EXE) > borland.rsp
+ echo $(OBJS1)>> borland.rsp
+ echo $(OBJS2)>> borland.rsp
+ echo $(OBJS3)>> borland.rsp
+ echo $(OBJS4)>> borland.rsp
+ echo $(OBJS5)>> borland.rsp
+ echo $(EXTRA)>> borland.rsp
+
+ ##############################################################################
+ # elvis executable compilation rule for: AmigaDOS
+ linkex.ami: alias.o
+ $(LNK) $(LFLAGS) $(OF)ex$(EXE) alias.o $(LIBS)
+
+ 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.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.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.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 $@
+
+ ##############################################################################
+ # installation is system-dependent
+
+ install: $(PROGS) inst.$(SYS)
+ @echo Installation complete.
+
+ inst.ami: $(DUMMY)
+ MakeDir $(BIN)/Elvis
+ Assign Elvis: $(BIN)/Elvis
+ $(CP) $(PROGS) Elvis:
+ @echo ::: YOU STILL NEED TO EDIT THE S:STARTUP-SEQUENCE FILE,
+ @echo ::: TO HAVE TEMP FILES PRESERVED AFTER A SYSTEM CRASH.
+
+
+ inst.unx: $(DUMMY)
+ $(CP) $(PROGS) $(BIN)
+ (cd $(BIN); chmod 755 $(PROGS))
+ (cd $(BIN); chown bin $(PROGS))
+ (cd $(BIN); chown root elvprsv$(COM) elvrec$(COM))
+ (cd $(BIN); chmod 4755 elvprsv$(COM) elvrec$(COM))
+ -ln $(BIN)/elvis $(BIN)/vi
+ -ln $(BIN)/elvis $(BIN)/ex
+ -ln $(BIN)/elvis $(BIN)/view
+ -ln $(BIN)/elvis $(BIN)/input
+ @echo ::: YOU STILL NEED TO EDIT THE /ETC/RC FILE, OR WHATEVER,
+ @echo ::: TO HAVE TEMP FILES BE PRESERVED AFTER A SYSTEM CRASH.
+
+ inst.dos: $(DUMMY)
+ for %a in ($(PROGS1)) do copy %a $(BIN)
+ for %a in ($(PROGS2)) do copy %a $(BIN)
+ $(CP) $(BIN)\ex$(COM) $(BIN)\vi$(COM)
+ $(CP) $(BIN)\ex$(COM) $(BIN)\view$(COM)
+ $(CP) $(BIN)\ex$(COM) $(BIN)\input$(COM)
+ @echo ::: YOU STILL NEED TO EDIT YOUR AUTOEXEC.BAT FILE TO
+ @echo ::: HAVE TEMP FILES BE PRESERVED AFTER A SYSTEM CRASH.
+
+ inst.xdos: $(DUMMY)
+ $(CP) $(PROGS) $(BIN)
+ $(CP) ex$(COM) $(BIN)/vi$(COM)
+ $(CP) ex$(COM) $(BIN)/view$(COM)
+ $(CP) ex$(COM) $(BIN)/input$(COM)
+ @echo ::: YOU STILL NEED TO EDIT THE AUTOEXEC.BAT FILE TO
+ @echo ::: HAVE TEMP FILES BE PRESERVED AFTER A SYSTEM CRASH.
+
+ inst.tos: $(DUMMY)
+ $(CP) $(PROGS) $(BIN)
+
+ inst.os9: $(DUMMY)
+ $(CP) $(PROGS) -rw=$(BIN)
+ chd $(BIN); attr -epenprnpw $(PROGS)
+ @echo ::: YOU STILL NEED TO EDIT THE /DD/STARTUP FILE, OR WHATEVER,
+ @echo ::: TO HAVE TEMP FILES BE PRESERVED AFTER A SYSTEM CRASH.
+
+ inst.vms: $(DUMMY)
+ @echo how?
+
+ ##############################################################################
+ # clobbering is system dependent, because DOS's "copy" can't handle multiple
+ # filenames
+
+ clobber: clean clob.$(SYS)
+ @echo -n
+
+ clean: $(DUMMY)
+ $(RM) *$(OBJ)
+ $(RM) elvis?.uue
+ $(RM) elvis?.sh
+ $(RM) core
+
+ clob.unx clob.tos clob.os9 clob.xdos clob.vms: $(DUMMY)
+ $(RM) tags refs $(PROGS)
+
+ clob.dos : $(DUMMY)
+ for %a in ($(PROGS1)) do $(RM) %a
+ for %a in ($(PROGS2)) do $(RM) %a
+ for %a in (tags refs) do $(RM) %a
+
+ ##############################################################################
+
+ uue: elvis1.uue elvis2.uue elvis3.uue elvis4.uue elvis5.uue elvis6.uue elvis7.uue elvis8.uue
+
+ elvis1.uue: $(SRC1)
+ tar cf elvis1.tar $(SRC1)
+ compress -b13 elvis1.tar
+ uuencode elvis1.tar.Z <elvis1.tar.Z >elvis1.uue
+ $(RM) elvis1.tar*
+
+ elvis2.uue: $(SRC2)
+ tar cf elvis2.tar $(SRC2)
+ compress -b13 elvis2.tar
+ uuencode elvis2.tar.Z <elvis2.tar.Z >elvis2.uue
+ $(RM) elvis2.tar*
+
+ elvis3.uue: $(SRC3)
+ tar cf elvis3.tar $(SRC3)
+ compress -b13 elvis3.tar
+ uuencode elvis3.tar.Z <elvis3.tar.Z >elvis3.uue
+ $(RM) elvis3.tar*
+
+ elvis4.uue: $(SRC4)
+ tar cf elvis4.tar $(SRC4)
+ compress -b13 elvis4.tar
+ uuencode elvis4.tar.Z <elvis4.tar.Z >elvis4.uue
+ $(RM) elvis4.tar*
+
+ elvis5.uue: $(SRC5)
+ tar cf elvis5.tar $(SRC5)
+ compress -b13 elvis5.tar
+ uuencode elvis5.tar.Z <elvis5.tar.Z >elvis5.uue
+ $(RM) elvis5.tar*
+
+ elvis6.uue: $(SRC6)
+ tar cf elvis6.tar $(SRC6)
+ compress -b13 elvis6.tar
+ uuencode elvis6.tar.Z <elvis6.tar.Z >elvis6.uue
+ $(RM) elvis6.tar*
+
+ elvis7.uue: $(SRC7)
+ tar cf elvis7.tar $(SRC7)
+ compress -b13 elvis7.tar
+ uuencode elvis7.tar.Z <elvis7.tar.Z >elvis7.uue
+ $(RM) elvis7.tar*
+
+ elvis8.uue: $(SRC8)
+ tar cf elvis8.tar $(SRC8)
+ compress -b13 elvis8.tar
+ uuencode elvis8.tar.Z <elvis8.tar.Z >elvis8.uue
+ $(RM) elvis8.tar*
+
+ ##############################################################################
+
+ sh: elvis1.sh elvis2.sh elvis3.sh elvis4.sh elvis5.sh elvis6.sh elvis7.sh elvis8.sh
+
+ elvis1.sh: $(SRC1)
+ shar $(SRC1) >elvis1.sh
+
+ elvis2.sh: $(SRC2)
+ shar $(SRC2) >elvis2.sh
+
+ elvis3.sh: $(SRC3)
+ shar $(SRC3) >elvis3.sh
+
+ elvis4.sh: $(SRC4)
+ shar $(SRC4) >elvis4.sh
+
+ elvis5.sh: $(SRC5)
+ shar $(SRC5) >elvis5.sh
+
+ elvis6.sh: $(SRC6)
+ shar $(SRC6) >elvis6.sh
+
+ elvis7.sh: $(SRC7)
+ shar $(SRC7) >elvis7.sh
+
+ elvis8.sh: $(SRC8)
+ shar $(SRC8) >elvis7.sh
+
+ ##############################################################################
+
+ elvis_t.Z: $(SRC1) $(SRC2) $(SRC3) $(SRC4) $(SRC5) $(SRC6) $(SRC7) $(SRC8)
+ tar cfbZ elvis_t.Z 20 $(SRC1) $(SRC2) $(SRC3) $(SRC4) $(SRC5) $(SRC6) $(SRC7) $(SRC8) Makefile
diff -c ./myname.c ../src/myname.c
*** ./myname.c Mon Aug 10 00:30:14 1992
--- ../src/myname.c Wed May 13 18:28:58 1992
***************
*** 0 ****
--- 1,4 ----
+ /* myname.c: default argv[0] value for alias.c on TOS/MINT */
+
+ char myname[] = MYNAME;
+
diff -c ./opts.c ../src/opts.c
*** ./opts.c Tue May 12 14:19:04 1992
--- ../src/opts.c Wed May 13 18:29:02 1992
***************
*** 124,129 ****
--- 124,134 ----
char o_smd[1] = {FALSE};
#endif
+ #if MINT
+ char o_stbios[1] = {FALSE};
+ char o_crlf[1] = {TRUE};
+ #endif
+
/* The following describes the names & types of all options */
#define BOOL 0
***************
*** 160,165 ****
--- 165,173 ----
{ "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
***************
*** 232,237 ****
--- 240,248 ----
#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
***************
*** 253,259 ****
{ NULL, NULL, 0, CANSET, NULL }
};
-
/* This function initializes certain options from environment variables, etc. */
void initopts()
{
--- 264,269 ----
***************
*** 282,288 ****
}
#endif
! #if AMIGA || MSDOS || TOS
if ((val = getenv("TMP")) /* yes, ASSIGNMENT! */
|| (val = getenv("TEMP")))
strcpy(o_directory, val);
--- 292,298 ----
}
#endif
! #if AMIGA || MSDOS || TOS || MINT
if ((val = getenv("TMP")) /* yes, ASSIGNMENT! */
|| (val = getenv("TEMP")))
strcpy(o_directory, val);
diff -c ./profile.sh ../src/profile.sh
*** ./profile.sh Tue May 12 14:19:06 1992
--- ../src/profile.sh Wed May 13 18:29:06 1992
***************
*** 1,2 ****
! set PATH=.,\bin
set SHELL=shell.ttp
--- 1,3 ----
! set TERMCAP=/dev/e/etc/termcap
! set TERM=st
set SHELL=shell.ttp
diff -c ./redraw.c ../src/redraw.c
*** ./redraw.c Tue May 12 14:19:08 1992
--- ../src/redraw.c Wed May 13 18:29:12 1992
***************
*** 395,400 ****
--- 395,404 ----
tabstop = *o_tabstop;
abnormal = FALSE;
+ #ifdef SMOOTHREDRAW
+ #define CRUNCH
+ #endif
+ /* ...or was it meant the other way around? :-) -nox */
#ifndef CRUNCH
if (clr)
clrtoeol();
***************
*** 532,537 ****
--- 536,546 ----
}
else /* tab ending after screen? next line! */
{
+ #ifdef CRUNCH
+ /* needed atleast when scrolling the screen right -nox */
+ if (clr && col < limitcol)
+ clrtoeol();
+ #endif
col = limitcol;
if (has_AM)
{
***************
*** 619,624 ****
--- 628,636 ----
wqrefresh();
}
+ #ifdef SMOOTHREDRAW
+ #undef CRUNCH
+ #endif
#ifndef CRUNCH
static void nudgecursor(same, scan, new, lno)
diff -c ./ref.c ../src/ref.c
*** ./ref.c Tue May 12 14:19:08 1992
--- ../src/ref.c Wed May 13 21:53:50 1992
***************
*** 24,30 ****
--- 24,32 ----
extern void usage P_((void));
extern int countcolons P_((char *));
extern void main P_((int, char **));
+ #ifndef __STDC__
extern char *getenv P_((char *));
+ #endif
/* This is the default path that is searched for tags */
***************
*** 34,41 ****
# 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"
# define SEP ';'
# else
# if AMIGA
--- 36,47 ----
# if ANY_UNIX
# define DEFTAGPATH ".:/usr/include:/usr/include/sys:/usr/src/lib:../lib:/usr/local/lib"
# else
! # 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
***************
*** 99,105 ****
/* read lines until we get the one for this tag */
found[0] = '\0';
! while (fgets(buf, sizeof buf, tfile))
{
/* is this the one we want? */
if (!strncmp(buf, tag, len) && buf[len] == '\t')
--- 105,111 ----
/* read lines until we get the one for this tag */
found[0] = '\0';
! while (fgets(buf, (int) sizeof buf, tfile))
{
/* is this the one we want? */
if (!strncmp(buf, tag, len) && buf[len] == '\t')
***************
*** 144,150 ****
for (bytes = 0, ch = 0; ch != '\n' && --limit > 0 && (ch = getc(fp)) != EOF; bytes++)
{
! #if MSDOS || TOS
/* since this is a binary file, we'll need to manually strip CR's */
if (ch == '\r')
{
--- 150,156 ----
for (bytes = 0, ch = 0; ch != '\n' && --limit > 0 && (ch = getc(fp)) != EOF; bytes++)
{
! #if MSDOS || TOS || MINT
/* since this is a binary file, we'll need to manually strip CR's */
if (ch == '\r')
{
***************
*** 217,223 ****
* though we know it is a text file, because ftell() and fseek()
* don't work on text files.
*/
! #if MSDOS || TOS
sfile = fopen(buf, "rb");
#else
# if AMIGA
--- 223,229 ----
* though we know it is a text file, because ftell() and fseek()
* don't work on text files.
*/
! #if MSDOS || TOS || MINT
sfile = fopen(buf, "rb");
#else
# if AMIGA
***************
*** 236,242 ****
else
#endif
sprintf(buf, "%s%crefs", dir, SLASH);
! #if MSDOS || TOS
sfile = fopen(buf, "rb");
#else
# if AMIGA
--- 242,248 ----
else
#endif
sprintf(buf, "%s%crefs", dir, SLASH);
! #if MSDOS || TOS || MINT
sfile = fopen(buf, "rb");
#else
# if AMIGA
diff -c ./regexp.c ../src/regexp.c
*** ./regexp.c Tue May 12 14:19:08 1992
--- ../src/regexp.c Wed May 13 21:33:06 1992
***************
*** 361,367 ****
--- 361,373 ----
int token;
int peek;
char *build;
+ #ifdef __STDC__
+ /* tell compiler not to put re in a register so that longjmp()
+ * can't affect it -nox */
+ volatile regexp *re;
+ #else
regexp *re;
+ #endif
#ifndef CRUNCH
int from;
int to;
diff -c ./shell.c ../src/shell.c
*** ./shell.c Tue May 12 14:19:10 1992
--- ../src/shell.c Thu May 14 01:43:32 1992
***************
*** 17,30 ****
* shell: it implements the -c switch, which is required by Elvis, and
* not supported by most other atari shells.
*/
!
#include <stdio.h>
#include <string.h>
#include <osbind.h>
extern char *getenv(), *malloc();
extern char **environ;
long _stksize=16384;
#define MAXENV 50
struct
--- 17,80 ----
* shell: it implements the -c switch, which is required by Elvis, and
* not supported by most other atari shells.
*/
!
#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 ->
+ use init.prg instead) */
+
+ #define USEARGV 1
+ /* ...especially it depends on system() no relying on $SHELL! */
+
+ #include <unistd.h>
+
+ int xsystem(const char *cmd)
+ {
+ static int ret;
+
+ /* GEMDOS redirection bugs department... */
+ switch (vfork())
+ {
+ case -1: /* error */
+ ret = -1;
+ break;
+
+ case 0: /* child */
+ ret = system(cmd);
+ 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,39 ****
char *name;
char *value;
} myenv[MAXENV];
! int cmd_set(), cmd_exit();
struct buildins
{
--- 82,91 ----
char *name;
char *value;
} myenv[MAXENV];
+ #endif
! int cmd_set(), cmd_exit(), cmd_cd(), cmd_pwd();
! char home[FILENAME_MAX];
struct buildins
{
***************
*** 42,64 ****
} buildins[]=
{ "exit", cmd_exit,
"set", cmd_set,
0,
};
main(argc, argv)
int argc;
char **argv;
{
- char buf[128];
int i;
for (i=0; environ[i] && strncmp(environ[i],"ARGV=",5); i++)
cmd_set(environ[i]);
! script("profile.sh");
if (argc>1 && !strcmp(argv[1], "-c"))
{
buf[0]='\0';
for (i=2; i<argc; i++)
{ if (i>2)
strcat(buf, " ");
--- 94,183 ----
} 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;
{
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]);
! #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, " ");
***************
*** 65,74 ****
--- 184,209 ----
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,84 ****
char *buf;
{
char *scan=buf;
! char cmd[80];
char line[128];
char env[4096], *ep=env;
int i;
while (*scan==' ')
--- 211,221 ----
char *buf;
{
char *scan=buf;
! #if !USEARGV
! char cmd[FILENAME_MAX];
char line[128];
char env[4096], *ep=env;
+ #endif
int i;
while (*scan==' ')
***************
*** 94,99 ****
--- 231,241 ----
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,118 ****
--- 253,262 ----
*ep='\0';
return Pexec(0, cmd, line, env);
+ #endif
}
+ #if !USEARGV
searchpath(from, to)
char *from, *to;
{
***************
*** 163,168 ****
--- 307,336 ----
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,184 ****
--- 341,364 ----
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,197 ****
--- 368,384 ----
{ 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,228 ****
strcpy(myenv[i].value, value);
return 0;
}
script(name)
char *name;
{
FILE *fp;
char buf[128], *p;
if ((fp=fopen(name, "r"))==0)
return;
! while (fgets(buf, sizeof buf, fp))
{
if ((p=strchr(buf, '\n'))!=0)
*p='\0';
--- 400,424 ----
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;
! #if USEARGV
! while (bufgets(fp))
! #else
! while (fgets(buf, (int) sizeof buf, fp))
! #endif
{
if ((p=strchr(buf, '\n'))!=0)
*p='\0';
diff -c ./sysdos.c ../src/sysdos.c
*** ./sysdos.c Tue May 12 14:19:10 1992
--- ../src/sysdos.c Wed May 13 18:29:26 1992
***************
*** 27,43 ****
#include "vi.h"
extern char **environ;
!
! #if MSDOS
#include <process.h>
extern unsigned char _osmajor;
#endif
! #if TOS
#include <osbind.h>
#endif
!
! #if MSDOS || TOS
#include <string.h>
/*
--- 27,46 ----
#include "vi.h"
extern char **environ;
! #if MSDOS || MINT
#include <process.h>
+ # if MSDOS
extern unsigned char _osmajor;
+ # endif
#endif
! #if TOS || MINT
#include <osbind.h>
#endif
! #if MINT
! #include <stdio.h>
! #endif
! #if MSDOS || TOS || MINT
#include <string.h>
/*
***************
*** 54,64 ****
int system(cmd)
const char *cmd;
{
! #if MSDOS
char *cmdswitch="/c";
if (_osmajor<4)
cmdswitch[0]=switchar();
return spawnle(P_WAIT, o_shell, o_shell, cmdswitch, cmd, (char *)0, environ);
#else
long ssp;
int (*shell)();
--- 57,115 ----
int system(cmd)
const char *cmd;
{
! #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)();
***************
*** 103,109 ****
--- 154,165 ----
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 */
{
***************
*** 125,130 ****
--- 181,190 ----
/* 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);
***************
*** 131,136 ****
--- 191,199 ----
close(in);
}
dup2(fd, 1);
+ #if MINT
+ dup2(fd, 2);
+ #endif
/* call command */
cmdstate=system(cmd);
***************
*** 138,155 ****
/* restore old std... */
dup2(old0, 0); close(old0);
dup2(old1, 1); close(old1);
/* rewind command output */
lseek(fd, 0L, 0);
return fd;
}
/* This function closes the pipe opened by rpipe(), and returns 0 for success */
int rpclose(fd)
int fd;
{
- int status;
-
close(fd);
unlink(output);
return cmdstate;
--- 201,229 ----
/* 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;
{
close(fd);
unlink(output);
return cmdstate;
diff -c ./system.c ../src/system.c
*** ./system.c Tue May 12 14:19:10 1992
--- ../src/system.c Thu May 14 01:27:30 1992
***************
*** 22,31 ****
#include "config.h"
#include "vi.h"
extern char **environ;
! #if ANY_UNIX
/* 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.
*/
--- 22,37 ----
#include "config.h"
#include "vi.h"
+ #if MINT
+ #include "ctype.h"
+ extern int __mint;
+ #endif
+
extern char **environ;
! #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.
*/
***************
*** 85,90 ****
--- 91,97 ----
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").
***************
*** 95,100 ****
--- 102,126 ----
{
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)
{
***************
*** 107,112 ****
--- 133,157 ----
*/
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 */
***************
*** 117,122 ****
--- 162,180 ----
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);
***************
*** 130,141 ****
--- 188,206 ----
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 */
***************
*** 161,167 ****
}
#endif
! #if ANY_UNIX || OSK
/* This function closes the pipe opened by rpipe(), and returns 0 for success */
int rpclose(fd)
--- 226,232 ----
}
#endif
! #if ANY_UNIX || OSK || MINT
/* This function closes the pipe opened by rpipe(), and returns 0 for success */
int rpclose(fd)
***************
*** 169,174 ****
--- 234,243 ----
{
int status;
+ #if MINT
+ if (!__mint)
+ return trpclose(fd);
+ #endif
close(fd);
wait(&status);
#if __GNUC__
***************
*** 216,221 ****
--- 285,295 ----
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)
***************
*** 249,255 ****
--- 323,336 ----
/* 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
***************
*** 281,287 ****
if (to)
{
/* we have lines */
! #if MSDOS || TOS
strcpy(scrout, o_directory);
if ((i=strlen(scrout)) && !strchr("\\/:", scrout[i-1]))
scrout[i++]=SLASH;
--- 362,368 ----
if (to)
{
/* we have lines */
! #if MSDOS || TOS || MINT
strcpy(scrout, o_directory);
if ((i=strlen(scrout)) && !strchr("\\/:", scrout[i-1]))
scrout[i++]=SLASH;
***************
*** 375,380 ****
--- 456,471 ----
}
#endif
}
+ #if 1
+ /* doesn't the delete() belong into here? -nox */
+
+ /* delete old text, if any */
+ if (to)
+ {
+ cut(from, to);
+ delete(from, to);
+ }
+ #else
}
/* delete old text, if any */
***************
*** 382,387 ****
--- 473,479 ----
{
cut(from, to);
delete(from, to);
+ #endif
}
}
else
diff -c ./tio.c ../src/tio.c
*** ./tio.c Tue May 12 14:19:12 1992
--- ../src/tio.c Wed May 13 18:29:38 1992
***************
*** 449,454 ****
--- 449,458 ----
* number of characters read is 0, and we didn't time-out, then it exits because
* we've apparently reached the end of an EX script.
*/
+ #ifndef NO_CURSORSHAPE
+ /* made global so that suspend_curses() can reset it -nox */
+ int oldcurs;
+ #endif
static int fillkeybuf(when, timeout)
int when; /* mixture of WHEN_XXX flags */
int timeout;/* timeout in 1/10 second increments, or 0 */
***************
*** 461,469 ****
static long oldnlines;
char *str;
#endif
- #ifndef NO_CURSORSHAPE
- static int oldcurs;
- #endif
#ifdef DEBUG
watch();
--- 465,470 ----
***************
*** 547,553 ****
/* Okay, now we can finally read the rawin keystrokes */
refresh();
! nkeys = ttyread(keybuf + cend, sizeof keybuf - cend, timeout);
/* if nkeys == 0 then we've reached EOF of an ex script. */
if (nkeys == 0 && timeout == 0)
--- 548,554 ----
/* Okay, now we can finally read the rawin keystrokes */
refresh();
! nkeys = ttyread(keybuf + cend, (int) sizeof keybuf - cend, timeout);
/* if nkeys == 0 then we've reached EOF of an ex script. */
if (nkeys == 0 && timeout == 0)
diff -c ./tmp.c ../src/tmp.c
*** ./tmp.c Tue May 12 14:19:12 1992
--- ../src/tmp.c Sun Aug 9 21:34:34 1992
***************
*** 10,16 ****
/* This file contains functions which create & readback a TMPFILE */
-
#include "config.h"
#include "vi.h"
#if TOS
--- 10,15 ----
***************
*** 30,35 ****
--- 29,46 ----
# 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,162 ****
if (*o_readonly || (statb.st_mode & S_IJRON))
# endif
#endif
! #if ANY_UNIX
if (*o_readonly || !(statb.st_mode &
((geteuid() == 0) ? 0222 :
((statb.st_uid != geteuid() ? 0022 : 0200)))))
--- 167,173 ----
if (*o_readonly || (statb.st_mode & S_IJRON))
# endif
#endif
! #if ANY_UNIX || MINT
if (*o_readonly || !(statb.st_mode &
((geteuid() == 0) ? 0222 :
((statb.st_uid != geteuid() ? 0022 : 0200)))))
***************
*** 183,189 ****
/* make a name for the tmp file */
tmpnum++;
! #if MSDOS || TOS
/* MS-Dos doesn't allow multiple slashes, but supports drives
* with current directories.
* This relies on TMPNAME beginning with "%s\\"!!!!
--- 194,200 ----
/* make a name for the tmp file */
tmpnum++;
! #if MSDOS || TOS || MINT
/* MS-Dos doesn't allow multiple slashes, but supports drives
* with current directories.
* This relies on TMPNAME beginning with "%s\\"!!!!
***************
*** 203,209 ****
}
/* create the temp file */
! #if ANY_UNIX
close(creat(tmpname, 0600)); /* only we can read it */
#else
close(creat(tmpname, FILEPERMS)); /* anybody body can read it, alas */
--- 214,220 ----
}
/* create the temp file */
! #if ANY_UNIX || MINT
close(creat(tmpname, 0600)); /* only we can read it */
#else
close(creat(tmpname, FILEPERMS)); /* anybody body can read it, alas */
***************
*** 270,276 ****
--- 281,292 ----
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);
***************
*** 318,324 ****
goto FoundEOF;
}
! #if MSDOS || TOS
/* 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. */
--- 334,340 ----
goto FoundEOF;
}
! #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. */
***************
*** 386,392 ****
nbytes = 1;
}
! #if MSDOS || TOS
/* each line has an extra CR that we didn't count yet */
nbytes += nlines;
#endif
--- 402,411 ----
nbytes = 1;
}
! #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
***************
*** 529,535 ****
--- 548,558 ----
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))
***************
*** 551,557 ****
}
/* report lines & characters */
! #if MSDOS || TOS
bytes += nlines; /* for the inserted carriage returns */
#endif
msg("Wrote \"%s\" %ld lines, %ld characters", filename, nlines, bytes);
--- 574,583 ----
}
/* report lines & characters */
! #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);
***************
*** 626,632 ****
* changes to be written to the disk, so that the tmp file will survive a
* system crash or power failure.
*/
! #if AMIGA || MSDOS || TOS
sync()
{
/* MS-DOS and TOS don't flush their buffers until the file is closed,
--- 652,658 ----
* changes to be written to the disk, so that the tmp file will survive a
* system crash or power failure.
*/
! #if AMIGA || MSDOS || TOS || MINT
sync()
{
/* MS-DOS and TOS don't flush their buffers until the file is closed,
***************
*** 662,668 ****
--- 688,698 ----
U_text[1] = 127;
}
#ifndef CRUNCH
+ #if TOS | MINT | MSDOS
+ else if (*name != '/' && *name !='\\' && (!*name || name[1]!=':'))
+ #else
else if (*name != SLASH)
+ #endif
{
/* get the directory name */
ptr = getcwd(U_text, BLKSIZE);
***************
*** 684,690 ****
/* copy the filename into U_text */
strncpy(U_text, *name ? name : "foo", BLKSIZE);
}
!
if (tmpfd >= 0)
{
/* write the name out to second block of the temp file */
--- 714,725 ----
/* copy the filename into U_text */
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 */
diff -c ./vars.c ../src/vars.c
*** ./vars.c Tue May 12 14:19:14 1992
--- ../src/vars.c Wed May 13 18:29:48 1992
***************
*** 106,112 ****
/* Bigger stack req'ed for TOS and TURBOC */
! #if TOS
long _stksize = 16384;
#endif
--- 106,112 ----
/* Bigger stack req'ed for TOS and TURBOC */
! #if TOS || MINT
long _stksize = 16384;
#endif
diff -c ./vcmd.c ../src/vcmd.c
*** ./vcmd.c Tue May 12 14:19:14 1992
--- ../src/vcmd.c Wed May 13 21:08:30 1992
***************
*** 553,559 ****
/* adjust for inclusive endmarks in ex */
n -= BLKSIZE;
! if (vgets('!', cmdln, sizeof(cmdln)) > 0)
{
filter(m, n, cmdln, TRUE);
}
--- 553,559 ----
/* adjust for inclusive endmarks in ex */
n -= BLKSIZE;
! if (vgets('!', cmdln, (int) sizeof(cmdln)) > 0)
{
filter(m, n, cmdln, TRUE);
}
***************
*** 966,972 ****
--- 966,975 ----
/* arrange for the menu to be erased (except "save & exit" doesn't care)
*/
+ #if 0
+ /* hmm. doesn't work for `\\Z' -nox */
if (sel != 9)
+ #endif
redraw(MARK_UNSET, FALSE);
return m;
diff -c ./vi.c ../src/vi.c
*** ./vi.c Tue May 12 14:19:14 1992
--- ../src/vi.c Wed May 13 18:30:00 1992
***************
*** 555,561 ****
{
text[0] = key;
text[1] = '\0';
! if (doingdot || vgets(key, text + 1, sizeof text - 1) >= 0)
{
/* reassure user that <CR> was hit */
qaddch('\r');
--- 555,561 ----
{
text[0] = key;
text[1] = '\0';
! if (doingdot || vgets(key, text + 1, (int) sizeof text - 1) >= 0)
{
/* reassure user that <CR> was hit */
qaddch('\r');
diff -c ./vi.h ../src/vi.h
*** ./vi.h Tue May 12 14:19:16 1992
--- ../src/vi.h Wed May 13 23:07:12 1992
***************
*** 58,64 ****
# include <string.h> /* for str* prototypes */
# include <stdlib.h> /* for atoi, system, malloc, free */
# include <stdarg.h> /* for vararg definitions */
! # if ANY_UNIX
# include <unistd.h> /* for read, write, ... prototypes */
# include <sys/wait.h> /* for wait prototype */
# endif
--- 58,64 ----
# include <string.h> /* for str* prototypes */
# include <stdlib.h> /* for atoi, system, malloc, free */
# include <stdarg.h> /* for vararg definitions */
! # if ANY_UNIX || MINT
# include <unistd.h> /* for read, write, ... prototypes */
# include <sys/wait.h> /* for wait prototype */
# endif
***************
*** 200,205 ****
--- 200,210 ----
#if MSDOS
extern char o_pcbios[1];
+ #endif
+
+ #if MINT
+ extern char o_stbios[1];
+ extern char o_crlf[1];
#endif
#ifndef NO_SHOWMATCH
diff -c ./wildcard.c ../src/wildcard.c
*** ./wildcard.c Tue May 12 14:40:12 1992
--- ../src/wildcard.c Sun Aug 9 21:12:58 1992
***************
*** 57,63 ****
--- 57,69 ----
#define MAXFILES 1000
int pstrcmp();
+
+ #ifdef __STDC__
+ #include <string.h>
+ #include <stdlib.h>
+ #else
extern char *calloc();
+ #endif
char *files[MAXFILES];
int nfiles;
***************
*** 96,102 ****
}
#endif
! expand(name)
char *name;
{
char *filespec;
--- 102,108 ----
}
#endif
! int expand(name)
char *name;
{
char *filespec;
***************
*** 139,153 ****
}
}
! addfile(buf)
char *buf;
{
char *p;
for (p=buf; *p; p++)
*p=tolower(*p);
!
! if (nfiles<MAXFILES && (files[nfiles]=calloc(strlen(buf)+1, 1))!=0)
strcpy(files[nfiles++], buf);
}
--- 145,167 ----
}
}
! #if MINT
! extern int __mint;
! #endif
!
! int addfile(buf)
char *buf;
{
char *p;
+ #if MINT
+ /* there are filesystems on MiNT that are case sensitive... and for
+ the vanilla GEMDOS fs MiNT already does this conversion itself */
+ if (!__mint)
+ #endif
for (p=buf; *p; p++)
*p=tolower(*p);
! if (nfiles<MAXFILES && (files[nfiles]=calloc(strlen(buf)+1, (size_t) 1))!=0)
strcpy(files[nfiles++], buf);
}