home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-01-07 | 103.9 KB | 4,203 lines |
- diff -ru ./bnu.c /src/t103/uucp-1.03/bnu.c
- --- ./bnu.c Tue Apr 7 06:05:18 1992
- +++ /src/t103/uucp-1.03/bnu.c Mon Oct 12 17:02:02 1992
- @@ -546,8 +546,46 @@
- ztok = strrchr (qset->zport, ',');
- if (ztok != NULL && ztok[1] != '\0')
- {
- +#if 1
- + /* parse stuff like gf(7,1024)... (g parameters in brackets) */
- + char *o, *p, *q, *carg[3];
- +
- qset->zprotocols = ztok + 1;
- *ztok = '\0';
- +
- + if ((o = strrchr (qset->zport, ',')) &&
- + (p = strchr (o + 1, '(')) &&
- + (q = strchr (ztok + 1, ')')) && !q[1]) {
- +
- + carg[0] = "g";
- + carg[1] = "window";
- + carg[2] = p + 1;
- + tadd_proto_param (&qset->cproto_params,
- + &qset->qproto_params, "", 3, carg);
- + *q = 0;
- +#if 1
- + /* addition: timeout after t as in (7,1024t20) (seconds) */
- + if (q = strchr (ztok + 1, 't')) {
- + *q = 0;
- + carg[1] = "timeout";
- + carg[2] = q + 1;
- + tadd_proto_param (&qset->cproto_params,
- + &qset->qproto_params, "", 3, carg);
- + }
- +#endif
- + carg[1] = "packet-size";
- + carg[2] = ztok + 1;
- + tadd_proto_param (&qset->cproto_params,
- + &qset->qproto_params, "", 3, carg);
- + *p = 0;
- + ztok = o;
- + qset->zprotocols = ztok + 1;
- + *ztok = '\0';
- + }
- +#else
- + qset->zprotocols = ztok + 1;
- + *ztok = '\0';
- +#endif
- }
-
- ztok = strtok ((char *) NULL, " \t");
- diff -ru ./conf.h /src/t103/uucp-1.03/conf.h
- --- ./conf.h Tue Apr 7 06:16:50 1992
- +++ /src/t103/uucp-1.03/conf.h Sun Oct 11 12:50:00 1992
- @@ -4,11 +4,11 @@
-
- /* Set MAIL_PROGRAM to a program which takes a mail address as an argument
- and accepts a mail message to send to that address on stdin. */
- -#define MAIL_PROGRAM "/usr/ucb/mail"
- +#define MAIL_PROGRAM "/usr/bin/rmail.ttp"
-
- /* Set ECHO_PROGRAM to a program which echoes its arguments; if echo
- is a shell builtin you can just use "echo". */
- -#define ECHO_PROGRAM "/bin/echo"
- +#define ECHO_PROGRAM "echo"
-
- /* The following macros indicate what header files you have. Set the
- macro to 1 if you have the corresponding header file, or 0 if you
- @@ -24,11 +24,11 @@
- #define HAVE_DIRENT_H 1 /* <dirent.h> */
- #define HAVE_MEMORY_H 1 /* <memory.h> */
- #define HAVE_SYS_PARAM_H 1 /* <sys/param.h> */
- -#define HAVE_UTIME_H 1 /* <utime.h> */
- +#define HAVE_UTIME_H 0 /* <utime.h> */
- #define HAVE_FCNTL_H 1 /* <fcntl.h> */
- #define HAVE_SYS_FILE_H 1 /* <sys/file.h> */
- #define HAVE_LIBC_H 0 /* <libc.h> */
- -#define HAVE_SYSEXITS_H 1 /* <sysexits.h> */
- +#define HAVE_SYSEXITS_H 0 /* <sysexits.h> */
- #define HAVE_POLL_H 0 /* <poll.h> */
- #define HAVE_STROPTS_H 0 /* <stropts.h> */
-
- @@ -128,7 +128,7 @@
- FS_STATFS the two argument statfs function with the f_fsize field
- FS_GETMNT the two argument statfs function with the fd_req field
- FS_USTAT the ustat function with 512 byte blocks. */
- -#define FS_GETMNT
- +#define FS_MNTENT
-
- /* Set HAVE_VOID to 1 if the compiler supports declaring functions with
- a return type of void and casting values to void. */
- @@ -169,19 +169,19 @@
- #define HAVE_STRERROR 1
- #define HAVE_STRTOL 1
- #define HAVE_STRSTR 1
- -#define HAVE_STRDUP 0
- -#define HAVE_STRCASECMP 1
- -#define HAVE_STRICMP 0
- -#define HAVE_STRLWR 0
- +#define HAVE_STRDUP 1
- +#define HAVE_STRCASECMP 0
- +#define HAVE_STRICMP 1
- +#define HAVE_STRLWR 1
- #define HAVE_BSEARCH 1
- #define HAVE_VFPRINTF 1
- #define HAVE_REMOVE 1
- -#define HAVE_FTRUNCATE 1
- +#define HAVE_FTRUNCATE 0
- #define HAVE_LTRUNC 0
- #define HAVE_RENAME 1
- #define HAVE_OPENDIR 1
- #define HAVE_DUP2 1
- -#define HAVE_WAITPID 1
- +#define HAVE_WAITPID 0
- #define HAVE_WAIT4 0
-
- /* If you have either sigsetjmp or setret, it will be used instead of
- @@ -188,7 +188,7 @@
- setjmp. These functions will only be used if your system restarts
- system calls after interrupts (see HAVE_RESTARTABLE_SYSCALLS,
- below). */
- -#define HAVE_SIGSETJMP 1
- +#define HAVE_SIGSETJMP 0
- #define HAVE_SETRET 0
-
- /* The code needs to know what function to use to set a signal
- @@ -195,14 +195,14 @@
- handler. If will try to use each of the following functions in
- turn. If none are available, it will use signal, which is assumed
- to always exist. */
- -#define HAVE_SIGACTION 1
- -#define HAVE_SIGVEC 1
- +#define HAVE_SIGACTION 0
- +#define HAVE_SIGVEC 0
- #define HAVE_SIGSET 0
-
- /* The code will try to use each of the following functions in turn
- when blocking signals from delivery. If none are available, a
- relatively unimportant race condition will exist. */
- -#define HAVE_SIGPROCMASK 1
- +#define HAVE_SIGPROCMASK 0
- #define HAVE_SIGBLOCK 1
- #define HAVE_SIGHOLD 0
-
- @@ -210,13 +210,13 @@
- determine the number of file descriptors which may be open.
- Otherwise, the code will use OPEN_MAX if defined, then NOFILE if
- defined, then 20. */
- -#define HAVE_GETDTABLESIZE 1
- +#define HAVE_GETDTABLESIZE 0
- #define HAVE_SYSCONF 1
-
- /* The code will use one of the following functions when detaching
- from a terminal. One of these must exist. */
- #define HAVE_SETPGRP 1
- -#define HAVE_SETSID 1
- +#define HAVE_SETSID 0
-
- /* If you do not specify the local node name in the main configuration
- file, Taylor UUCP will try to use each of the following functions
- @@ -228,8 +228,8 @@
- /* The code will try to use each of the following functions in turn to
- determine the current time. If none are available, it will use
- time, which is assume to always exist. */
- -#define HAVE_GETTIMEOFDAY 1
- -#define HAVE_FTIME 1
- +#define HAVE_GETTIMEOFDAY 0
- +#define HAVE_FTIME 0
-
- /* If neither gettimeofday nor ftime is available, the code will use
- times (if available) to measure a span of time. See also the
- @@ -243,7 +243,7 @@
- poll. */
- #define HAVE_NAPMS 0
- #define HAVE_NAP 0
- -#define HAVE_USLEEP 0
- +#define HAVE_USLEEP 1
- #define HAVE_POLL 0
- #define HAVE_SELECT 1
-
- @@ -250,11 +250,11 @@
- /* If the getgrent function is available, it will be used to determine
- all the groups a user belongs to when checking file access
- permissions. */
- -#define HAVE_GETGRENT 1
- +#define HAVE_GETGRENT 0
-
- /* If the socket function is available, TCP support code will be
- compiled in. */
- -#define HAVE_SOCKET 1
- +#define HAVE_SOCKET 0
-
- /* The code needs to know to how to get the name of the current
- directory. If getcwd is available it will be used, otherwise if
- @@ -290,7 +290,7 @@
- your setpgrp calls takes 2 argument (on System V they generally
- take no arguments). You can safely set this to 1 on System V,
- provided the call will compile without any errors. */
- -#define HAVE_BSD_PGRP 1
- +#define HAVE_BSD_PGRP 0
-
- /* Set HAVE_UNION_WAIT to 1 if union wait is defined in the header
- file <sys/wait.h>. */
- @@ -301,7 +301,7 @@
-
- /* Set HAVE_LONG_NAMES to 1 if the system supports file names longer
- than 14 characters. */
- -#define HAVE_LONG_NAMES 1
- +#define HAVE_LONG_NAMES 0
-
- /* If slow system calls are restarted after interrupts, set
- HAVE_RESTARTABLE_SYSCALLS to 1. This is ignored if HAVE_SIGACTION
- diff -ru ./contrib/makefile /src/t103/uucp-1.03/contrib/makefile
- --- ./contrib/makefile Tue Oct 13 02:14:20 1992
- +++ /src/t103/uucp-1.03/contrib/makefile Thu Dec 24 15:40:30 1992
- @@ -0,0 +1,8 @@
- +CC = gcc
- +# gcc 1.40:
- +#CFLAGS = -O -Wall -fcombine-regs -fomit-frame-pointer -fstrength-reduce
- +# gcc 2.3.1:
- +CFLAGS = -O2 -Wall -fomit-frame-pointer -fstrength-reduce
- +
- +xchat.ttp: xchat.c
- + $(CC) $(CFLAGS) xchat.c -o xchat.ttp
- diff -ru ./contrib/xchat.c /src/t103/uucp-1.03/contrib/xchat.c
- --- ./contrib/xchat.c Wed Apr 1 23:25:42 1992
- +++ /src/t103/uucp-1.03/contrib/xchat.c Sun Jan 3 04:48:26 1993
- @@ -5,9 +5,36 @@
- #include <signal.h>
- #include <sys/time.h>
- #include <sys/ioctl.h>
- +#ifndef __MINT__
- #include <sys/termio.h>
- +#endif
- +
- +#ifdef __MINT__
- +#include <stdlib.h>
- +#include <unistd.h>
- +#include <errno.h>
- +#include <osbind.h>
- +#include <sysvars.h>
- +#include <ostruct.h>
- +
- +#define MINT_DTR 1 /* same as in sys2.c */
- +#define MINT_BREAK 1
- +
- +#define HAVE_USLEEP 1
- +#define HAVE_BSD_TTY 1 /* not really used yet... */
- +
- +/* still necessary at least with MiNT 0.95: */
- +#ifndef RTSCTS
- +#define RTSCTS 0x2000
- +#endif
-
- +int strip = 0x7f;
- +int waitcd;
- +
- +#else
- #define HAVE_SETITIMER 1
- +#endif
- +
- #define SIGRET int
-
- typedef SIGRET *sigfunc_t;
- @@ -80,7 +107,10 @@
- #define SC_PEVN 39 /* Set port for 7-bit, even parity */
- #define SC_PODD 40 /* Set port for 7-bit, odd parity */
- #define SC_HUPS 41 /* Change state on HUP signal */
- -#define SC_END 42 /* end of array */
- +#if 1
- +#define SC_LOGSTR 42 /* log received string */
- +#endif
- +#define SC_END 43 /* end of array */
-
- /* values for prmtype, prm2type */
-
- @@ -136,6 +166,9 @@
- {"sendstr", SC_SNDP, SC_INT, SC_NONE},
- {"ifstr", SC_IF1P, SC_INT, SC_NWST},
- {"ifnstr", SC_IF0P, SC_INT, SC_NWST},
- +#if 1
- + {"logstr", SC_LOGSTR, SC_XSTR, SC_NONE},
- +#endif
- {"table end", SC_END, SC_NONE, SC_NONE}
- };
-
- @@ -174,7 +207,11 @@
- static int fSalarm = FALSE;
- static int fShangup = FALSE; /* TRUE if HUP signal received */
- static FILE *dbf = NULL;
- +#if HAVE_BSD_TTY
- +static struct sgttyb old, new;
- +#else
- static struct termio old, new;
- +#endif
-
- extern int usignal();
- extern int uhup();
- @@ -188,7 +225,9 @@
- } sigtbl[] = {
- { SIGHUP, NULL, uhup },
- { SIGINT, NULL, usignal },
- +#ifndef __MINT__
- { SIGIOT, NULL, usignal },
- +#endif
- { SIGQUIT, NULL, usignal },
- { SIGTERM, NULL, usignal },
- { SIGALRM, NULL, usalarm },
- @@ -665,9 +704,15 @@
- time_t sc_begwait; /* time at beg of wait */
- time_t sc_secs; /* timeout period */
-
- - int expcnt;
- + int expcnt = 0;
- int expin;
- +#if 1
- + int logstr;
- + char *logstr_comment;
- + static char expbuf[MAX_EXPCT+1];
- +#else
- static char expbuf[MAX_EXPCT];
- +#endif
-
- dbgsave = Debug;
- curstate = begin;
- @@ -681,6 +726,12 @@
- * to a label entry
- */
- expin = 0;
- +#if 1
- + logstr = 0;
- +#endif
- +#ifdef __MINT__
- + waitcd = 0;
- +#endif
-
- for (curscr = curstate->next; /* point to 1st scr after label */
- (curscr != (struct script *)NULL) && /* do until end of scr */
- @@ -945,10 +996,25 @@
- DEBUG(DB_LGI, "Dialing, default timeout is %d millisecs\n", sc_dtmo);
- ttoslow(tempstr, 0, sc_chrdly);
- break;
- +
- +#if 1
- + case SC_LOGSTR:
- + logstr_comment = curscr->strprm;
- + logstr++;
- + break;
- +#endif
-
- +#ifdef __MINT__
- + case SC_CARR: /* they exist */
- + /* tell xgetc to wait for either a character or carrier */
- + waitcd++;
- + case SC_TIMO: /* these are "expects", don't bother */
- + case SC_XPCT: /* with them yet, other than noting that */
- +#else
- case SC_TIMO: /* these are "expects", don't bother */
- case SC_XPCT: /* with them yet, other than noting that */
- case SC_CARR: /* they exist */
- +#endif
- expcnt++;
- break;
- }
- @@ -1044,6 +1110,16 @@
- {
- charlog(curscr->strprm, curscr->intprm,
- DB_LGI, "Matched");
- +#if 1
- + if (logstr) {
- + while (expin > 0 &&
- + (expbuf[expin-1] == '\r' || expbuf[expin-1] == '\n'))
- + --expin;
- + expbuf[expin] = 0;
- + logit(logstr_comment, expbuf);
- + logstr = 0;
- + }
- +#endif
- goto _chgstate;
- }
- break;
- @@ -1115,8 +1191,36 @@
- if (setitimer (ITIMER_REAL, &stimer, (struct itimerval *) NULL) == 0)
- #endif
-
- +#ifdef __MINT__
- + /* on MiNT we do it with select() */
- + clock_t endtime = clock() + tmo * CLK_TCK;
- + struct timeval s = {0L, 50000L};
- + int rfds, result;
- +
- + /* ...wich actually is not `a' select but a loop of select()s because
- + there is a known bug in MiNT (up to 0.95 at least) that it doesn't
- + wake up a select when data becomes available on serial ports. */
- + do {
- + rfds = 1;
- + if ((result = select (0, &rfds, (int *) NULL, (int *) NULL, &s)) < 0 ||
- + ((long) endtime - (long) clock()) < 0 || (waitcd && ttcd())) {
- + /* if we timed out or the select gets an error get out. also if
- + we were waiting for CD and got it */
- + if (waitcd && ttcd())
- + waitcd = 0;
- + return '\377';
- + }
- +
- + /* else loop until we have data. */
- + } while (!result);
- +#endif
- +
- if(read(0, &c, 1) <= 0)
- c = '\377';
- +#ifdef __MINT__
- + else
- + c &= strip;
- +#endif
-
- #ifdef USE_ITIMER
- fSalarm_ok = FALSE;
- @@ -1216,6 +1320,186 @@
- }
- }
-
- +/* MiNT specific stuff... */
- +#ifdef __MINT__
- +/* points to 2 _IOREC structs that describe the port's read ([0]) and
- + write ([1]) buffers. (def'd in <ostruct.h>) */
- +static _IOREC *S_iorec;
- +
- +/* BIOS device no of the port: (used as index in the pollcd () routine)
- + 6 = modem1, 7 = modem2, 8 = serial1, 9 = serial2. */
- +static int S_biosdev;
- +
- +/* beware: never mv these devices if you want this stuff to work...
- + (there isn't yet a safer way to get the BIOS device no for a dev
- + name in MiNT.) */
- +static char *names[] = {"midi", "", "", "modem1", "modem2",
- + "serial1", "serial2", (char *) NULL};
- +
- +/* this gets the BIOS dev no and inits some variables for
- + fastread() + fastwrite() (if used). */
- +int map_biosdev (devname)
- +/* device name without the "/dev/" */
- +char *devname;
- +{
- + char **p;
- + long stack;
- +
- + S_iorec = 0;
- +
- + /* find the device */
- + for (p=names; *p; ++p)
- + if (!strcmp(devname, *p))
- + break;
- + /* if not found get out. */
- + if (!*p)
- + return 0;
- + S_biosdev = p - names + 3;
- + /* enter supervisor mode */
- + stack = Super (0L);
- + /* if the OS version is too old (TOS 1.0 doesn't have the xcon* vectors)
- + or can't set the device for Iorec(), get out. */
- + if ((*(OSHEADER **) _sysbase)->os_version < 0x102 ||
- + (S_biosdev != 3 && Bconmap (0) == 0l && !Bconmap (S_biosdev))) {
- + (void) Super (stack);
- + return 0;
- + }
- + S_iorec = Iorec (S_biosdev == 3 ? 2 : 0);
- + (void) Super (stack);
- + return S_biosdev;
- +}
- +
- +#if __GNUC__
- +/* macro to turn interrupts off, result is the original sr. */
- +#define intsoff() \
- +({ \
- + short retvalue; \
- + \
- + __asm__ volatile \
- + ("\
- + movw sr,%0; \
- + orw #0x700,sr; " \
- + : "=g"(retvalue) /* outputs */ \
- + : /* no inputs */ \
- + ); \
- + retvalue; \
- +})
- +
- +/* this turns them back on again, arg is the original sr */
- +#define intson(sr_) \
- +(void) ({ \
- + short _sr = (short) (sr_); \
- + \
- + __asm__ volatile \
- + ("\
- + movw %0,sr; " \
- + : /* no output */ \
- + : "g"(_sr) /* inputs */ \
- + ); \
- +})
- +#else /* !__GNUC__ */
- + #error "compiler-specific asm #defines"
- +#endif
- +
- +#if MINT_DTR || MINT_BREAK
- +/* set bits in scc register 5 */
- +void scc_or5 (control, or)
- +volatile char *control;
- +unsigned char or;
- +{
- + long stack;
- + short sr;
- + volatile char dummy;
- +
- + /* register 5 is normally WOM (write-only memory :-), but the driver
- + keeps a copy in the iorec. so if there is no iorec... */
- + if (!S_iorec)
- + return;
- +
- + /* enter super mode... */
- + stack = Super (0L);
- + /* interrupts off */
- + sr = intsoff();
- + dummy = *((volatile char *) 0xfffffa01);
- + *control = 5;
- + dummy = *((volatile char *) 0xfffffa01);
- + *control = (((char *) S_iorec)[0x1d] |= or);
- + intson (sr);
- + (void) Super (stack);
- +}
- +
- +/* same for clear... */
- +void scc_and5 (control, and)
- +volatile char *control;
- +unsigned char and;
- +{
- + long stack;
- + short sr;
- + volatile char dummy;
- +
- + /* (see above) */
- + if (!S_iorec)
- + return;
- +
- + /* enter super mode... */
- + stack = Super (0L);
- + /* interrupts off */
- + sr = intsoff();
- + dummy = *((volatile char *) 0xfffffa01);
- + *control = 5;
- + dummy = *((volatile char *) 0xfffffa01);
- + *control = (((char *) S_iorec)[0x1d] &= and);
- + intson (sr);
- + (void) Super (stack);
- +}
- +#endif /* MINT_DTR || MINT_BREAK */
- +
- +/* check the CD status on a serial port */
- +int pollcd (biosdev)
- +int biosdev;
- +{
- + unsigned char result;
- + volatile char dummy;
- + long stack;
- + short sr;
- +
- + switch (biosdev) {
- + case 1:
- + /* modem1 on STs that don't have Bconmap() */
- + /* fall thru */
- + case 6:
- + /* modem1 */
- + /* CD is !bit 1 on the 68901 GPIP port */
- + stack = Super (0L);
- + result = (1 << 1) & ~*((volatile char *) 0xfffffa01);
- + (void) Super (stack);
- + break;
- + case 7:
- + /* modem2 */
- + /* CD is bit 3 of read register 0 on SCC port B */
- + stack = Super (0L);
- + /* interrupts off */
- + sr = intsoff();
- + dummy = *((volatile char *) 0xfffffa01);
- + result = (1 << 3) & *((volatile char *) 0xffff8c85L);
- + intson (sr);
- + (void) Super (stack);
- + break;
- + case 8:
- + /* serial1 */
- + case 9:
- + /* serial2 */
- + /* MiNT 0.95 has the names of serial1 and 2 reversed on Mega STes
- + and they aren't real modem ports anyway, so for now we just
- + fall thru. */
- + default:
- + /* unknown port, assume CD always on. */
- + result = 1;
- + }
- + return result;
- +}
- +#endif /* __MINT__ */
- +
- /*
- * setup_tty()
- *
- @@ -1224,6 +1508,24 @@
- */
- static void setup_tty()
- {
- +#ifdef __MINT__
- + char *dev = ttyname(0);
- +
- + if (!strncmp("/dev/", dev, sizeof "/dev/" - 1))
- + dev += sizeof "/dev/" - 1;
- +
- + /* setup stuff for accessing DTR, CD etc */
- + map_biosdev (dev);
- +
- + ioctl(0, TIOCGETP, &old);
- +
- + new = old;
- +
- + new.sg_flags = RAW | ANYP | RTSCTS;
- +
- + if (old.sg_flags != new.sg_flags)
- + ioctl(0, TIOCSFLAGS, &new.sg_flags);
- +#else
- register int i;
-
- ioctl(0, TCGETA, &old);
- @@ -1238,6 +1540,7 @@
- new.c_lflag = 0; /* No special line discipline */
-
- ioctl(0, TCSETA, &new);
- +#endif
- }
-
- /*
- @@ -1246,7 +1549,12 @@
- static void restore_tty(sig)
- int sig;
- {
- +#if HAVE_BSD_TTY
- + if (old.sg_flags != new.sg_flags)
- + ioctl(0, TIOCSFLAGS, &old.sg_flags);
- +#else
- ioctl(0, TCSETA, &old);
- +#endif
- return;
- }
-
- @@ -1278,7 +1586,11 @@
- static void ttflui()
- {
- if(isatty(0))
- +#if HAVE_BSD_TTY
- + (void) ioctl ( 0, TIOCFLUSH, 0);
- +#else
- (void) ioctl ( 0, TCFLSH, 0);
- +#endif
- }
-
- /*
- @@ -1288,6 +1600,10 @@
- */
- static int ttcd()
- {
- +#ifdef __MINT__
- + if (S_iorec)
- + return pollcd (S_biosdev);
- +#endif
- return TRUE;
- }
-
- @@ -1296,7 +1612,55 @@
- */
- static void tthang()
- {
- - if(!isatty())
- +#ifdef __MINT__
- + struct sgttyb sbaud;
- +
- + if(!isatty(1))
- + return;
- +
- +#if MINT_DTR
- + /* MiNT 0.95 doesn't know how to drop DTR on modem2... */
- + if (S_iorec && S_biosdev == 7) {
- + volatile char *control = (volatile char *) 0xffff8c85L;
- +
- + /* DTR is bit 7 in register 5 */
- + scc_and5 (control, ~(1 << 7));
- +
- + /* sleep 30 ms... */
- + usleep (30000L);
- +
- + /* assert DTR */
- + scc_or5 (control, (1 << 7));
- +
- + /* Give the terminal a chance to settle. */
- + sleep (1);
- +
- + return;
- + }
- +#endif
- +
- + sbaud = new;
- +
- +#if HAVE_BSD_TTY
- + sbaud.sg_ispeed = B0;
- + sbaud.sg_ospeed = B0;
- +#else /* ! HAVE_BSD_TTY */
- + sbaud.c_cflag = (sbaud.c_cflag &~ CBAUD) | B0;
- +#endif /* ! HAVE_BSD_TTY */
- +
- + if (ioctl (1, TIOCSETP, &sbaud))
- + logit ("Can't hangup terminal:", strerror (errno));
- +
- + /* Give the terminal a chance to settle. */
- + sleep (1);
- +
- + if (ioctl (1, TIOCSETN, &new))
- + logit ("Can't reopen terminal:", strerror (errno));
- +
- + return;
- +#else
- +
- + if(!isatty(1))
- return;
-
- #ifdef TCCLRDTR
- @@ -1304,8 +1668,7 @@
- sleep (2);
- (void) ioctl (1, TCSETDTR, 0);
- #endif
- -
- - return;
- +#endif /* MINT */
- }
-
- /*
- @@ -1313,7 +1676,28 @@
- */
- static void ttbreak()
- {
- +#ifdef __MINT__
- +#if MINT_BREAK
- + /* MiNT 0.95 doesn't know how to send a break on modem2... */
- + if (S_iorec && S_biosdev == 7) {
- + volatile char *control = (volatile char *) 0xffff8c85L;
- +
- + /* bit 4 in register 5 is the break condition */
- + scc_or5 (control, (1 << 4));
- + sleep (1);
- + scc_and5 (control, ~(1 << 4));
- + return;
- + }
- +#endif
- +#endif
- +
- +#if HAVE_BSD_TTY
- + ioctl (1, TIOCSBRK, 0);
- + sleep (1);
- + ioctl (1, TIOCCBRK, 0);
- +#else
- (void) ioctl (1, TCSBRK, 0);
- +#endif /* HAVE_BSD_TTY */
- }
-
- /*
- @@ -1323,7 +1707,11 @@
- */
- static int ttblind()
- {
- +#if 1
- + return !ttcd();
- +#else
- return FALSE;
- +#endif
- }
-
- /*
- @@ -1332,6 +1720,9 @@
- static void tt7bit(enable)
- int enable;
- {
- +#ifdef __MINT__
- + strip = enable ? 0x7f : 0xff;
- +#else
- if(enable)
- new.c_iflag |= ISTRIP;
- else
- @@ -1338,6 +1729,7 @@
- new.c_iflag &= ~ISTRIP;
-
- ioctl(0, TCSETA, &new);
- +#endif
- }
-
- /*
- @@ -1346,6 +1738,27 @@
- static void ttpar(mode)
- int mode;
- {
- +#ifdef __MINT__
- + switch(mode)
- + {
- + case NONE:
- + new.sg_flags &= ~(EVENP | ODDP);
- + break;
- +
- + case EVEN:
- + new.sg_flags &= ~(EVENP | ODDP);
- + new.sg_flags |= EVENP;
- +
- + break;
- +
- + case ODD:
- + new.sg_flags &= ~(EVENP | ODDP);
- + new.sg_flags |= ODDP;
- + break;
- + }
- +
- + ioctl(0, TIOCSETP, &new);
- +#else
- switch(mode)
- {
- case NONE:
- @@ -1369,6 +1782,7 @@
- }
-
- ioctl(0, TCSETA, &new);
- +#endif /* !MINT */
- }
-
-
- diff -ru ./copy.c /src/t103/uucp-1.03/copy.c
- --- ./copy.c Tue Apr 7 06:05:20 1992
- +++ /src/t103/uucp-1.03/copy.c Wed Jan 6 20:08:30 1993
- @@ -58,6 +58,12 @@
- #include "system.h"
- #include "sysdep.h"
-
- +#ifdef __MINT__
- +/* make things a bit more efficient on slow GEMDOS */
- +#undef USE_STDIO
- +#define COPYBUF 0x4000
- +#endif
- +
- /* External functions. */
- extern int fclose ();
-
- @@ -139,7 +145,12 @@
- {
- int ofrom;
- int oto;
- +#ifdef __MINT__
- + /* save stackspace */
- + char *ab = xmalloc(COPYBUF);
- +#else
- char ab[8192];
- +#endif
- int c;
-
- ofrom = open (zfrom, O_RDONLY, 0);
- @@ -155,7 +166,11 @@
- oto = creat (zto, fpublic ? IPUBLIC_FILE_MODE : IPRIVATE_FILE_MODE);
- if (oto < 0)
- {
- +#ifdef __MINT__
- + if ((errno == ENOENT || errno == EPATH) && fmkdirs)
- +#else
- if (errno == ENOENT && fmkdirs)
- +#endif
- {
- if (! fsysdep_make_dirs (zto, fpublic))
- return FALSE;
- @@ -170,7 +185,11 @@
- }
- }
-
- +#ifdef __MINT__
- + while ((c = read (ofrom, ab, COPYBUF)) > 0)
- +#else
- while ((c = read (ofrom, ab, sizeof ab)) > 0)
- +#endif
- {
- if (write (oto, ab, c) != c)
- {
- @@ -183,6 +202,10 @@
- }
-
- (void) close (ofrom);
- +
- +#ifdef __MINT__
- + (void) xfree (ab);
- +#endif
-
- if (close (oto) < 0)
- {
- diff -ru ./makefile /src/t103/uucp-1.03/makefile
- --- ./makefile Tue Apr 7 06:31:54 1992
- +++ /src/t103/uucp-1.03/makefile Wed Jan 6 23:47:54 1993
- @@ -44,7 +44,7 @@
- # and the Taylor configuration files, comment out the following line
- # The tstuu program is only used to test the package; it is described
- # further in the documentation.
- -TSTUU = tstuu
- +TSTUU = tstuu.ttp
-
- #
- # The next few lines are set up by the configuration script. You may
- @@ -55,26 +55,38 @@
- # lines. This will install uudir as an suid root program. This is
- # necessary because invoking /bin/mkdir from an suid program will
- # leave the directories owned by the wrong user.
- -@UUDIR@UUDIR = uudir
- -@UUDIR@uudirdir = $(libdir)/util
- -@UUDIR@UUDIRFLAGS = -DUUDIR_PROGRAM=\"$(uudirdir)/$(UUDIR)\"
- +# UUDIR = uudir
- +# uudirdir = $(libdir)/util
- +# UUDIRFLAGS = -DUUDIR_PROGRAM=\"$(uudirdir)/$(UUDIR)\"
-
- # Source directory and, if necessary, VPATH
- -srcdir = @srcdir@
- -@VPATH@
- +srcdir = .
- +# @VPATH@
-
- # Define programs and flags
- -CC = @CC@
- -CFLAGS = @CFLAGS@
- -LDFLAGS = @LDFLAGS@
- -LIBS = @LIBS@
- -ALLOCA = @ALLOCA@
- +CC = gcc
- +# gcc 1.40:
- +#CFLAGS = -O -Wall -fcombine-regs -fomit-frame-pointer -fstrength-reduce
- +# LDFLAGS = @LDFLAGS@
- +#LIBS = -liio
- +
- +# gcc 2.3.1:
- +CFLAGS = -O2 -Wall -fomit-frame-pointer -fstrength-reduce
- +# LDFLAGS = @LDFLAGS@
- +LIBS = -liio
- +
- +# gcc 2.3.1 -mbaserel: (not yet)
- +#CFLAGS = -mbaserel -O2 -Wall -fomit-frame-pointer -fstrength-reduce
- +#LDFLAGS = -mbaserel
- +#LIBS = -lbiio
-
- -INSTALL = @INSTALL@
- +# ALLOCA = @ALLOCA@
- +
- +INSTALL = cp
- INSTALL_PROGRAM = $(INSTALL)
- -INSTALL_DATA = @INSTALLDATA@
- +INSTALL_DATA = $(INSTALL)
-
- -LN_S = @LN_S@
- +# LN_S = @LN_S@
-
- #
- # Nothing else to configure
- @@ -86,7 +98,7 @@
-
- MORECFLAGS = -I$(srcdir) -I. -DLIBDIR=\"$(libdir)\" -DNEWCONFIGLIB=\"$(newconfigdir)\" -DOLDCONFIGLIB=\"$(oldconfigdir)\" -DOWNER=\"$(owner)\" $(UUDIRFLAGS)
-
- -PROGRAMS = uucico uuxqt uux uucp uuchk uustat uuname uulog
- +PROGRAMS = uucico.ttp uuxqt.ttp uux.ttp uucp.ttp uuchk.ttp uustat.ttp uuname.ttp uulog.ttp
-
- UUOBJS = uucico.o prot.o protg.o protf.o prott.o prote.o config.o v2.o bnu.o \
- file.o util.o sysinf.o prtinf.o time.o log.o chat.o port.o tcp.o \
- @@ -117,7 +129,28 @@
-
- all: $(PROGRAMS) $(TSTUU) $(UUDIR)
-
- -install: $(PROGRAMS) uucp.info $(UUDIR)
- +# simple install for MiNT...
- +install: $(PROGRAMS)
- + -mkdir $(libdir) $(bindir)
- + $(INSTALL_PROGRAM) uucico.ttp $(libdir)/uucico.ttp
- + $(INSTALL_PROGRAM) uuxqt.ttp $(libdir)/uuxqt.ttp
- + $(INSTALL_PROGRAM) uuchk.ttp $(libdir)/uuchk.ttp
- + $(INSTALL_PROGRAM) uux.ttp $(bindir)/uux.ttp
- + $(INSTALL_PROGRAM) uucp.ttp $(bindir)/uucp.ttp
- + $(INSTALL_PROGRAM) uustat.ttp $(bindir)/uustat.ttp
- + $(INSTALL_PROGRAM) uuname.ttp $(bindir)/uuname.ttp
- + $(INSTALL_PROGRAM) uulog.ttp $(bindir)/uulog.ttp
- + xstrip $(libdir)/uucico.ttp
- + xstrip $(libdir)/uuxqt.ttp
- + xstrip $(libdir)/uuchk.ttp
- + xstrip $(bindir)/uux.ttp
- + xstrip $(bindir)/uucp.ttp
- + xstrip $(bindir)/uustat.ttp
- + xstrip $(bindir)/uuname.ttp
- + xstrip $(bindir)/uulog.ttp
- +
- +#install: $(PROGRAMS) uucp.info $(UUDIR)
- +install.ix: $(PROGRAMS) uucp.info $(UUDIR)
- -mkdir $(libdir) $(bindir)
- -ln $(libdir)/uucico $(libdir)/uucico.old
- -ln $(libdir)/uuxqt $(libdir)/uuxqt.old
- @@ -173,35 +206,35 @@
- -chmod 4555 $(bindir)/uux $(bindir)/uucp $(bindir)/uustat
- -chmod 4555 $(bindir)/uuname
-
- -uucico: $(UUOBJS)
- - $(CC) $(LDFLAGS) -o uucico $(UUOBJS) $(LIBS)
- +uucico.ttp: $(UUOBJS)
- + $(CC) $(LDFLAGS) -o uucico.ttp $(UUOBJS) $(LIBS)
-
- -uuxqt: $(XQTOBJS)
- - $(CC) $(LDFLAGS) -o uuxqt $(XQTOBJS) $(LIBS)
- +uuxqt.ttp: $(XQTOBJS)
- + $(CC) $(LDFLAGS) -o uuxqt.ttp $(XQTOBJS) $(LIBS)
-
- -uux: $(UUXOBJS)
- - $(CC) $(LDFLAGS) -o uux $(UUXOBJS) $(LIBS)
- +uux.ttp: $(UUXOBJS)
- + $(CC) $(LDFLAGS) -o uux.ttp $(UUXOBJS) $(LIBS)
-
- -uucp: $(UUCPOBJS)
- - $(CC) $(LDFLAGS) -o uucp $(UUCPOBJS) $(LIBS)
- +uucp.ttp: $(UUCPOBJS)
- + $(CC) $(LDFLAGS) -o uucp.ttp $(UUCPOBJS) $(LIBS)
-
- -uuchk: $(UUCHKOBJS)
- - $(CC) $(LDFLAGS) -o uuchk $(UUCHKOBJS) $(LIBS)
- +uuchk.ttp: $(UUCHKOBJS)
- + $(CC) $(LDFLAGS) -o uuchk.ttp $(UUCHKOBJS) $(LIBS)
-
- -uustat: $(UUSTATOBJS)
- - $(CC) $(LDFLAGS) -o uustat $(UUSTATOBJS) $(LIBS)
- +uustat.ttp: $(UUSTATOBJS)
- + $(CC) $(LDFLAGS) -o uustat.ttp $(UUSTATOBJS) $(LIBS)
-
- -uuname: $(UUNAMEOBJS)
- - $(CC) $(LDFLAGS) -o uuname $(UUNAMEOBJS) $(LIBS)
- +uuname.ttp: $(UUNAMEOBJS)
- + $(CC) $(LDFLAGS) -o uuname.ttp $(UUNAMEOBJS) $(LIBS)
-
- -uulog: $(UULOGOBJS)
- - $(CC) $(LDFLAGS) -o uulog $(UULOGOBJS) $(LIBS)
- +uulog.ttp: $(UULOGOBJS)
- + $(CC) $(LDFLAGS) -o uulog.ttp $(UULOGOBJS) $(LIBS)
-
- -tstuu: $(TSTOBJS)
- - $(CC) $(LDFLAGS) -o tstuu $(TSTOBJS) $(LIBS)
- +tstuu.ttp: $(TSTOBJS)
- + $(CC) $(LDFLAGS) -o tstuu.ttp $(TSTOBJS) # $(LIBS)
-
- -uudir: uudir.o
- - $(CC) $(LDFLAGS) -o uudir uudir.o $(LIBS)
- +uudir.ttp: uudir.o
- + $(CC) $(LDFLAGS) -o uudir.ttp uudir.o $(LIBS)
-
- .c.o:
- $(CC) -c $(CFLAGS) $(MORECFLAGS) $<
- @@ -208,16 +241,16 @@
-
- .SUFFIXES: .unx
-
- -sysdep.h: sysh.unx
- - rm -f sysdep.h
- - $(LN_S) sysh.unx sysdep.h
- -
- -.unx.c:
- - rm -f $@
- - $(LN_S) $< $@
- +# sysdep.h: sysh.unx
- +# rm -f sysdep.h
- +# $(LN_S) sysh.unx sysdep.h
- +
- +# .unx.c:
- +# rm -f $@
- +# $(LN_S) $< $@
-
- clean:
- - rm -f $(ALLOBJS) uucico uuxqt uux uucp uuchk tstuu
- + rm -f $(ALLOBJS) uucico.ttp uuxqt.ttp uux.ttp uucp.ttp uuchk.ttp tstuu.ttp
- rm -f uucp-$(VERSION).tar.Z
- rm -rf uucp-$(VERSION)
-
- diff -ru ./policy.h /src/t103/uucp-1.03/policy.h
- --- ./policy.h Tue Apr 7 06:31:54 1992
- +++ /src/t103/uucp-1.03/policy.h Wed Sep 16 14:21:56 1992
- @@ -89,7 +89,7 @@
- HAVE_SYSV_TERMIO -- Use the System V termio routines
- HAVE_POSIX_TERMIOS -- Use the POSIX termios routines
- */
- -#define HAVE_BSD_TTY 0
- +#define HAVE_BSD_TTY 1
- #define HAVE_SYSV_TERMIO 0
- #define HAVE_POSIX_TERMIOS 0
-
- @@ -136,7 +136,7 @@
- is too large, data loss may occur. If SINGLE_WRITE is too small,
- file transfer will use more CPU time than necessary. If you have
- no idea, 64 should work on most modern systems. */
- -#define SINGLE_WRITE 64
- +#define SINGLE_WRITE 128
-
- /* Set TIMES_TICK to the fraction of a second which times(2) returns
- (for example, if times returns 100ths of a second TIMES_TICK should
- @@ -159,7 +159,7 @@
- although some may complain about the 'p' option. The second set of
- definitions are appropriate for System V. To use the second set of
- definitions, change the ``#if 1'' to ``#if 0''. */
- -#if 1
- +#if 0
- #define PS_PROGRAM "/bin/ps -lp"
- #define HAVE_PS_MULTIPLE 0
- #else
- @@ -264,7 +264,7 @@
- configuration files will be read first, followed by the V2
- configuration files, followed by the BNU configuration files. */
- #define HAVE_V2_CONFIG 0
- -#define HAVE_BNU_CONFIG 0
- +#define HAVE_BNU_CONFIG 1
-
- /* Exactly one of the following macros must be set to 1. The exact
- format of the spool directories is explained in sys3.unx.
- @@ -281,9 +281,9 @@
- #define SPOOLDIR_V2 0
- #define SPOOLDIR_BSD42 0
- #define SPOOLDIR_BSD43 0
- -#define SPOOLDIR_BNU 0
- +#define SPOOLDIR_BNU 1
- #define SPOOLDIR_ULTRIX 0
- -#define SPOOLDIR_TAYLOR 1
- +#define SPOOLDIR_TAYLOR 0
-
- /* You must select which type of logging you want by setting exactly
- one of the following to 1. These control output to the log file
- @@ -332,7 +332,7 @@
- exist when a new message is written out, it will be created.
- Setting CLOSE_LOGFILES to 1 will obviously require slightly more
- processing time. */
- -#define CLOSE_LOGFILES 0
- +#define CLOSE_LOGFILES 1
-
- /* The name of the default spool directory. If HAVE_TAYLOR_CONFIG is
- set to 1, this may be overridden by the ``spool'' command in the
- @@ -379,7 +379,7 @@
- ``remote-receive'')
- the command will be rejected. By default, any argument is
- permitted. */
- -#define ALLOW_FILENAME_ARGUMENTS 1
- +#define ALLOW_FILENAME_ARGUMENTS 0
-
- #if HAVE_TAYLOR_LOGGING
-
- diff -ru ./protg.c /src/t103/uucp-1.03/protg.c
- --- ./protg.c Tue Apr 7 07:05:24 1992
- +++ /src/t103/uucp-1.03/protg.c Wed Jan 6 20:58:32 1993
- @@ -1167,10 +1167,9 @@
- }
- else
- {
- - /* The read timed out. If we're looking for a control
- - packet, assume we're looking for an ack and send the last
- - unacknowledged packet again. Otherwise, send an RJ with
- - the last packet we received correctly. */
- + /* The read timed out. If we have an unacknowledged packet,
- + send it again. Otherwise, send an RJ with the last
- + packet we received correctly. */
-
- ++ctimeouts;
- if (ctimeouts > cretries)
- @@ -1180,8 +1179,7 @@
- return FALSE;
- }
-
- - if (freturncontrol
- - && INEXTSEQ (iGremote_ack) != iGsendseq)
- + if (INEXTSEQ (iGremote_ack) != iGsendseq)
- {
- int inext;
-
- @@ -1346,6 +1344,7 @@
- unsigned short ihdrcheck, idatcheck;
- const char *zfirst, *zsecond;
- int cfirst, csecond;
- + boolean fduprr;
-
- /* Look for the DLE which must start a packet. */
-
- @@ -1577,6 +1576,20 @@
- /* Store the control byte for the handshake routines. */
- iGpacket_control = ab[IFRAME_CONTROL] & 0xff;
-
- + /* Annoyingly, some UUCP packages appear to send an RR packet
- + rather than an RJ packet when they want a packet to be
- + resent. If we get a duplicate RR, we treat it as an RJ. */
- + fduprr = FALSE;
- + if (CONTROL_TT (ab[IFRAME_CONTROL]) == CONTROL
- + && CONTROL_XXX (ab[IFRAME_CONTROL]) == RR
- + && iGremote_ack == CONTROL_YYY (ab[IFRAME_CONTROL])
- + && INEXTSEQ (iGremote_ack) != iGsendseq)
- + {
- + DEBUG_MESSAGE0 (DEBUG_PROTO | DEBUG_ABNORMAL,
- + "fgprocess_data: Treating duplicate RR as RJ");
- + fduprr = TRUE;
- + }
- +
- /* Update the received sequence number from the yyy field of a
- data packet or an RR control packet. If we've been delaying
- sending packets until we received an ack, this may send out
- @@ -1748,6 +1761,12 @@
- (void) fgsend_control (CLOSE, 0);
- }
- return FALSE;
- + case RR:
- + /* Acknowledge receipt of a packet. This was already handled
- + above, unless we are treating it as RJ. */
- + if (! fduprr)
- + break;
- + /* Fall through. */
- case RJ:
- /* The other side dropped a packet. Begin retransmission with
- the packet following the one acknowledged. We don't
- @@ -1794,10 +1813,6 @@
- if (! fsend_data (zpack, CFRAMELEN + CPACKLEN (zpack), TRUE))
- return FALSE;
- }
- - break;
- - case RR:
- - /* Acknowledge receipt of a packet. This was already handled
- - above. */
- break;
- case INITC:
- case INITB:
- diff -ru ./sys1.c /src/t103/uucp-1.03/sys1.c
- --- ./sys1.c Tue Apr 7 06:05:26 1992
- +++ /src/t103/uucp-1.03/sys1.c Wed Jan 6 20:06:22 1993
- @@ -402,6 +402,16 @@
- #endif
- #endif /* ! HAVE_UNION_WAIT */
-
- +#ifdef __MINT__
- +/* bigger stack for all those alloca()s... (sys1.o is liked everywhere) */
- +long _stksize = 0x8000;
- +extern int __mint;
- +
- +#include <setjmp.h>
- +#include <ctype.h>
- +#include <osbind.h>
- +#endif
- +
- /* External variables. */
- extern char **environ;
-
- @@ -464,7 +474,12 @@
- int cSysdep_max_name_len = 7;
- #endif /* SPOOLDIR_V2 | SPOOLDIR_BSD42 | SPOOLDIR_BSD43 | SPOOLDIR_ULTRIX */
- #if SPOOLDIR_BNU
- +#ifdef __MINT__
- +/* MiNT's default filesystem is still messdos-like... */
- +int cSysdep_max_name_len = 7;
- +#else
- int cSysdep_max_name_len = 14;
- +#endif
- #endif /* SPOOLDIR_BNU */
- #if SPOOLDIR_TAYLOR
- #if HAVE_LONG_NAMES
- @@ -536,6 +551,13 @@
- systems truncate the getlogin return value to 8 characters, but
- keep the full name in the password file, so we prefer the name in
- the password file. */
- +#ifdef __MINT__
- + /* hmmm... */
- + _malloczero(1);
- +
- + /* if we're root, prefer the name in $USER. */
- + if (getuid() || !(z = getenv ("USER")))
- +#endif
- z = getlogin ();
- if (z == NULL)
- q = NULL;
- @@ -556,6 +578,10 @@
-
- if (fdaemon)
- {
- +#ifdef __MINT__
- + if (__mint < 95)
- + ulog (LOG_FATAL, "need MiNT >= 0.95 to run! (on your friendly neighbour archive site :-)");
- +#endif
- /* Set our uid to our effective uid. There is no point in
- remembering who originally ran the program. This won't work
- on System V, but there's nothing to be done about that and it
- @@ -618,11 +644,19 @@
- exist. */
- if (chdir (zSpooldir) < 0)
- {
- +#ifdef __MINT__
- + if (errno != ENOENT && errno != EPATH)
- +#else
- if (errno != ENOENT)
- +#endif
- ulog (LOG_FATAL, "chdir (%s): %s", zSpooldir,
- strerror (errno));
- usmake_spool_dir ();
- }
- +#ifdef __MINT__
- + /* make sure freads from stdin are binary... */
- + stdin->_flag |= _IOBIN;
- +#endif
- }
-
- /* Exit the program. */
- @@ -666,6 +700,22 @@
- #define HAVE_TIOCNOTTY 0
- #endif
-
- +#ifdef __MINT__
- +/* on MiNT fork and vfork both block until the child does either exec or
- + dies. only tfork doesn't block but it works like a subroutine call... */
- +static jmp_buf tforkj;
- +
- +static int in_tfork(arg)
- +int arg;
- +{
- + /* wait for parent to die before we can longjmp back */
- + while (getppid () > 1)
- + sleep (1);
- + longjmp (tforkj, 1);
- + /*NOTREACHED*/
- +}
- +#endif
- +
- void
- usysdep_detach ()
- {
- @@ -694,6 +744,15 @@
- die. */
- usset_signal (SIGHUP, SIG_IGN, FALSE, &fignored);
-
- +#ifdef __MINT__
- + if (!setjmp(tforkj)) {
- + ipid = tfork (in_tfork, 0);
- + if (ipid < 0)
- + ulog (LOG_FATAL, "tfork: %s", strerror (errno));
- + else
- + _exit (EXIT_SUCCESS);
- + }
- +#else
- ipid = isfork ();
- if (ipid < 0)
- ulog (LOG_FATAL, "fork: %s", strerror (errno));
- @@ -706,6 +765,7 @@
- reenabling SIGHUP. */
- while (getppid () != 1)
- sleep (1);
- +#endif
-
- /* Restore SIGHUP catcher if it wasn't being ignored. */
- if (! fignored)
- @@ -723,11 +783,26 @@
-
- /* Reopen stdin, stdout and stderr. */
-
- +#ifdef __MINT__
- + /* i don't think open will _ever_ return fds < 6 on TOS/MiNT... */
- + { int nullfd = open ("/dev/null", O_RDWR);
- +
- + if (nullfd < 0 || dup2(nullfd, 0) < 0
- + || dup2(nullfd, 1) < 0 || dup2(nullfd, 2) < 0)
- + ulog (LOG_FATAL, "open (/dev/null): %s", strerror (errno));
- + }
- +#else
- if (open ("/dev/null", O_RDONLY) != 0
- || open ("/dev/null", O_WRONLY) != 1
- || open ("/dev/null", O_WRONLY) != 2)
- ulog (LOG_FATAL, "open (/dev/null): %s", strerror (errno));
- +#endif
-
- +#ifdef __MINT__
- +/* getpgrp() on MiNT has no args but setpgrp has 2... */
- +#undef HAVE_BSD_PGRP
- +#define HAVE_BSD_PGRP 1
- +#endif
- #if HAVE_BSD_PGRP
-
- #if HAVE_TIOCNOTTY
- @@ -811,7 +886,13 @@
- {
- #if HAVE_GETHOSTNAME
- char ab[256];
- +#ifdef __MINT__
- + char *p;
-
- + /* other uucp stuff has it in $SITENAME */
- + if (p=getenv("SITENAME"))
- + return p;
- +#endif
- if (gethostname (ab, sizeof ab) < 0)
- {
- ulog (LOG_ERROR, "gethostname: %s", strerror (errno));
- @@ -871,6 +952,10 @@
- z = ttyname (0);
- if (z == NULL)
- return NULL;
- +#ifdef __MINT__
- + if (z[1] == ':' && (*z | 0x20) == 'u')
- + z += 2;
- +#endif
- if (strncmp (z, "/dev/", 5) == 0)
- return z + 5;
- else
- @@ -1093,6 +1178,11 @@
-
- if (itick == 0)
- {
- +/* hmm. gcc barfs on the #if TIMES_TICK != 0 below when TIMES_TICK
- + is ((clock_t) 200) */
- +#ifdef __MINT__
- + itick = TIMES_TICK;
- +#else
- #if TIMES_TICK != 0
- itick = TIMES_TICK;
- #else /* TIMES_TICK == 0 */
- @@ -1106,6 +1196,7 @@
- if (itick == 0)
- itick = 60;
- #endif /* TIMES_TICK == 0 */
- +#endif
- }
-
- i = (long) times (&s);
- @@ -1187,7 +1278,11 @@
-
- if (o < 0)
- {
- +#ifdef __MINT__
- + if ((errno == ENOENT || errno == EPATH) && fmkdirs)
- +#else
- if (errno == ENOENT && fmkdirs)
- +#endif
- {
- if (! fsysdep_make_dirs (zfile, fpublic))
- return NULL;
- @@ -1224,10 +1319,17 @@
- #endif /* defined (O_APPEND) */
- #endif /* ! defined (O_CREAT) */
-
- +#ifdef __MINT__
- if (fappend)
- + e = fdopen (o, (char *) "ab");
- + else
- + e = fdopen (o, (char *) "wb");
- +#else
- + if (fappend)
- e = fdopen (o, (char *) "a");
- else
- e = fdopen (o, (char *) "w");
- +#endif
-
- if (e == NULL)
- {
- @@ -1260,7 +1362,15 @@
- {
- char *zcopy, *z;
- int imode;
- +#ifdef __MINT__
- + char *p, ch;
-
- + if (p = (char *) zfile)
- + for (; ch = *p; ++p)
- + if (ch == '\\')
- + *p = '/';
- +#endif
- +
- zcopy = (char *) alloca (strlen (zfile) + 1);
- strcpy (zcopy, zfile);
-
- @@ -1302,6 +1412,14 @@
- static char *zalc;
- const char *zdir;
- int clen;
- +#ifdef __MINT__
- + char *p, ch;
- +
- + if (p = (char *) zfile)
- + for (; ch = *p; ++p)
- + if (ch == '\\')
- + *p = '/';
- +#endif
-
- if (zfile[0] != '~')
- return zfile;
- @@ -1349,6 +1467,13 @@
- }
- }
-
- +#ifdef __MINT__
- + if (p = (char *) zdir)
- + for (; ch = *p; ++p)
- + if (ch == '\\')
- + *p = '/';
- +#endif
- +
- clen = strlen (zdir) + strlen (zfile) + 2;
- if (clen > calc)
- {
- @@ -1532,6 +1657,18 @@
- int c;
- char *zcopy, *zslash;
- struct stat s;
- +#ifdef __MINT__
- + char *p, ch;
- +
- + if (p = (char *) zfile)
- + for (; ch = *p; ++p)
- + if (ch == '\\')
- + *p = '/';
- + if (p = (char *) zdir)
- + for (; ch = *p; ++p)
- + if (ch == '\\')
- + *p = '/';
- +#endif
-
- if (*zdir == '~')
- {
- @@ -1542,9 +1679,43 @@
- c = strlen (zdir);
- if (zdir[c - 1] == '/')
- c--;
- +#ifdef __MINT__
- + if (strncmp (zfile, zdir, c) != 0) {
- + char *abs = (char *) zdir, buf[0x101];
- + int l = c, linkl;
- +
- + /* on MiNT the `normal' A:, C: etc filesystems are mounted as /a, /c.
- + the only way to get them into the root as something else (say, /usr)
- + is via symlinks... check that also. */
- + if (!*zdir)
- + return FALSE;
- + if (zslash = strchr (zdir+1, '/')) {
- + l = zslash-zdir;
- + abs = alloca (l+1);
- + strncpy (abs, zdir, l);
- + abs[l] = 0;
- + }
- + if ((linkl = readlink (abs, buf, sizeof buf)) <= 0)
- + return FALSE;
- + if (buf[1] == ':') {
- + buf[1] = buf[0] | 0x20;
- + *buf = '/';
- + }
- + if (buf[linkl-1] == '/')
- + --linkl;
- + if (strncmp (zfile, buf, linkl) ||
- + strncmp (zfile+linkl, zslash, c-l))
- + return FALSE;
- +
- + c = c - l + linkl;
- + }
- + if (zfile[c] != '/' && zfile[c] != '\0')
- + return FALSE;
- +#else
- if (strncmp (zfile, zdir, c) != 0
- || (zfile[c] != '/' && zfile[c] != '\0'))
- return FALSE;
- +#endif
- if (strstr (zfile + c, "/../") != NULL)
- return FALSE;
-
- @@ -1639,8 +1810,17 @@
- int aidescs[3];
- pid_t ipid;
-
- +#ifdef __MINT__
- + zlib = (char *) alloca (sizeof LIBDIR + sizeof "/.ttp" + strlen (zprogram));
- + sprintf (zlib, "%s/%s", LIBDIR, zprogram);
- +
- + /* if zprogram does not exist then try with .ttp */
- + if (access (zlib, F_OK))
- + strcat (zlib, ".ttp");
- +#else
- zlib = (char *) alloca (sizeof LIBDIR + sizeof "/" + strlen (zprogram));
- sprintf (zlib, "%s/%s", LIBDIR, zprogram);
- +#endif
-
- azargs[0] = zlib;
- azargs[1] = zarg1;
- @@ -1779,6 +1959,8 @@
- xmkdir (PRESERVEDIR);
- }
-
- +/* MiNT doesn't need this. (we always use vfork) */
- +#ifndef __MINT__
- /* Retry fork several times before giving up. */
-
- pid_t
- @@ -1797,6 +1979,7 @@
-
- return iret;
- }
- +#endif
-
- /* Spawn a child in a fairly secure fashion. This returns the process
- ID of the child or -1 on error. It takes far too many arguments:
- @@ -1840,7 +2023,11 @@
- {
- char *zshcmd = NULL;
- int i;
- +#ifdef __MINT__
- + char *azenv[25];
- +#else
- char *azenv[9];
- +#endif
- char **pazenv;
- boolean ferr;
- int ierr = 0;
- @@ -1896,6 +2083,15 @@
- sprintf (azenv[2], "TERM=%s", zterm);
-
- azenv[3] = (char *) "SHELL=/bin/sh";
- +#ifdef __MINT__
- + /* on MiNT people don't always have a shell in /bin/sh */
- + ztz = getenv ("SHELL");
- + if (ztz != NULL)
- + {
- + azenv[3] = (char *) alloca (sizeof "SHELL=" + strlen (ztz));
- + sprintf (azenv[3], "SHELL=%s", ztz);
- + }
- +#endif
-
- azenv[4] = (char *) alloca (sizeof "USER=" + strlen (OWNER));
- sprintf (azenv[4], "USER=%s", OWNER);
- @@ -1910,6 +2106,81 @@
- ++ienv;
- }
-
- +#ifdef __MINT__
- + /* the next 10 are used by TOS uucp stuff... */
- +
- + ztz = getenv ("TEMP");
- + if (ztz != NULL)
- + {
- + azenv[ienv] = (char *) alloca (sizeof "TEMP=" + strlen (ztz));
- + sprintf (azenv[ienv], "TEMP=%s", ztz);
- + ++ienv;
- + }
- + ztz = getenv ("TMPDIR");
- + if (ztz != NULL)
- + {
- + azenv[ienv] = (char *) alloca (sizeof "TMPDIR=" + strlen (ztz));
- + sprintf (azenv[ienv], "TMPDIR=%s", ztz);
- + ++ienv;
- + }
- + ztz = getenv ("TMP");
- + if (ztz != NULL)
- + {
- + azenv[ienv] = (char *) alloca (sizeof "TMP=" + strlen (ztz));
- + sprintf (azenv[ienv], "TMP=%s", ztz);
- + ++ienv;
- + }
- + ztz = getenv ("TEMPDIR");
- + if (ztz != NULL)
- + {
- + azenv[ienv] = (char *) alloca (sizeof "TEMPDIR=" + strlen (ztz));
- + sprintf (azenv[ienv], "TEMPDIR=%s", ztz);
- + ++ienv;
- + }
- + ztz = getenv ("ETC");
- + if (ztz != NULL)
- + {
- + azenv[ienv] = (char *) alloca (sizeof "ETC=" + strlen (ztz));
- + sprintf (azenv[ienv], "ETC=%s", ztz);
- + ++ienv;
- + }
- + ztz = getenv ("USR");
- + if (ztz != NULL)
- + {
- + azenv[ienv] = (char *) alloca (sizeof "USR=" + strlen (ztz));
- + sprintf (azenv[ienv], "USR=%s", ztz);
- + ++ienv;
- + }
- + ztz = getenv ("NEWS");
- + if (ztz != NULL)
- + {
- + azenv[ienv] = (char *) alloca (sizeof "NEWS=" + strlen (ztz));
- + sprintf (azenv[ienv], "NEWS=%s", ztz);
- + ++ienv;
- + }
- + ztz = getenv ("SITENAME");
- + if (ztz != NULL)
- + {
- + azenv[ienv] = (char *) alloca (sizeof "SITENAME=" + strlen (ztz));
- + sprintf (azenv[ienv], "SITENAME=%s", ztz);
- + ++ienv;
- + }
- + ztz = getenv ("DOMAIN");
- + if (ztz != NULL)
- + {
- + azenv[ienv] = (char *) alloca (sizeof "DOMAIN=" + strlen (ztz));
- + sprintf (azenv[ienv], "DOMAIN=%s", ztz);
- + ++ienv;
- + }
- + ztz = getenv ("ORGANIZATION");
- + if (ztz != NULL)
- + {
- + azenv[ienv] = (char *) alloca (sizeof "ORGANIZATION=" + strlen (ztz));
- + sprintf (azenv[ienv], "ORGANIZATION=%s", ztz);
- + ++ienv;
- + }
- +#endif
- +
- if (zuu_machine != NULL)
- {
- azenv[ienv] = (char *) alloca (sizeof "UU_MACHINE="
- @@ -2002,7 +2273,12 @@
- if (! ferr)
- {
- /* This should really be vfork if available. */
- +#ifdef __MINT__
- + /* especially on systems without virtual memory... like MiNT :-) */
- + iret = vfork ();
- +#else
- iret = isfork ();
- +#endif
- if (iret < 0)
- {
- ferr = TRUE;
- @@ -2084,6 +2360,10 @@
- {
- char *zto;
- const char *azshargs[4];
- +#ifdef __MINT__
- + /* on MiNT people don't always have a shell in /bin/sh */
- + char *shell = getenv("SHELL");
- +#endif
-
- pazargs[0] = zcmd;
- zto = zshcmd;
- @@ -2098,7 +2378,12 @@
- don't know exactly when this happens (I can recreate
- it on Ultrix 4.0), but in any case it is harmless to
- not quote a '/'. */
- +#ifdef __MINT__
- + /* some (TOS) shells are even worse. :-( */
- + if (!strchr("/.-_", *zfrom) && !isalnum(*zfrom))
- +#else
- if (*zfrom != '/')
- +#endif
- *zto++ = '\\';
- *zto++ = *zfrom;
- }
- @@ -2111,6 +2396,12 @@
- azshargs[2] = zshcmd;
- azshargs[3] = NULL;
-
- +#ifdef __MINT__
- + if (shell) {
- + azshargs[0] = shell;
- + (void) execve ((char *) shell, (char **) azshargs, pazenv);
- + } else
- +#endif
- (void) execve ((char *) "/bin/sh", (char **) azshargs, pazenv);
- }
-
- diff -ru ./sys2.c /src/t103/uucp-1.03/sys2.c
- --- ./sys2.c Tue Apr 7 06:05:26 1992
- +++ /src/t103/uucp-1.03/sys2.c Thu Dec 24 17:36:22 1992
- @@ -428,6 +428,70 @@
- | ISIG | NOFLSH | TOSTOP)
- #endif
-
- +#ifdef __MINT__
- +/* try to use own fast versions of (RAW) read() and write() on serial
- + ports. the ones in (current) MiNT are so inefficient they can't keep
- + up with data coming in at full 19200 even on a 16MHz CPU. :-( at
- + least i never got more than ~1750 cps with g(7,2048) on a (raw) 16800
- + + V.42 link... (no, data doesn't get lost as long as you have
- + working handshaking, its just that the link isn't saturated and
- + german telecom charges are high enough already. with this stuff i
- + now get more than 1900 cps on the same link, and nearly 2000 (V.42,
- + no compression!) on modem2 with 38400 bps...)
- +
- + note: because this makes subtle assumptions on how the BIOS serial
- + drivers work there might be problems with serial `patch' programs.
- + but, to tell you the truth, few of them do it right anyway... (the
- + only ones i trust are serialfx 1.0 (but only if only have or use
- + modem1) and ataris serptch2 for the other ports. (wich still doesn't
- + fix all bugs on modem1, as well as the `new and improved' TOS 2.06...)
- + if you know more (that really work!), tell me.)
- +
- + 2nd note: i don't mind if you use this in other programs, but i do
- + ask that you always include the source (well you probably have to
- + anyway, see COPYING :-) because this is such a hack that everyone
- + should have the possiblity to look at it and maybe debug it (or turn
- + it off) if it doesn't work on his machine. and if you do find bugs
- + or make improvements please mail me at nox@jelal.north.de. thanx!
- +*/
- +
- +/* make these 0 to turn off */
- +#define MINT_FASTREAD 1
- +#define MINT_FASTWRITE 1
- +
- +/* make this 0 when you have a MiNT version that knows how to send a
- + break on modem2, or when my version doesn't work because your driver
- + doesn't keep a copy of the port's SCC register 5 in the iorec (see
- + scc_or5). this will only be used when MINT_FASTREAD or WRITE are set. */
- +#define MINT_BREAK 1
- +
- +/* ditto for dropping DTR */
- +#define MINT_DTR 1
- +
- +#include <mintbind.h>
- +#include <ostruct.h>
- +#include <sysvars.h>
- +
- +/* not (yet) in sysvars.h:
- + (these are really arrays of function pointers, but can't be called
- + that way because they might clobber too much registers.) */
- +#define xconin ((long *) 0x53e)
- +#define xconout ((long *) 0x57e)
- +
- +/* still necessary at least with MiNT 0.95: */
- +#ifndef RTSCTS
- +#define RTSCTS 0x2000
- +#endif
- +
- +#else /* !__MINT__ */
- +
- +#define MINT_FASTREAD 0
- +#define MINT_FASTWRITE 0
- +#define MINT_BREAK 0
- +#define MINT_DTR 0
- +
- +#endif /* __MINT__ */
- +
- /* External functions. */
- extern char *strlwr ();
- extern int close (), pipe (), dup2 (), read (), write ();
- @@ -539,7 +603,11 @@
-
- /* Use the BSD sigblock and sigsetmask calls. */
-
- +#ifdef __MINT__
- +extern long sigblock (), sigsetmask ();
- +#else
- extern int sigblock (), sigsetmask ();
- +#endif
-
- #define HELD_SIG_MASK int
-
- @@ -639,6 +707,546 @@
- #endif /* ! HAVE_NAPMS && ! HAVE_NAP && ! HAVE_USLEEP */
- }
-
- +#ifdef __MINT__
- +
- +/* name of the device currently open (set in fsserial_open) */
- +static const char *S_opendev;
- +
- +/* flag that we set modem2 to 38400 by hand (so we can restore it on close) */
- +static int S_modem2_38k4;
- +
- +/* points to 2 _IOREC structs that describe the port's read ([0]) and
- + write ([1]) buffers. (def'd in <ostruct.h>) */
- +static _IOREC *S_iorec;
- +
- +/* flag that we should watch the CD line (MiNT doesn't yet send SIGHUP...) */
- +static int S_fwatchcd;
- +
- +/* BIOS device no of the port: (used as index in the pollcd () routine)
- + 6 = modem1, 7 = modem2, 8 = serial1, 9 = serial2. */
- +static int S_biosdev;
- +
- +/* pointer to driver functions that read/write a character */
- +static long S_biosread;
- +static long S_bioswrite;
- +
- +/* beware: never mv these devices if you want this stuff to work...
- + (there isn't yet a safer way to get the BIOS device no for a dev
- + name in MiNT.) */
- +static char *names[] = {"midi", "", "", "modem1", "modem2",
- + "serial1", "serial2", (char *) NULL};
- +
- +/* this gets the BIOS dev no and inits some variables for
- + fastread() + fastwrite() (if used). */
- +int map_biosdev (devname)
- +/* device name without the "/dev/" */
- +char *devname;
- +{
- + char **p;
- + long stack;
- +
- + S_iorec = 0;
- +
- + /* find the device */
- + for (p=names; *p; ++p)
- + if (!strcmp(devname, *p))
- + break;
- + /* if not found get out. */
- + if (!*p)
- + return 0;
- + S_biosdev = p - names + 3;
- + /* enter supervisor mode */
- + stack = Super (0L);
- + /* if the OS version is too old (TOS 1.0 doesn't have the xcon* vectors)
- + or can't set the device for Iorec(), get out. */
- + if ((*(OSHEADER **) _sysbase)->os_version < 0x102 ||
- + (S_biosdev != 3 && Bconmap (0) == 0l && !Bconmap (S_biosdev))) {
- + (void) Super (stack);
- + return 0;
- + }
- + S_iorec = Iorec (S_biosdev == 3 ? 2 : 0);
- + S_biosread = xconin[S_biosdev == 3 ? 3 : 1];
- + S_bioswrite = xconout[S_biosdev == 3 ? 3 : 1];
- + (void) Super (stack);
- + if (!S_biosread || !S_bioswrite)
- + S_iorec = (_IOREC *) NULL;
- + return S_biosdev;
- +}
- +
- +#if __GNUC__
- +/* macro to turn interrupts off, result is the original sr. */
- +#define intsoff() \
- +({ \
- + short retvalue; \
- + \
- + __asm__ volatile \
- + ("\
- + movw sr,%0; \
- + orw #0x700,sr; " \
- + : "=g"(retvalue) /* outputs */ \
- + : /* no inputs */ \
- + ); \
- + retvalue; \
- +})
- +
- +/* this turns them back on again, arg is the original sr */
- +#define intson(sr_) \
- +(void) ({ \
- + short _sr = (short) (sr_); \
- + \
- + __asm__ volatile \
- + ("\
- + movw %0,sr; " \
- + : /* no output */ \
- + : "g"(_sr) /* inputs */ \
- + ); \
- +})
- +#else /* !__GNUC__ */
- + #error "compiler-specific asm #defines"
- +#endif
- +
- +/* this is used to program the 85c30 SCC... */
- +void sccset (control, tab, size)
- +volatile char *control;
- +char *tab;
- +int size;
- +{
- + short sr;
- + long stack = Super(0l);
- + volatile char dummy;
- +
- + sr = intsoff();
- + while (size--) {
- + dummy = *((volatile char *) 0xfffffa01);
- + *control = *tab++;
- + }
- + intson (sr);
- + (void) Super (stack);
- +}
- +
- +#if MINT_FASTREAD || MINT_FASTWRITE
- +#if __GNUC__
- +/* macro to call thru a xcon* vector. we can tell gcc directly that it
- + clobbers d0-d7 and a0-a5, only the frame pointer in a6 we must take
- + care of ourselves.
- + correction: gcc 2.2.2 also wants the reg.s it passes args in unchanged */
- +
- +#define xcon_exec(add, ch) \
- +({ \
- + register long retvalue __asm__("d0"); \
- + long _add = (long) (add); \
- + long _ch = (long) (ch); \
- + \
- + __asm__ volatile \
- + ("\
- + movml a5-a6/d7,sp@-; \
- + movl %2,sp@-; \
- + jsr %1@; \
- + addql #4,sp; \
- + movml sp@+,a5-a6/d7; " \
- + : "=r"(retvalue) /* outputs */ \
- + : "a"(_add), "d"(_ch) /* inputs */ \
- + : "d1", "d2", "d3", "d4", "d5", "d6", \
- + "a0", "a1", "a2", "a3", "a4" /* clobbered regs */ \
- + ); \
- + retvalue; \
- +})
- +#else /* !__GNUC__ */
- + #error "isn't gcc a wonderful compiler? :-)"
- +#endif
- +
- +#if MINT_DTR || MINT_BREAK
- +/* set bits in scc register 5 */
- +void scc_or5 (control, or)
- +volatile char *control;
- +unsigned char or;
- +{
- + long stack;
- + short sr;
- + volatile char dummy;
- +
- + /* register 5 is normally WOM (write-only memory :-), but the driver
- + keeps a copy in the iorec. so if there is no iorec... */
- + if (!S_iorec)
- + return;
- +
- + /* enter super mode... */
- + stack = Super (0L);
- + /* interrupts off */
- + sr = intsoff();
- + dummy = *((volatile char *) 0xfffffa01);
- + *control = 5;
- + dummy = *((volatile char *) 0xfffffa01);
- + *control = (((char *) S_iorec)[0x1d] |= or);
- + intson (sr);
- + (void) Super (stack);
- +}
- +
- +/* same for clear... */
- +void scc_and5 (control, and)
- +volatile char *control;
- +unsigned char and;
- +{
- + long stack;
- + short sr;
- + volatile char dummy;
- +
- + /* (see above) */
- + if (!S_iorec)
- + return;
- +
- + /* enter super mode... */
- + stack = Super (0L);
- + /* interrupts off */
- + sr = intsoff();
- + dummy = *((volatile char *) 0xfffffa01);
- + *control = 5;
- + dummy = *((volatile char *) 0xfffffa01);
- + *control = (((char *) S_iorec)[0x1d] &= and);
- + intson (sr);
- + (void) Super (stack);
- +}
- +#endif /* MINT_DTR || MINT_BREAK */
- +
- +/* check the CD status on a serial port */
- +int pollcd (biosdev)
- +int biosdev;
- +{
- + unsigned char result;
- + volatile char dummy;
- + long stack;
- + short sr;
- +
- + switch (biosdev) {
- + case 1:
- + /* modem1 on STs that don't have Bconmap() */
- + /* fall thru */
- + case 6:
- + /* modem1 */
- + /* CD is !bit 1 on the 68901 GPIP port */
- + stack = Super (0L);
- + result = (1 << 1) & ~*((volatile char *) 0xfffffa01);
- + (void) Super (stack);
- + break;
- + case 7:
- + /* modem2 */
- + /* CD is bit 3 of read register 0 on SCC port B */
- + stack = Super (0L);
- + /* interrupts off */
- + sr = intsoff();
- + dummy = *((volatile char *) 0xfffffa01);
- + result = (1 << 3) & *((volatile char *) 0xffff8c85L);
- + intson (sr);
- + (void) Super (stack);
- + break;
- + case 8:
- + /* serial1 */
- + case 9:
- + /* serial2 */
- + /* MiNT 0.95 has the names of serial1 and 2 reversed on Mega STes
- + and they aren't real modem ports anyway, so for now we just
- + fall thru. */
- + default:
- + /* unknown port, assume CD always on. */
- + result = 1;
- + }
- + return result;
- +}
- +#endif /* MINT_FASTREAD || MINT_FASTWRITE */
- +
- +#if MINT_FASTREAD
- +/* here is fastread() itself. called like the OS read(), except that it
- + also needs the port definition to see if it should block or not.
- + (always works like in RAW mode, we only don't check that in the port
- + struct because it will never be called in another mode anyway.
- + we also don't check the fd for similar reasons.)
- + addition: call with buf == NULL and cwant == 0 to flush buffer. */
- +
- +#if MINT_FASTWRITE
- +int fastwrite ();
- +#endif
- +
- +int fastread (fd, buf, cwant, qs)
- +int fd;
- +char *buf;
- +unsigned cwant;
- +struct ssysdep_serial_port *qs;
- +{
- + char *p;
- + unsigned short head, bsize, wrap;
- + long left, stack;
- +
- + if (!S_iorec)
- + /* unknown port... */
- + return read (fd, buf, cwant);
- +
- + /* if we should watch CD and its not there flush buffers and return 0.
- + (could use TIOCFLUSH once that works...) */
- + if (buf && S_fwatchcd && !pollcd (S_biosdev)) {
- +#if MINT_FASTWRITE
- + (void) fastwrite (fd, (char *) NULL, 0, qs);
- +#endif
- + buf = (char *) NULL;
- + }
- +
- + if (buf && !cwant)
- + /* nothing to do... */
- + return 0;
- +
- + /* if the read should block do a select first. */
- + if (buf && qs->fread_blocking) {
- + struct timeval s = {0L, 20000L};
- + int rfds, result;
- +
- + /* ...wich actually is not `a' select but a loop of select()s with
- + timeout, because there is a known bug in MiNT (up to 0.95 at
- + least) that it doesn't wake up a select when data becomes
- + available on serial ports. (works ok on ptys or the console,
- + just not on serial ports. oh well...) */
- + do {
- + rfds = 1 << fd;
- + if ((result = select (0, &rfds, (int *) NULL, (int *) NULL, &s)) < 0)
- + /* if the select gets an error get out */
- + return result;
- +
- + /* else loop until we have data. */
- + } while (!result);
- + }
- + /* enter supervisor mode... */
- + stack = Super (0L);
- +
- + head = S_iorec->ibufhd;
- + if (!(left = ((unsigned) S_iorec->ibuftl) - head)) {
- + /* if the buffer is still empty we're finished. */
- + (void) Super (stack);
- + return 0;
- + }
- +
- + /* now copy the data out of the buffer */
- + bsize = S_iorec->ibufsiz;
- + if (left < 0)
- + left += bsize;
- + wrap = bsize - head;
- +
- + /* if we should flush input pretend we want to read it all */
- + if (!buf)
- + cwant = left;
- +
- + if (left > cwant)
- + left = cwant;
- +
- + /* if its just a few then do it here... */
- + if (buf && left <= 5) {
- + char *q = S_iorec->ibuf + head;
- +
- + /* the --left in the while() makes us get one char less because we
- + want to get the last one thru the driver so that it gets a chance
- + to do handshaking. (ie turn RTS back on or send XON if necessary) */
- + p = buf;
- + while (--left) {
- + if (!--wrap)
- + q -= bsize;
- + *p++ = *++q;
- + }
- + S_iorec->ibufhd = q - S_iorec->ibuf;
- +
- + /* else bcopy is faster. (at least the one in the MiNT libs is :-) */
- + } else {
- +
- + /* --wrap and head+1 because head is `inc before access' */
- + if (--wrap < --left) {
- + if (buf) {
- + bcopy (S_iorec->ibuf + head + 1, buf, wrap);
- + bcopy (S_iorec->ibuf, buf + wrap, left - wrap);
- + }
- + S_iorec->ibufhd = left - wrap - 1;
- + } else {
- + if (buf)
- + bcopy (S_iorec->ibuf + head + 1, buf, left);
- + S_iorec->ibufhd = head + left;
- + }
- + /* p points to last char */
- + p = buf + left;
- + }
- +
- + /* this is fun. did i say i trust serptch2? the xconin routine on
- + modem2 doesn't disable interrupts while accessing SCC registers!!
- + (actually i have fixed that and x other bugs in serptch2 now, but
- + modem2 still doesn't work reliable. :-( if you get it to work
- + please tell me...) */
- + {
- + short sr = intsoff();
- +
- + /* xconin[] are always blocking, and we don't want to hang with ints
- + off even if something impossible like a magically :-) empty
- + buffer happens. so check again. */
- + if (S_iorec->ibuftl != S_iorec->ibufhd)
- + if (buf)
- + *p++ = xcon_exec (S_biosread, 0);
- + else
- + (void) xcon_exec (S_biosread, 0);
- + intson (sr);
- + }
- + (void) Super (stack);
- + if (!buf)
- + return 0;
- + return p - buf;
- +}
- +#endif /* MINT_FASTREAD */
- +
- +#if MINT_FASTWRITE
- +/* here is fastwrite()... comments like on fastread() apply. */
- +int fastwrite (fd, buf, cwrite, qs)
- +int fd;
- +char *buf;
- +unsigned cwrite;
- +struct ssysdep_serial_port *qs;
- +{
- + char *p = buf;
- + int slept = 0;
- +
- + /* /dev/midi doesn't have a write buffer :-( */
- + if (!S_iorec || S_biosdev == 3)
- + return write (fd, buf, cwrite);
- +
- + /* if we should watch CD and its not there flush buffers and return 0. */
- + if (buf && S_fwatchcd && !pollcd (S_biosdev)) {
- +#if MINT_FASTREAD
- + (void) fastread (fd, (char *) NULL, 0, qs);
- +#endif
- + buf = (char *) NULL;
- + }
- +
- + if (!buf) {
- + long stack = Super (0L);
- +
- + /* flush send buffer... should be safe to just set the tail pointer. */
- + S_iorec[1].ibuftl = S_iorec[1].ibufhd;
- + (void) Super (stack);
- + return 0;
- + }
- +
- + if (!cwrite)
- + /* nothing to do... */
- + return 0;
- +
- + do {
- + char ch;
- + unsigned short tail, bsize, wrap, newtail;
- + long free, stack;
- +
- + /* enter supervisor mode... */
- + stack = Super (0L);
- +
- + tail = S_iorec[1].ibuftl;
- + bsize = S_iorec[1].ibufsiz;
- + if ((free = S_iorec[1].ibufhd - tail - 1) < 0)
- + free += bsize;
- +
- + /* if buffer is full or we're blocking and can't write enuf */
- + if (!free || (qs->fread_blocking && free < cwrite && free < bsize/2)) {
- + long sleepchars;
- + unsigned isleep;
- +
- + /* leave super mode. */
- + (void) Super (stack);
- +
- + /* if the write should not block thats it. */
- + if (!qs->fread_blocking)
- + return p - buf;
- +
- + /* else sleep the (minimum) time it takes until the buffer is
- + either half-empty or has space enough for the write, wichever
- + is smaller. */
- + if ((sleepchars = bsize/2) > cwrite)
- + sleepchars = cwrite;
- + sleepchars -= free;
- +
- + isleep = (unsigned) ((sleepchars * 10000L) / qs->ibaud);
- +
- + /* except that if we already slept and the buffer still was full we
- + sleep for at least 20 milliseconds. (driver must be waiting for
- + some handshake signal and we don't want to hog the processor.) */
- + if (slept && isleep < 20)
- + isleep = 20;
- +
- + if (isleep < 5)
- + /* if it still would be less than 5 milliseconds then just
- + give up this timeslice */
- + (void) Syield();
- + else
- + usleep ((unsigned long) isleep * 1000);
- +
- + /* loop and try again. */
- + slept = !free;
- + continue;
- + }
- + slept = 0;
- +
- + /* save the 1st char, we could need it later. */
- + ch = *p;
- + wrap = bsize - tail;
- + if (free > cwrite)
- + free = cwrite;
- + cwrite -= free;
- +
- + /* now copy to buffer. if its just a few then do it here... */
- + if (free < 5) {
- + char *q = S_iorec[1].ibuf + tail;
- +
- + while (free--) {
- + if (!--wrap)
- + q -= bsize;
- + *++q = *p++;
- + }
- + newtail = q - S_iorec[1].ibuf;
- +
- + /* ...else use bcopy. */
- + } else {
- + /* --wrap and tail+1 because tail is `inc before access' */
- + if (--wrap < free) {
- + bcopy (p, S_iorec[1].ibuf + tail + 1, wrap);
- + bcopy (p + wrap, S_iorec[1].ibuf, free - wrap);
- + newtail = free - wrap - 1;
- + } else {
- + bcopy (p, S_iorec[1].ibuf + tail + 1, free);
- + newtail = tail + free;
- + }
- + p += free;
- + }
- +
- + /* the following has to be done with interrupts off to avoid
- + race conditions. */
- + {
- + short sr = intsoff ();
- +
- + /* if the buffer is empty there might be no interrupt that sends
- + the next char, so we send it thru the xcon* vector. */
- + if (S_iorec[1].ibufhd == S_iorec[1].ibuftl) {
- + (void) xcon_exec (S_bioswrite, (unsigned char) ch);
- +
- + /* if the buffer now is still empty we must set the head pointer
- + to skip the 1st char (that we just sent). */
- + if (S_iorec[1].ibufhd == S_iorec[1].ibuftl) {
- + if (++tail >= bsize)
- + tail = 0;
- + S_iorec[1].ibufhd = tail;
- + }
- + }
- + S_iorec[1].ibuftl = newtail;
- +
- + intson (sr);
- + }
- + (void) Super (stack);
- +
- + /* if we may block loop until everything is written */
- + } while (cwrite && qs->fread_blocking);
- +
- + return p - buf;
- +}
- +#endif /* MINT_FASTWRITE */
- +#endif /* __MINT__ */
- +
- /* This routine is used for both locking and unlocking. It is the
- only routine which knows how to translate a device name into the
- name of a lock file. If it can't figure out a name, it does
- @@ -828,7 +1436,13 @@
- { B50, 50 },
- { B75, 75 },
- { B110, 110 },
- +#ifdef B134
- { B134, 134 },
- +#else
- +#ifdef B135
- + { B135, 134 },
- +#endif
- +#endif
- { B150, 150 },
- { B200, 200 },
- { B300, 300 },
- @@ -883,13 +1497,23 @@
- zport = zsysdep_port_name (&fdummy);
- if (zport != NULL)
- ulog_device (zport);
- +#ifdef __MINT__
- + S_opendev = zport;
- +#endif
- }
- else
- {
- +#ifdef __MINT__
- + if (strncmp (z, "/dev/", sizeof "/dev/" - 1) == 0)
- + ulog_device (S_opendev = z + sizeof "/dev/" - 1);
- + else
- + ulog_device (S_opendev = z);
- +#else
- if (strncmp (z, "/dev/", sizeof "/dev/" - 1) == 0)
- ulog_device (z + sizeof "/dev/" - 1);
- else
- ulog_device (z);
- +#endif
- }
-
- ib = B0;
- @@ -989,7 +1613,11 @@
-
- #if HAVE_BSD_TTY
-
- +#ifdef __MINT__
- + q->snew.sg_flags = RAW | ANYP | RTSCTS;
- +#else
- q->snew.sg_flags = RAW | ANYP;
- +#endif
- if (ibaud == 0)
- ib = q->snew.sg_ospeed;
- else
- @@ -1063,7 +1691,29 @@
-
- #endif /* HAVE_POSIX_TERMIOS */
-
- +#ifdef __MINT__
- + { long bpsi = ibaud, bpso = ibaud;
- +
- + /* MiNT 0.95 doesn't know how to set 38400 bps on modem2... */
- + S_biosdev = map_biosdev (S_opendev);
- +#if MINT_FASTREAD
- + /* and also TIOCFLUSH is a no-op on serial ports. */
- + if (S_iorec)
- + (void) fastread (q->oread, (char *) NULL, 0, q);
- +#endif
- + if (! fsetterminfo (q->oread, &q->snew) ||
- + (ibaud && ((errno=-Fcntl(q->oread, &bpso, TIOCOBAUD)) ||
- + (errno=-Fcntl(q->oread, &bpsi, TIOCIBAUD)))))
- + if (errno == EBADARG && ibaud == 38400 && S_biosdev == 7) {
- + char scctab[] = {4, 0xc4, 11, 0x28};
- +
- + sccset ((volatile char *) 0xffff8c85L, scctab, sizeof scctab);
- + /* ...and tell the close routine to restore it */
- + S_modem2_38k4 = 1;
- + } else
- +#else
- if (! fsetterminfo (q->oread, &q->snew))
- +#endif
- {
- ulog (LOG_ERROR, "Can't set terminal settings: %s", strerror (errno));
- (void) close (q->oread);
- @@ -1071,6 +1721,9 @@
- (void) close (q->owrite);
- return FALSE;
- }
- +#ifdef __MINT__
- + }
- +#endif
-
- if (ibaud != 0)
- q->ibaud = ibaud;
- @@ -1184,6 +1837,15 @@
- {
- int iset;
-
- +#if MINT_FASTREAD && MINT_FASTWRITE
- + if (S_iorec && S_biosdev != 3) {
- + /* if we're using fastread and fastwrite we can skip the fcntl
- + because the OS read and write will never be called on this
- + port anyway. */
- + qs->fread_blocking = fblock;
- + return TRUE;
- + }
- +#endif
- if (fblock)
- iset = 0;
- else
- @@ -1212,6 +1874,21 @@
- output. */
- if (q->fterminal)
- {
- +#ifdef __MINT__
- + /* MiNT never hangs up on close... */
- + fsserial_reset (q);
- +
- + /* if we had to set modem2 to 38400 by hand then restore the
- + original settings now. */
- + if (S_modem2_38k4) {
- + char scctab[] = {4, 0x44, 11, 0x50};
- +
- + sccset ((volatile char *) 0xffff8c85L, scctab, sizeof scctab);
- + S_modem2_38k4 = 0;
- + }
- + S_biosdev = 0;
- + S_iorec = (_IOREC *) NULL;
- +#endif
- fSalarm = FALSE;
-
- if (fsysdep_catch ())
- @@ -1379,6 +2056,27 @@
- if (! q->fterminal)
- return TRUE;
-
- +#if (MINT_FASTREAD || MINT_FASTWRITE) && MINT_DTR
- + /* MiNT 0.95 doesn't know how to drop DTR on modem2... */
- + if (S_iorec && S_biosdev == 7) {
- + volatile char *control = (volatile char *) 0xffff8c85L;
- +
- + /* DTR is bit 7 in register 5 */
- + scc_and5 (control, ~(1 << 7));
- +
- + /* sleep 30 ms... */
- + usleep (30000L);
- +
- + /* assert DTR */
- + scc_or5 (control, (1 << 7));
- +
- + /* Give the terminal a chance to settle. */
- + sleep (1);
- +
- + return TRUE;
- + }
- +#endif
- +
- sbaud = q->snew;
-
- #if HAVE_BSD_TTY
- @@ -1538,6 +2236,15 @@
- if (! qport->u.smodem.s.s.fterminal)
- return TRUE;
-
- +#if MINT_FASTREAD || MINT_FASTWRITE
- + /* MiNT doesn't have TIOCNCAR... (see below.) */
- +
- + if (S_iorec) {
- + S_fwatchcd = 0;
- + return TRUE;
- + }
- +#endif
- +
- #ifdef TIOCNCAR
- /* Tell the modem to ignore carrier. */
- if (ioctl (qport->u.smodem.s.s.oread, TIOCNCAR, 0) < 0)
- @@ -1576,6 +2283,18 @@
-
- if (qport->u.smodem.fcarrier)
- {
- +#if MINT_FASTREAD || MINT_FASTWRITE
- + /* MiNT doesn't have TIOCCAR... best thing we can do is make our
- + fastread/fastwrite flush buffers and return 0 when carrier is
- + lost. note this is not exact un*x behaviour (and there also
- + is no SIGHUP) but its enuf for what we need. */
- +
- + if (S_iorec) {
- + S_fwatchcd = 1;
- + return TRUE;
- + }
- +#endif
- +
- #ifdef TIOCCAR
- /* Tell the modem to pay attention to carrier. */
- if (ioctl (qport->u.smodem.s.s.oread, TIOCCAR, 0) < 0)
- @@ -1622,6 +2341,30 @@
- if (! fsysdep_modem_need_carrier (qport))
- return FALSE;
-
- +#if MINT_FASTREAD || MINT_FASTWRITE
- + /* on MiNT we can only poll the CD line... */
- + if (S_iorec) {
- + clock_t timeout = clock () + qdial->ccarrier_wait * CLK_TCK;
- +
- + while (((long) clock () - (long) timeout) < 0) {
- + /* If we got a random signal, just return FALSE. */
- + if (FGOT_QUIT_SIGNAL ())
- + return FALSE;
- +
- + /* if cd is there then we're done. */
- + if (pollcd (S_biosdev))
- + return TRUE;
- +
- + /* else sleep 50 milliseconds before trying again... */
- + usleep(50000L);
- + }
- +
- + /* if we get here, we timed out. */
- + ulog (LOG_ERROR, "Timed out waiting for carrier");
- + return FALSE;
- + }
- +#endif
- +
- #ifdef TIOCWONLINE
-
- /* We know how to wait for carrier, so do so. */
- @@ -1777,6 +2520,16 @@
- while (TRUE)
- {
- int cgot;
- +#ifdef __MINT__
- +#if !MINT_FASTREAD
- + /* read() on (current) MiNT can take a while... (does 2 TOS calls
- + for each character :-( ) measure that so we don't end up
- + sleeping too long. */
- + static clock_t read_ticks = 0;
- + static int read_chars = 32;
- + clock_t read_start;
- +#endif
- +#endif
-
- #if HAVE_SYSV_TERMIO || HAVE_POSIX_TERMIOS
- /* If we can tell the terminal not to return until we have a
- @@ -1831,7 +2584,27 @@
- /* Right here is the race condition which we avoid by having the
- SIGALRM handler schedule another SIGALRM. */
-
- +#if MINT_FASTREAD
- + cgot = fastread (q->oread, zbuf, cwant, q);
- +#else
- +#ifdef __MINT__
- + /* measure the time a `long' read() takes if it will not block. */
- +
- + if (q->fterminal && !fpty &&
- + (cwant >= read_chars || cwant > MAX_INPUT/2) &&
- + (!q->fread_blocking || Finstat (q->oread))) {
- + read_start = clock();
- +
- + cgot = read (q->oread, zbuf, cwant);
- +
- + if (cgot >= read_chars || cgot > MAX_INPUT/2) {
- + read_ticks = clock() - read_start;
- + read_chars = cgot;
- + }
- + } else
- +#endif
- cgot = read (q->oread, zbuf, cwant);
- +#endif
-
- /* If the read returned an error, check for signals. */
- if (cgot < 0)
- @@ -1940,6 +2713,15 @@
-
- isleep = (int) (((long) csleepchars * 10000L) / q->ibaud);
- isleep -= 10;
- +#ifdef __MINT__
- +#if !MINT_FASTREAD
- + if (read_ticks > 1)
- + /* make a guess how long the read itself will take... sleep
- + that much less. */
- + isleep -= (int) ((long) csleepchars * read_ticks * 1000L /
- + (read_chars * CLK_TCK));
- +#endif
- +#endif
-
- if (isleep > 10)
- {
- @@ -2044,8 +2826,13 @@
- return FALSE;
-
- /* Loop until we don't get an interrupt. */
- +#if MINT_FASTWRITE
- + while ((cdid = fastwrite (q->owrite, zwrite, cwrite, q)) < 0
- + && errno == EINTR)
- +#else
- while ((cdid = write (q->owrite, zwrite, cwrite)) < 0
- && errno == EINTR)
- +#endif
- {
- /* Log the signal. */
- ulog (LOG_ERROR, (const char *) NULL);
- @@ -2185,8 +2972,13 @@
-
- /* Loop until we get something (error or data) other than an
- acceptable EINTR. */
- +#if MINT_FASTREAD
- + while ((cgot = fastread (q->oread, zread, cread, q)) < 0
- + && errno == EINTR)
- +#else
- while ((cgot = read (q->oread, zread, cread)) < 0
- && errno == EINTR)
- +#endif
- {
- /* Log the signal. */
- ulog (LOG_ERROR, (const char *) NULL);
- @@ -2219,13 +3011,23 @@
- cdo = cwrite;
-
- #if ! HAVE_UNBLOCKED_WRITES
- +#if MINT_FASTWRITE
- + /* fastwrite() knows how to do an unblocked write... */
- + if (cdo > SINGLE_WRITE && (!S_iorec || S_biosdev == 3))
- +#else
- if (cdo > SINGLE_WRITE)
- +#endif
- cdo = SINGLE_WRITE;
- #endif
-
- /* Loop until we get something besides EINTR. */
- +#if MINT_FASTWRITE
- + while ((cdid = fastwrite (q->owrite, zwrite, cdo, q)) < 0
- + && errno == EINTR)
- +#else
- while ((cdid = write (q->owrite, zwrite, cdo)) < 0
- && errno == EINTR)
- +#endif
- {
- /* Log the signal. */
- ulog (LOG_ERROR, (const char *) NULL);
- @@ -2271,8 +3073,13 @@
- "fsserial_io: Blocking write of %d", cdo);
-
- /* Loop until we get something besides EINTR. */
- +#if MINT_FASTWRITE
- + while ((cdid = fastwrite (q->owrite, zwrite, cdo, q)) < 0
- + && errno == EINTR)
- +#else
- while ((cdid = write (q->owrite, zwrite, cdo)) < 0
- && errno == EINTR)
- +#endif
- {
- /* Log the signal. */
- ulog (LOG_ERROR, (const char *) NULL);
- @@ -2357,6 +3164,19 @@
- fsserial_break (q)
- struct ssysdep_serial_port *q;
- {
- +#if (MINT_FASTREAD || MINT_FASTWRITE) && MINT_BREAK
- + /* MiNT 0.95 doesn't know how to send a break on modem2... */
- + if (S_iorec && S_biosdev == 7) {
- + volatile char *control = (volatile char *) 0xffff8c85L;
- +
- + /* bit 4 in register 5 is the break condition */
- + scc_or5 (control, (1 << 4));
- + sleep (1);
- + scc_and5 (control, ~(1 << 4));
- + return TRUE;
- + }
- +#endif
- +
- #if HAVE_BSD_TTY
- ioctl (q->owrite, TIOCSBRK, 0);
- sleep (1);
- @@ -2413,9 +3233,15 @@
- {
- case PORTSETTING_EIGHT:
- #if HAVE_BSD_TTY
- +#ifdef __MINT__
- + if (q->snew.sg_flags == (RAW | ANYP | RTSCTS))
- + return TRUE;
- + q->snew.sg_flags = RAW | ANYP | RTSCTS;
- +#else
- if (q->snew.sg_flags == (RAW | ANYP))
- return TRUE;
- q->snew.sg_flags = RAW | ANYP;
- +#endif
- #endif
- #if HAVE_SYSV_TERMIO || HAVE_POSIX_TERMIOS
- if ((q->snew.c_iflag & ICLEAR_IFLAG) == 0)
- diff -ru ./sys3.c /src/t103/uucp-1.03/sys3.c
- --- ./sys3.c Tue Apr 7 06:05:28 1992
- +++ /src/t103/uucp-1.03/sys3.c Thu Jan 7 20:58:36 1993
- @@ -435,6 +435,12 @@
- Debugging messages are stored in these when running as a slave. We
- use the file AUDIT in the spool directory. */
-
- +
- +#ifdef __MINT__
- +/* for Frename() */
- +#include <osbind.h>
- +#endif
- +
- /* Local functions. */
-
- static char *zsstatic_size P((int c));
- @@ -630,6 +636,29 @@
- && *zsimple != 'D'
- && *zsimple != 'X'))
- {
- +#ifdef __MINT__
- + char *zcopy, *p, ch;
- + int clen;
- +
- + /* see if it already went thru translate_spoolname... */
- + if ((*zsimple & 0xde) == '@' &&
- + (clen = strlen (zsimple)) > 7 &&
- + ((ch = zsimple[clen-1] & 0xdf) == 'C' || ch == 'D' || ch == 'X') &&
- + strchr (zsimple, '.') == zsimple+clen-2) {
- + zcopy = p = (char *) alloca (clen + 2);
- +
- + *p++ = ch;
- + *p++ = '.';
- + if (clen > 9)
- + /* dummy char, will be dropped in translate_spoolname */
- + ++clen, *p++ = '=';
- + strncpy (p, zsimple + 1, clen - 3);
- + zcopy[clen - 1] = 0;
- +
- + /* this assumes SPOOLDIR_BNU: */
- + return zsappend (zsystem, zcopy);
- + }
- +#endif
- ulog (LOG_ERROR, "Unrecognized file name %s", zsimple);
- return NULL;
- }
- @@ -836,7 +865,11 @@
- e = fopen (zname, "r");
- if (e == NULL)
- {
- +#ifdef __MINT__
- + if (errno != ENOENT && errno != EPATH)
- +#else
- if (errno != ENOENT)
- +#endif
- {
- ulog (LOG_ERROR, "fopen (%s): %s", zname, strerror (errno));
- return FALSE;
- @@ -939,6 +972,70 @@
- return TRUE;
- }
-
- +#ifdef __MINT__
- +/* translate a spool file name for stupid 8+3 filesystems. this makes
- + sense only with SPOOLDIR_BNU or (maybe) SPOOLDIR_TAYLOR because it
- + drops characters of the system name. warning: translation done in-place! */
- +char *
- +translate_spoolname(zfile, localfile)
- + char *zfile;
- + int localfile;
- +{
- + char type, *p;
- +
- + if (!zfile)
- + return zfile;
- +
- + if (!(p=strrchr(zfile, '/')))
- + p=zfile;
- + else
- + ++p;
- +
- + if (((type=*p) == 'C' || type == 'D' || type == 'X') && p[1] == '.') {
- + char *q, ch, grade = 0;
- + int l;
- +
- + /* take the last 7 characters, place a `A' before and a '.' and the
- + file type (C, X, or D) after. not 100% safe (especially because
- + this filesystem is not case sensitive), but thats what the TOS uucico
- + seems to be doing and at least for now we want to be compatible.
- + example: D.fooboxN1234 becomes AoxN1234.D (and aoxn1234.d on disk).
- +
- + (actually files created locally now get the case of the grade coded
- + in the first char (@ = upper, A = lower) and the sequence number is
- + in hex with SPOOLDIR_BNU anyway, so this can only be a problem with
- + incoming files.) */
- +
- + q=p+2;
- + /* leave D.0 etc alone */
- + if (!strcmp (q, "0"))
- + return zfile;
- + if ((l = strlen (q) - 7) > 0) {
- + q+=l;
- + grade = q[2];
- + } else {
- + ++q;
- + if (l >= -1)
- + grade = q[l + 1];
- + }
- + if (localfile && grade >= 'A' && grade <= 'Z')
- + *p++='@';
- + else
- + *p++='A';
- + while (ch = *q++) {
- + /* just to be sure... */
- + if (ch == '.')
- + ch='_';
- + *p++=ch;
- + }
- + *p++='.';
- + *p++=type;
- + *p++=0;
- + }
- + return zfile;
- +}
- +#endif
- +
- /* Get the real name of a spool file. */
-
- const char *
- @@ -946,7 +1043,12 @@
- const struct ssysteminfo *qsys;
- const char *zfile;
- {
- +#ifdef __MINT__
- + /* stupid 8+3 filesystem... */
- + return translate_spoolname((char *) zsfind_file (zfile, qsys->zname), 0);
- +#else
- return zsfind_file (zfile, qsys->zname);
- +#endif
- }
-
- /* Expand a file name on the local system. The qsys argument is only
- @@ -960,6 +1062,18 @@
- {
- const char *ztry;
- char *zlook;
- +#ifdef __MINT__
- + char *p, ch;
- +
- + if (p = (char *) zfile)
- + for (; ch = *p; ++p)
- + if (ch == '\\')
- + *p = '/';
- + if (p = (char *) zname)
- + for (; ch = *p; ++p)
- + if (ch == '\\')
- + *p = '/';
- +#endif
-
- if (zfile[0] == '/')
- ztry = zfile;
- @@ -1063,10 +1177,19 @@
- }
- #if USE_STDIO
- e = fopen (zfile, BINREAD);
- +#ifdef __MINT__
- + /* give GEMDOS a kick. */
- + if (e == NULL || setvbuf(e, NULL, _IOFBF, 0x2000))
- +#else
- if (e == NULL)
- +#endif
- {
- ulog (LOG_ERROR, "fopen (%s): %s", zfile, strerror (errno));
- +#ifdef __MINT__
- + if (pfgone != NULL && (errno == ENOENT || errno == EPATH))
- +#else
- if (pfgone != NULL && errno == ENOENT)
- +#endif
- *pfgone = TRUE;
- return NULL;
- }
- @@ -1147,7 +1270,11 @@
- z = (char *) xmalloc (cneed);
- calc = cneed;
- }
- +#ifdef __MINT__
- + sprintf (z, "%s/TM_%05d.%03d", qsys->zname, getpid (), icount);
- +#else
- sprintf (z, "%s/TM.%05d.%03d", qsys->zname, getpid (), icount);
- +#endif
- zret = z;
- }
- #endif
- @@ -1175,6 +1302,14 @@
- openfile_t e;
- long c1, c2;
- char *zcopy, *zslash;
- +#ifdef __MINT__
- + char *p, ch;
- +
- + if (p = (char *) zto)
- + for (; ch = *p; ++p)
- + if (ch == '\\')
- + *p = '/';
- +#endif
-
- z = zstemp_file (qsys);
-
- @@ -1182,7 +1317,11 @@
-
- if (o == -1)
- {
- +#ifdef __MINT__
- + if (errno == ENOENT || errno == EPATH)
- +#else
- if (errno == ENOENT)
- +#endif
- {
- if (! fsysdep_make_dirs (z, FALSE))
- return EFILECLOSED;
- @@ -1198,7 +1337,12 @@
- #if USE_STDIO
- e = fdopen (o, (char *) BINWRITE);
-
- +#ifdef __MINT__
- + /* give GEMDOS another kick... */
- + if (e == NULL || setvbuf(e, NULL, _IOFBF, 0x2000))
- +#else
- if (e == NULL)
- +#endif
- {
- ulog (LOG_ERROR, "fdopen (%s): %s", z, strerror (errno));
- (void) close (o);
- @@ -1313,6 +1457,18 @@
- boolean fcheck;
- const char *zuser;
- {
- +#ifdef __MINT__
- + char *p, ch;
- +
- + if (p = (char *) zorig)
- + for (; ch = *p; ++p)
- + if (ch == '\\')
- + *p = '/';
- + if (p = (char *) zto)
- + for (; ch = *p; ++p)
- + if (ch == '\\')
- + *p = '/';
- +#endif
- DEBUG_MESSAGE2 (DEBUG_SPOOLDIR,
- "fsysdep_move_file: Moving %s to %s", zorig, zto);
-
- @@ -1390,7 +1546,11 @@
-
- /* If this file is in the spool directory, make sure all directories
- exist. */
- +#ifdef __MINT__
- + if (*zto != '/' && (errno == ENOENT || errno == EPATH))
- +#else
- if (*zto != '/' && errno == ENOENT)
- +#endif
- {
- if (! fsysdep_make_dirs (zto, FALSE))
- {
- @@ -1535,7 +1695,11 @@
- #if USE_STDIO
- e = fdopen (o, (char *) BINWRITE);
-
- +#ifdef __MINT__
- + if (e == NULL || setvbuf(e, NULL, _IOFBF, 0x2000))
- +#else
- if (e == NULL)
- +#endif
- {
- ulog (LOG_ERROR, "fdopen (%s): %s", zname, strerror (errno));
- (void) close (o);
- @@ -1550,6 +1714,50 @@
- #endif /* ! HAVE_FTRUNCATE */
- }
-
- +
- +#ifdef __MINT__
- +/* change lock file names LCK.something into something.LCK and
- + (spooldir/)L.something into (spooldir/)something.L
- + (stupid 8+3 filesystem...)
- + do the 1st one in a static because zlock can be in the text segment
- + the 2nd case should be safe to do in-place.
- + (this probably only works with SPOOLDIR_BNU) */
- +
- +char *
- +translate_lock (zlock)
- + char *zlock;
- +{
- + static char s[15];
- + char *p, *q, *ret=zlock, ch, lck[5];
- +
- + if (!(p=strrchr(zlock, '/')))
- + p=zlock;
- + else
- + ++p;
- + if (*p == 'L' && p[1] == '.') {
- + *lck='.';
- + lck[1]='L';
- + lck[2]=0;
- + q=p+2;
- + } else {
- + if (*zlock != 'L' || strlen (zlock) <=3 || zlock[3] != '.')
- + return zlock;
- + ret=p=s;
- + q=zlock+sizeof "LCK."-1;
- + *lck='.';
- + strncpy(lck+1, zlock, 3);
- + lck[4]=0;
- + }
- + while (ch = *q++) {
- + if (ch == '.')
- + ch='_';
- + *p++=ch;
- + }
- + strcpy(p, lck);
- + return ret;
- +}
- +#endif
- +
- /* Lock something. If the fspooldir argument is TRUE, the argument is
- a file name relative to the spool directory; otherwise the argument
- is a simple file name which should be created in the system lock
- @@ -1576,6 +1784,11 @@
- const char *zerr;
- boolean fret;
-
- +#ifdef __MINT__
- + char utmpf[FILENAME_MAX], upath[FILENAME_MAX];
- +
- + zlock = translate_lock(zlock);
- +#endif
- #ifdef LOCKDIR
- if (fspooldir)
- zpath = zlock;
- @@ -1609,14 +1822,25 @@
-
- ztempfile = (char *) alloca (cslash + sizeof "TMP1234567890");
- strncpy (ztempfile, zpath, cslash);
- +#ifdef __MINT__
- + sprintf (abtempfile, "%08d.TMP", (int) ime);
- +#else
- sprintf (abtempfile, "TMP%010d", (int) ime);
- +#endif
- ztempfile[cslash] = '\0';
- strcat (ztempfile, abtempfile);
-
- +#ifdef __MINT__
- +newtempf:
- +#endif
- o = creat (ztempfile, IPUBLIC_FILE_MODE);
- if (o < 0)
- {
- +#ifdef __MINT__
- + if (errno == ENOENT || errno == EPATH)
- +#else
- if (errno == ENOENT)
- +#endif
- {
- if (! fsysdep_make_dirs (ztempfile, FALSE))
- return FALSE;
- @@ -1659,14 +1883,38 @@
- o = -1;
- zerr = NULL;
-
- +#ifdef __MINT__
- + /* translate filenames for Frename (see below) */
- + _unx2dos (ztempfile, utmpf);
- + _unx2dos (zpath, upath);
- +#endif
- +
- while (link (ztempfile, zpath) != 0)
- {
- int cgot;
- int ipid;
-
- +#ifdef __MINT__
- + /* on MiNT link only works on some filesystems... on all others
- + the closest approximation we have is Frename. :-( */
- + int frenamed = 0;
- +
- + if (errno == EINVAL) {
- + if (!(errno = -Frename (0, utmpf, upath)))
- + break;
- +
- + frenamed = 1;
- + }
- +
- + fret = FALSE;
- +
- + /* Frename returns EACCESS when it really means EEXIST. */
- + if (errno != EEXIST && errno != EACCESS)
- +#else
- fret = FALSE;
-
- if (errno != EEXIST)
- +#endif
- {
- ulog (LOG_ERROR, "link (%s, %s): %s", ztempfile, zpath,
- strerror (errno));
- @@ -1848,8 +2096,14 @@
- break;
- }
-
- +#ifdef __MINT__
- + /* if link didn't work the filesystem won't have inodes anyway. */
- + if ((frenamed || sfile.st_ino == sdescriptor.st_ino)
- + && sfile.st_dev == sdescriptor.st_dev)
- +#else
- if (sfile.st_ino == sdescriptor.st_ino
- && sfile.st_dev == sdescriptor.st_dev)
- +#endif
- {
- /* Close the file before assuming we've succeeded to
- pick up any trailing errors. */
- @@ -1874,6 +2128,11 @@
- (void) close (o);
- o = -1;
- fret = TRUE;
- +#ifdef __MINT__
- + /* if we had to use Frename we must make a new tempfile first */
- + if (frenamed)
- + goto newtempf;
- +#endif
- }
-
- if (zerr != NULL)
- @@ -1886,7 +2145,13 @@
- future calls, but considering that we create lock files in
- various different directories it's probably more trouble than
- it's worth. */
- +#ifdef __MINT__
- + /* if we had to use Frename the tempfile will no longer be there
- + so we ignore the error. */
- + if (remove (ztempfile) != 0 && errno != ENOENT)
- +#else
- if (remove (ztempfile) != 0)
- +#endif
- ulog (LOG_ERROR, "remove (%s): %s", ztempfile, strerror (errno));
-
- return fret;
- @@ -1901,6 +2166,9 @@
- {
- const char *zpath;
-
- +#ifdef __MINT__
- + zlock = translate_lock(zlock);
- +#endif
- #ifdef LOCKDIR
- if (fspooldir)
- zpath = zlock;
- @@ -2039,7 +2307,11 @@
-
- if (o < 0)
- {
- +#ifdef __MINT__
- + if (errno == ENOENT || errno == EPATH)
- +#else
- if (errno == ENOENT)
- +#endif
- {
- if (! fsysdep_make_dirs (zfile, FALSE))
- {
- @@ -2184,6 +2456,16 @@
- #endif
-
- zname = zsfind_file (absimple, zsystem);
- +#ifdef __MINT__
- + /* munge the name for 8+3 filesystems...
- + if the grade is upper case make the first char of the
- + *.C file name @ instead of A to keep the information on this
- + case-ignoring filesystem. (the sequence number is in hex at
- + least with SPOOLDIR_BNU and the system name isn't used so the
- + grade is the only part where case matters.) */
- +
- + translate_spoolname (zname, btype == 'C');
- +#endif
- if (zname == NULL)
- return NULL;
- }
- @@ -2234,12 +2516,40 @@
-
- for (i = 0, q = pascmds; i < ccmds; i++, q++)
- {
- +#ifdef __MINT__
- + char *p, ch;
- +
- + if (p = (char *) q->zfrom)
- + for (; ch = *p; ++p)
- + if (ch == '\\')
- + *p = '/';
- +
- + if (p = (char *) q->zto)
- + for (; ch = *p; ++p)
- + if (ch == '\\')
- + *p = '/';
- +#endif
- switch (q->bcmd)
- {
- case 'S':
- +#ifdef __MINT__
- + /* stupid 8+3 filesystem...
- + put the translated temp file name in the command file */
- +
- + { char *ztempf = alloca (strlen (q->ztemp) + 1);
- +
- + strcpy (ztempf, q->ztemp);
- + translate_spoolname(ztempf, 0);
- +
- + fprintf (e, "S %s %s %s -%s %s 0%o %s\n", q->zfrom, q->zto,
- + q->zuser, q->zoptions, ztempf, q->imode,
- + q->znotify);
- + }
- +#else
- fprintf (e, "S %s %s %s -%s %s 0%o %s\n", q->zfrom, q->zto,
- q->zuser, q->zoptions, q->ztemp, q->imode,
- q->znotify);
- +#endif
- break;
- case 'R':
- fprintf (e, "R %s %s %s -%s\n", q->zfrom, q->zto, q->zuser,
- @@ -2311,6 +2621,9 @@
- sprintf (absx, "X.%.7sX%s", zLocalname, abseq);
-
- zname = zsfind_file (absx, zLocalname);
- +#ifdef __MINT__
- + translate_spoolname (zname, 0);
- +#endif
- if (zname == NULL)
- return NULL;
- if (stat (zname, &s) != 0)
- @@ -2336,6 +2649,15 @@
- FILE *e;
- pid_t ipid;
-
- +#ifdef __MINT__
- + char *p, ch;
- +
- + if (p = (char *) zfile)
- + for (; ch = *p; ++p)
- + if (ch == '\\')
- + *p = '/';
- +#endif
- +
- zSwildcard_alloc = NULL;
- zSwildcard = NULL;
-
- @@ -2355,6 +2677,10 @@
- zcmd = (char *) alloca (sizeof ECHO_PROGRAM + sizeof " " + strlen (zfile));
- sprintf (zcmd, "%s %s", ECHO_PROGRAM, zfile);
-
- +#ifdef __MINT__
- + /* on MiNT people don't always have a shell in /bin/sh */
- + if (!(azargs[0] = getenv("SHELL")))
- +#endif
- azargs[0] = "/bin/sh";
- azargs[1] = "-c";
- azargs[2] = zcmd;
- @@ -2557,10 +2883,38 @@
- const char *zfile;
- {
- char *zid;
- +#ifdef __MINT__
- + /* handle [@a]oxn1234.c as well as the `normal' C.fooboxN1234 format */
- + int clen, slen = strlen (qsys->zname);
- + char ch;
- +
- + zid = (char *) alloca (slen + CSEQLEN + 2);
- + if ((clen = strlen (zfile)) > 7 && (zfile[clen - 1] & 0xdf) == 'C' &&
- + strchr (zfile, '.') == zfile + clen - 2) {
- + strcpy (zid, qsys->zname);
- + strncpy (zid + slen, zfile + clen - CSEQLEN - 3, CSEQLEN + 1);
- + zid[slen + CSEQLEN + 1] = 0;
- +
- + /* restore the case of the grade */
- + if ((ch = zid[slen] & 0xdf) >= 'A' && ch <= 'Z') {
- + const char *p = strrchr (zfile, '/');
-
- + if (!p)
- + p = zfile;
- + else
- + ++p;
- + if (*p != '@')
- + ch |= 0x20;
- + zid[slen] = ch;
- + }
- + } else
- + sprintf (zid, "%s%s", qsys->zname,
- + zfile + strlen (zfile) - CSEQLEN - 1);
- +#else
- zid = (char *) alloca (strlen (qsys->zname) + CSEQLEN + 2);
- sprintf (zid, "%s%s", qsys->zname,
- zfile + strlen (zfile) - CSEQLEN - 1);
- +#endif
-
- return zscopy (zid);
- }
- @@ -2599,7 +2953,11 @@
- sprintf (abname, "C.%s", abend);
- #endif
-
- +#ifdef __MINT__
- + return translate_spoolname (zsfind_file (abname, zsys), 1);
- +#else
- return zsfind_file (abname, zsys);
- +#endif
- }
-
- #if ! HAVE_RENAME
- diff -ru ./sys4.c /src/t103/uucp-1.03/sys4.c
- --- ./sys4.c Tue Apr 7 06:05:28 1992
- +++ /src/t103/uucp-1.03/sys4.c Wed Jan 6 20:20:54 1993
- @@ -236,7 +236,30 @@
- we are looking in and AIX uucp sets it to the local system rather
- than the remote one. */
- if (zfile[0] != 'C' || zfile[1] != '.')
- +#ifdef __MINT__
- + {
- + char ch;
- +
- + /* stupid 8+3 filesystem... look for *.[cC] too */
- + clen = strlen (zfile);
- + if (clen < 7 || strchr(zfile, '.') != zfile+clen-2 ||
- + (zfile[clen-1] & 0xdf) != 'C')
- + return FALSE;
- +
- + *pbgrade = ch = zfile[clen - 7];
- +
- + /* we saved the case of the grade into the first char: A means lower,
- + @ upper */
- + if ((ch & 0xdf) >= 'A' && ch <= 'Z') {
- + if (*zfile != '@')
- + ch |= 0x20;
- + *pbgrade = ch;
- + }
- + return TRUE;
- + }
- +#else
- return FALSE;
- +#endif
- clen = strlen (zfile);
- if (clen < 7)
- return FALSE;
- @@ -359,7 +382,11 @@
- qdir = opendir ((char *) zdir);
- if (qdir == NULL)
- {
- +#ifdef __MINT__
- + if (errno != ENOENT && errno != EPATH)
- +#else
- if (errno != ENOENT)
- +#endif
- ulog (LOG_ERROR, "opendir (%s): %s", zdir, strerror (errno));
- return FALSE;
- }
- @@ -384,7 +411,13 @@
-
- zname = qentry->d_name;
- if (fswork_file (qsys->zname, qentry->d_name, &bfilegrade)
- +#if 1
- + /* hmmm. is my bsearch() the only one that doesn't like
- + getting called with zero count? :-) -nox */
- + && (azSwork_files == NULL || !chad
- +#else
- && (azSwork_files == NULL
- +#endif
- || bsearch ((pointer) &zname,
- (pointer) azSwork_files,
- chad, sizeof (char *),
- @@ -586,6 +619,35 @@
- qSwork_file->aslines[iline].zline = NULL;
- return FALSE;
- }
- +#ifdef __MINT__
- + /* kludge to make requests written by the `old' uux work:
- + if zfrom and ztemp are equal and look like afoobar.[dx]
- + and the options are empty then use -C and munge zfrom back. */
- + { int clen; char ch;
- +
- + if (!*qcmd->zoptions && (*qcmd->zfrom & 0xdf) == 'A' &&
- + (clen = strlen (qcmd->zfrom)) > 7 && clen <= 10 &&
- + ((ch = qcmd->zfrom[clen - 1] & 0xdf) == 'D' || ch == 'X') &&
- + !strcmp (qcmd->zfrom, qcmd->ztemp) &&
- + strchr (qcmd->zfrom, '.') == qcmd->zfrom + clen - 2 &&
- + !strchr (qcmd->zfrom, '\\') &&
- + !strchr (qcmd->zfrom, '/')) {
- + char *p, *ztmp = alloca (clen + 1);
- +
- + p = ztmp;
- + *p++ = ch;
- + *p++ = '.';
- + if (clen > 9)
- + /* dummy char, will be dropped in translate_spoolname */
- + ++clen, *p++ = '_';
- + strncpy (p, qcmd->zfrom + 1, clen - 3);
- + ztmp[clen - 1] = 0;
- + strcpy ((char *) qcmd->zfrom, ztmp);
- +
- + qcmd->zoptions = "C";
- + }
- + }
- +#endif
-
- qSwork_file->aslines[iline].ztemp = xstrdup (zreal);
- }
- @@ -708,6 +770,14 @@
- int cwant;
- static char *zbuf;
- static int cbuf;
- +#ifdef __MINT__
- + char *p, ch;
- +
- + if (p = (char *) qline->ztemp)
- + for (; ch = *p; ++p)
- + if (ch == '\\')
- + *p = '/';
- +#endif
-
- if (! fsysdep_file_exists (qline->ztemp))
- return NULL;
- diff -ru ./sys5.c /src/t103/uucp-1.03/sys5.c
- --- ./sys5.c Tue Apr 7 06:05:28 1992
- +++ /src/t103/uucp-1.03/sys5.c Wed Jan 6 20:23:30 1993
- @@ -257,7 +257,11 @@
- qSxqt_topdir = opendir ((char *) ZDIR);
- if (qSxqt_topdir == NULL)
- {
- +#ifdef __MINT__
- + if (errno == ENOENT || errno == EPATH)
- +#else
- if (errno == ENOENT)
- +#endif
- return TRUE;
- ulog (LOG_ERROR, "opendir (%s): %s", ZDIR, strerror (errno));
- return FALSE;
- @@ -337,7 +341,11 @@
- qSxqt_dir = opendir (zSdir);
-
- if (qSxqt_dir == NULL
- +#ifdef __MINT__
- + && errno != EPATH
- +#else
- && errno != ENOTDIR
- +#endif
- && errno != ENOENT)
- ulog (LOG_ERROR, "opendir (%s): %s", zSdir, strerror (errno));
- }
- @@ -401,6 +409,36 @@
-
- return zret;
- }
- +#ifdef __MINT__
- + else {
- + int clen;
- +
- + /* stupid 8+3 filesystem... look for *.x too */
- + if (q != NULL &&
- + (clen = strlen (q->d_name)) >= 7 &&
- + strchr(q->d_name, '.') == q->d_name+clen-2 &&
- + (q->d_name[clen-1] & 0xdf) == 'X') {
- + const char *zret;
- +
- + /* this assumes SPOOLDIR_BNU */
- + *pzsystem = zSsystem;
- +
- + /* Set *pferr to TRUE in case zsappend returns NULL. */
- + *pferr = TRUE;
- +
- + zret = zsappend (zSdir, q->d_name);
- +
- + #if DEBUG > 1
- + if (zret != NULL)
- + DEBUG_MESSAGE2 (DEBUG_SPOOLDIR,
- + "zsysdep_get_xqt: Returning %s (system %s)",
- + zret, *pzsystem);
- + #endif
- +
- + return zret;
- + }
- + }
- +#endif
-
- /* If we've reached the end of the directory, then if we are
- using subdirectories loop around to read the next one,
- @@ -456,6 +494,10 @@
- boolean *pferr;
- {
- char *zcopy, *ztok;
- +#ifdef __MINT__
- + char *ztmp;
- + int clen;
- +#endif
-
- *pferr = TRUE;
-
- @@ -499,6 +541,20 @@
- the path. */
- zcopy = (char *) alloca (strlen (zpath) + 1);
- strcpy (zcopy, zpath);
- +#ifdef __MINT__
- + /* and on MiNT that includes looking for file `types' *.ttp etc
- + if the command doesn't come with one. */
- + if (strchr (zcmd, '.')) {
- + /* if there is a . assume it does */
- + ztmp = (char *) zcmd;
- + clen = 0;
- + } else {
- + ztmp = alloca ((clen = strlen (zcmd)) + sizeof ".ttp");
- + strcpy (ztmp, zcmd);
- + /* make zsappend allocate enough... */
- + strcpy (ztmp + clen, ".xxx");
- + }
- +#endif
- for (ztok = strtok (zcopy, " ");
- ztok != NULL;
- ztok = strtok ((char *) NULL, " "))
- @@ -505,9 +561,37 @@
- {
- const char *zname;
-
- +#ifdef __MINT__
- + zname = zsappend (ztok, ztmp);
- + if (zname == NULL)
- + return NULL;
- +
- + if (clen) {
- + char *p = (char *) zname + clen + strlen (ztok) + 1;
- +
- + /* try the unchanged command first */
- + *p = 0;
- + if (access (zname, F_OK) == 0)
- + return zname;
- +
- + /* and now command.ttp */
- + strcpy (p++, ".ttp");
- + if (access (zname, F_OK) == 0)
- + return zname;
- +
- + /* command.prg */
- + strcpy (p, "prg");
- + if (access (zname, F_OK) == 0)
- + return zname;
- +
- + /* command.tos */
- + strcpy (p, "tos");
- + }
- +#else
- zname = zsappend (ztok, zcmd);
- if (zname == NULL)
- return NULL;
- +#endif
- if (access (zname, F_OK) == 0)
- return zname;
- }
- @@ -529,6 +613,15 @@
- const struct ssysteminfo *qsys;
- const char *zfile;
- {
- +#ifdef __MINT__
- + char *p, ch;
- +
- + if (p = (char *) zfile)
- + for (; ch = *p; ++p)
- + if (ch == '\\')
- + *p = '/';
- +#endif
- +
- if (strncmp (zfile, "../", sizeof "../" - 1) == 0
- || strstr (zfile, "/../") != NULL
- || (*zfile == '/'
- @@ -617,7 +710,11 @@
- aidescs[2] = creat (*pzerror, IPRIVATE_FILE_MODE);
- if (aidescs[2] < 0)
- {
- +#ifdef __MINT__
- + if (errno == ENOENT || errno == EPATH)
- +#else
- if (errno == ENOENT)
- +#endif
- {
- if (! fsysdep_make_dirs (*pzerror, FALSE))
- {
- @@ -786,7 +883,11 @@
- char ab[14];
-
- sprintf (ab, "LXQ.%.9s", zcmd);
- +#ifdef __MINT__
- + return access (translate_lock(ab), F_OK) == 0;
- +#else
- return access (ab, F_OK) == 0;
- +#endif
- }
-
- /* Lock a particular execute file. */
- @@ -796,15 +897,30 @@
- const char *zfile;
- {
- char *zcopy, *z;
- +#ifdef __MINT__
- + int clen;
- +#endif
-
- zcopy = (char *) alloca (strlen (zfile) + 1);
- strcpy (zcopy, zfile);
-
- z = strrchr (zcopy, '/');
- +#ifdef __MINT__
- + if (!z)
- + z = zcopy;
- + else
- + ++z;
- + /* if zfile matches *.X replace the last char */
- + if ((clen = strlen (z)) > 3 && (z[clen - 1] & 0xdf) == 'X' &&
- + strchr (z, '.') == z + clen - 2)
- + z += clen - 1;
- + *z = 'L';
- +#else
- if (z == NULL)
- *zcopy = 'L';
- else
- *(z + 1) = 'L';
- +#endif
-
- return fsdo_lock (zcopy, TRUE);
- }
- @@ -816,15 +932,30 @@
- const char *zfile;
- {
- char *zcopy, *z;
- +#ifdef __MINT__
- + int clen;
- +#endif
-
- zcopy = (char *) alloca (strlen (zfile) + 1);
- strcpy (zcopy, zfile);
-
- z = strrchr (zcopy, '/');
- +#ifdef __MINT__
- + if (!z)
- + z = zcopy;
- + else
- + ++z;
- + /* if zfile matches *.X replace the last char */
- + if ((clen = strlen (z)) > 3 && (z[clen - 1] & 0xdf) == 'X' &&
- + strchr (z, '.') == z + clen - 2)
- + z += clen - 1;
- + *z = 'L';
- +#else
- if (z == NULL)
- *zcopy = 'L';
- else
- *(z + 1) = 'L';
- +#endif
-
- return fsdo_unlock (zcopy, TRUE);
- }
- diff -ru ./sys6.c /src/t103/uucp-1.03/sys6.c
- --- ./sys6.c Tue Apr 7 06:05:28 1992
- +++ /src/t103/uucp-1.03/sys6.c Mon Sep 21 03:47:52 1992
- @@ -91,6 +91,14 @@
- fsysdep_needs_cwd (zfile)
- const char *zfile;
- {
- +#ifdef __MINT__
- + char *p, ch;
- +
- + if (p = (char *) zfile)
- + for (; ch = *p; ++p)
- + if (ch == '\\')
- + *p = '/';
- +#endif
- return *zfile != '/' && *zfile != '~';
- }
-
- @@ -102,6 +110,14 @@
- const char *zfile;
- boolean flocal;
- {
- +#ifdef __MINT__
- + char *p, ch;
- +
- + if (p = (char *) zfile)
- + for (; ch = *p; ++p)
- + if (ch == '\\')
- + *p = '/';
- +#endif
- if (*zfile == '/')
- return zfile;
- if (*zfile == '~')
- @@ -127,7 +143,14 @@
- const char *zfile;
- {
- const char *z;
- +#ifdef __MINT__
- + char *p, ch;
-
- + if (p = (char *) zfile)
- + for (; ch = *p; ++p)
- + if (ch == '\\')
- + *p = '/';
- +#endif
- z = strrchr (zfile, '/');
- if (z != NULL)
- return z + 1;
- @@ -221,7 +244,12 @@
- return TRUE;
- }
- *pfworked = FALSE;
- +#ifdef __MINT__
- + /* link() works only on some filesystems, on the default one it gets EINVAL */
- + return errno == EXDEV || errno == EINVAL;
- +#else
- return errno == EXDEV;
- +#endif
- }
-
- /*
- diff -ru ./sys7.c /src/t103/uucp-1.03/sys7.c
- --- ./sys7.c Tue Apr 7 06:05:30 1992
- +++ /src/t103/uucp-1.03/sys7.c Wed Jan 6 20:39:54 1993
- @@ -210,7 +210,11 @@
- e = fopen (zfile, "r");
- if (e == NULL)
- {
- +#ifdef __MINT__
- + if (errno == ENOENT || errno == EPATH)
- +#else
- if (errno == ENOENT)
- +#endif
- ulog (LOG_ERROR, "%s: Job not found", zid);
- else
- ulog (LOG_ERROR, "fopen (%s): %s", zfile, strerror (errno));
- @@ -262,7 +266,11 @@
- else
- isys = ussettime (ztemp);
-
- +#ifdef __MINT__
- + if (isys != 0 && errno != ENOENT && errno != EPATH)
- +#else
- if (isys != 0 && errno != ENOENT)
- +#endif
- {
- ulog (LOG_ERROR, "%s (%s): %s",
- fkill ? "remove" : "utime", ztemp,
- @@ -282,7 +290,11 @@
- else
- isys = ussettime (zfile);
-
- +#ifdef __MINT__
- + if (isys != 0 && errno != ENOENT && errno != EPATH)
- +#else
- if (isys != 0 && errno != ENOENT)
- +#endif
- {
- ulog (LOG_ERROR, "%s (%s): %s", fkill ? "remove" : "utime",
- zfile, strerror (errno));
- @@ -314,7 +326,11 @@
-
- if (stat (zfile, &s) < 0)
- {
- +#ifdef __MINT__
- + if (errno != ENOENT && errno != EPATH)
- +#else
- if (errno != ENOENT)
- +#endif
- ulog (LOG_ERROR, "stat (%s): %s", zfile, strerror (errno));
- return isysdep_time ((long *) NULL);
- }
- @@ -332,7 +348,11 @@
-
- if (stat (zfile, &s) < 0)
- {
- +#ifdef __MINT__
- + if (errno != ENOENT && errno != EPATH)
- +#else
- if (errno != ENOENT)
- +#endif
- ulog (LOG_ERROR, "stat (%s): %s", zfile, strerror (errno));
- return 0;
- }
- @@ -466,8 +486,17 @@
- int ierr;
- int ipid;
-
- +#ifdef __MINT__
- + /* look for _*.lck too... */
- + if ((qentry->d_name[0] == '_' &&
- + strncasecmp (qentry->d_name + strlen(qentry->d_name) - sizeof ".lck",
- + ".lck", sizeof ".lck" - 1) != 0) ||
- + strncmp (qentry->d_name, "LCK..", sizeof "LCK.." - 1) != 0)
- + continue;
- +#else
- if (strncmp (qentry->d_name, "LCK..", sizeof "LCK.." - 1) != 0)
- continue;
- +#endif
-
- zname = zsappend (zdir, qentry->d_name);
- o = open (zname, O_RDONLY, 0);
- diff -ru ./sysdep.h /src/t103/uucp-1.03/sysdep.h
- --- ./sysdep.h Tue Apr 7 06:05:30 1992
- +++ /src/t103/uucp-1.03/sysdep.h Thu Sep 17 00:57:24 1992
- @@ -217,8 +217,13 @@
- #endif
-
- /* On Unix, binary files are the same as text files. */
- +#ifdef __MINT__
- +#define BINREAD "rb"
- +#define BINWRITE "wb"
- +#else
- #define BINREAD "r"
- #define BINWRITE "w"
- +#endif
-
- /* If we have sigaction, we can force system calls to not be
- restarted. */
- @@ -388,22 +393,27 @@
-
- #ifndef S_IRUSR
-
- -#define S_IRWXU 0700
- #define S_IRUSR 0400
- #define S_IWUSR 0200
- #define S_IXUSR 0100
-
- -#define S_IRWXG 0070
- #define S_IRGRP 0040
- #define S_IWGRP 0020
- #define S_IXGRP 0010
-
- -#define S_IRWXO 0007
- #define S_IROTH 0004
- #define S_IWOTH 0002
- #define S_IXOTH 0001
-
- #endif /* ! defined (S_IRUSR) */
- +
- +#ifndef S_IRWXU
- +
- +#define S_IRWXU 0700
- +#define S_IRWXG 0070
- +#define S_IRWXO 0007
- +
- +#endif
-
- #ifndef S_ISDIR
- #ifdef S_IFDIR
- diff -ru ./sysinf.c /src/t103/uucp-1.03/sysinf.c
- --- ./sysinf.c Tue Apr 7 06:05:30 1992
- +++ /src/t103/uucp-1.03/sysinf.c Mon Oct 12 17:06:20 1992
- @@ -1566,7 +1566,9 @@
-
- #endif /* HAVE_TAYLOR_CONFIG */
-
- -#if HAVE_TAYLOR_CONFIG
- +/* accept g parameters in brackets in bnu.c -nox */
- +/* #if HAVE_TAYLOR_CONFIG */
- +#if HAVE_TAYLOR_CONFIG || HAVE_BNU_CONFIG
-
- /* Add a protocol parameter entry. The pc parameter points to the
- number of protocol parameter entries, and the pq parameter points
- diff -ru ./tstuu.c /src/t103/uucp-1.03/tstuu.c
- --- ./tstuu.c Tue Apr 7 06:05:32 1992
- +++ /src/t103/uucp-1.03/tstuu.c Wed Jan 6 20:42:10 1993
- @@ -242,6 +242,12 @@
-
- #include "getopt.h"
-
- +#ifdef __MINT__
- +long _stksize = 0x8000;
- +#include <process.h>
- +#include <osbind.h>
- +#endif
- +
- /* Get definitions for both O_NONBLOCK and O_NDELAY. */
-
- #ifndef O_NDELAY
- @@ -373,8 +379,13 @@
- const char *zcmd1, *zcmd2;
- const char *zpty;
- const char *zsys;
- +#ifdef __MINT__
- + char abpty1[sizeof "/pipe/ptyp0"];
- + char abpty2[sizeof "/pipe/ptyp0"];
- +#else
- char abpty1[sizeof "/dev/ptyp0"];
- char abpty2[sizeof "/dev/ptyp0"];
- +#endif
- char *zptyname;
- int omaster1, oslave1, omaster2, oslave2;
-
- @@ -443,6 +454,16 @@
- int om, os;
- FILE *e;
-
- +#ifdef __MINT__
- + /* MiNT has a special dir for pipes + ptys... */
- + sprintf (zptyname, "\\pipe\\pty%c%c", *zpty,
- + "0123456789abcdef"[ipty]);
- + om = Fcreate (zptyname, 4 | 2);
- + if (om < 0)
- + continue;
- + *zptyname = '/';
- + zptyname[sizeof "/pipe" - 1] = '/';
- +#else
- sprintf (zptyname, "/dev/pty%c%c", *zpty,
- "0123456789abcdef"[ipty]);
- om = open (zptyname, O_RDWR);
- @@ -449,6 +470,7 @@
- if (om < 0)
- continue;
- zptyname[5] = 't';
- +#endif
- os = open (zptyname, O_RDWR);
- if (os < 0)
- {
- @@ -467,7 +489,11 @@
- perror ("fopen");
- exit (EXIT_FAILURE);
- }
- +#ifdef __MINT__
- + fprintf (e, "%s", zptyname + 6);
- +#else
- fprintf (e, "%s", zptyname + 5);
- +#endif
- if (fclose (e) != 0)
- {
- perror ("fclose");
- @@ -487,7 +513,11 @@
- perror ("fopen");
- exit (EXIT_FAILURE);
- }
- +#ifdef __MINT__
- + fprintf (e, "%s", zptyname + 6);
- +#else
- fprintf (e, "%s", zptyname + 5);
- +#endif
- if (fclose (e) != 0)
- {
- perror ("fclose");
- @@ -560,8 +590,13 @@
- exit (system ((char *) zcmd1));
- else
- {
- +#ifdef __MINT__
- + (void) execl ("uucico.ttp", "uucico", "-I", "/usr/tmp/tstuu/Config1",
- + "-q", "-S", zsys, "-pstdin", (const char *) NULL);
- +#else
- (void) execl ("uucico", "uucico", "-I", "/usr/tmp/tstuu/Config1",
- "-q", "-S", zsys, "-pstdin", (const char *) NULL);
- +#endif
- fprintf (stderr, "execl failed\n");
- exit (EXIT_FAILURE);
- }
- @@ -603,8 +638,13 @@
- exit (system ((char *) zcmd2));
- else
- {
- +#ifdef __MINT__
- + (void) execl ("uucico.ttp", "uucico", "-I", "/usr/tmp/tstuu/Config2",
- + "-lq", (const char *)NULL);
- +#else
- (void) execl ("uucico", "uucico", "-I", "/usr/tmp/tstuu/Config2",
- "-lq", (const char *)NULL);
- +#endif
- fprintf (stderr, "execl failed\n");
- exit (EXIT_FAILURE);
- }
- @@ -764,7 +804,11 @@
- int i;
- FILE *e;
-
- +#ifdef __MINT__
- + e = xfopen (z, "wb");
- +#else
- e = xfopen (z, "w");
- +#endif
-
- for (i = 0; i < 256; i++)
- {
- @@ -791,7 +835,11 @@
- int i;
- FILE *e;
-
- +#ifdef __MINT__
- + e = xfopen (z, "rb");
- +#else
- e = xfopen (z, "r");
- +#endif
-
- for (i = 0; i < 256; i++)
- {
- @@ -932,20 +980,35 @@
- {
- FILE *eprog;
-
- +#ifdef __MINT__
- + eprog = xfopen ("/usr/tmp/tstuu/Chat1.sh", "w");
- +#else
- eprog = xfopen ("/usr/tmp/tstuu/Chat1", "w");
- +#endif
-
- /* Wait for the other side to open the port and flush input. */
- fprintf (eprog, "sleep 1\n");
- fprintf (eprog,
- "echo password $1 speed $2 1>&2\n");
- +#ifdef __MINT__
- + /* workaround for shells that always do crlf expansion... */
- + fprintf (eprog, "echo -n test1\\\\015\n");
- +#else
- fprintf (eprog, "echo test1\n");
- +#endif
- fprintf (eprog, "exit 0\n");
-
- xfclose (eprog);
-
- +#ifdef __MINT__
- + (void) chmod ("/usr/tmp/tstuu/Chat1.sh", S_IRWXU);
- +
- + fprintf (e, "chat-program /usr/tmp/tstuu/Chat1.sh \\P \\S\n");
- +#else
- (void) chmod ("/usr/tmp/tstuu/Chat1", S_IRWXU);
-
- fprintf (e, "chat-program /usr/tmp/tstuu/Chat1 \\P \\S\n");
- +#endif
-
- fprintf (e, "chat word: \\P\n");
- fprintf (e, "chat-fail login;\n");
- @@ -1021,7 +1084,11 @@
- if (zProtocols != NULL)
- fprintf (e, "protocol %s\n", zProtocols);
-
- +#ifdef __MINT__
- + eprog = xfopen ("/usr/tmp/tstuu/Chat2.sh", "w");
- +#else
- eprog = xfopen ("/usr/tmp/tstuu/Chat2", "w");
- +#endif
-
- fprintf (eprog,
- "echo port $1 1>&2\n");
- @@ -1029,7 +1096,11 @@
-
- xfclose (eprog);
-
- +#ifdef __MINT__
- + fprintf (e, "called-chat-program /bin/sh /usr/tmp/tstuu/Chat2.sh \\Y\n");
- +#else
- fprintf (e, "called-chat-program /bin/sh /usr/tmp/tstuu/Chat2 \\Y\n");
- +#endif
- fprintf (e, "time any\n");
-
- xfclose (e);
- @@ -1103,7 +1174,12 @@
- (void) remove (zto);
- umake_file (zfrom, 5);
-
- +#ifdef __MINT__
- + /* avoid problems with some shells... */
- + sprintf (ab, "%s -c '~/from3' test1!~/to3", zuucp2);
- +#else
- sprintf (ab, "%s -c \\~/from3 test1!~/to3", zuucp2);
- +#endif
- xsystem (ab);
- }
-
- @@ -1149,13 +1225,22 @@
-
- if (fcall_uucico)
- {
- +#ifdef __MINT__
- + /* avoid problems with some shells... */
- + zfrom = "'/usr/spool/uucppublic/to6*'";
- +#else
- zfrom = "/usr/spool/uucppublic/to6\\*";
- +#endif
- zfrom1 = "/usr/spool/uucppublic/to6.1";
- zfrom2 = "/usr/spool/uucppublic/to6.2";
- }
- else
- {
- +#ifdef __MINT__
- + zfrom = "'/usr/tmp/tstuu/spool2/to6*'";
- +#else
- zfrom = "/usr/tmp/tstuu/spool2/to6\\*";
- +#endif
- zfrom1 = "/usr/tmp/tstuu/spool2/to6.1";
- zfrom2 = "/usr/tmp/tstuu/spool2/to6.2";
- }
- @@ -1193,8 +1278,13 @@
- (void) remove (zto1);
- (void) remove (zto2);
-
- +#ifdef __MINT__
- + sprintf (ab, "%s 'test1!/usr/tmp/tstuu/spool1/to7.*' %s", zuucp2,
- + zto);
- +#else
- sprintf (ab, "%s test1!/usr/tmp/tstuu/spool1/to7.\\* %s", zuucp2,
- zto);
- +#endif
- xsystem (ab);
- }
- }
- @@ -1399,8 +1489,16 @@
- const char *zcmd;
- {
- int istat;
- +#ifdef __MINT__
- + char *p = (char *) zcmd, *sh = getenv("SHELL");
- +
- + if (!sh)
- + sh = "/bin/sh";
-
- + istat = spawnl (P_WAIT, sh, sh, "-c", p, (char *) NULL);
- +#else
- istat = system ((char *) zcmd);
- +#endif
- if (istat != 0)
- {
- fprintf (stderr, "Command failed with status %d\n", istat);
-