--- unix/cohtty.c.orig Thu May 29 08:08:48 2003 +++ unix/cohtty.c Thu Jun 12 05:03:30 2003 @@ -29,6 +29,7 @@ #include #include +#include /* fscoherent_disable_tty() is a COHERENT specific function. It takes the name * of a serial device and then scans /etc/ttys for a match. If it finds one, @@ -139,9 +140,10 @@ x = ixswait ((unsigned long) ipid, (const char *) NULL); } - *pzenable = zbufalc (sizeof "/dev/" + *pzenable = zbufalc (sizeof _PATH_DEV + strlen (enable_device)); - sprintf(*pzenable,"/dev/%s", enable_device); + sprintf(*pzenable,"%s%s",_PATH_DEV, + enable_device); /* ulog(LOG_NORMAL,"Enable string is {%s}",*pzenable); */ return TRUE; }else{ @@ -246,7 +248,7 @@ char resource[LOKFLEN]; char filename[LOKFLEN]; - sprintf(filename, "/dev/%s", ttyn); + sprintf(filename, "%s%s", _PATH_DEV, ttyn); if (NULL == gen_res_name(filename, resource)){ return(0); /* Non-existent tty can not be locked :-) */ } --- unix/cusub.c.orig Thu May 29 08:08:48 2003 +++ unix/cusub.c Thu Jun 12 05:03:30 2003 @@ -62,6 +62,7 @@ #endif /* ! defined (O_NONBLOCK) */ #include +#include /* 4.2 systems don't define SIGUSR2. This should work for them. On systems which are missing SIGUSR1, or SIGURG, you must find two @@ -155,8 +156,8 @@ zfree = NULL; if (*zline != '/') { - zfree = zbufalc (sizeof "/dev/" + strlen (zline)); - sprintf (zfree, "/dev/%s", zline); + zfree = zbufalc (sizeof _PATH_DEV + strlen (zline)); + sprintf (zfree, "%s%s", _PATH_DEV, zline); zline = zfree; } @@ -187,14 +188,14 @@ zfree2 = NULL; if (*zline != '/') { - zfree1 = zbufalc (sizeof "/dev/" + strlen (zline)); - sprintf (zfree1, "/dev/%s", zline); + zfree1 = zbufalc (sizeof _PATH_DEV + strlen (zline)); + sprintf (zfree1, "%s%s", _PATH_DEV, zline); zline = zfree1; } if (*zpline != '/') { - zfree2 = zbufalc (sizeof "/dev/" + strlen (zpline)); - sprintf (zfree2, "/dev/%s", zpline); + zfree2 = zbufalc (sizeof _PATH_DEV + strlen (zpline)); + sprintf (zfree2, "%s%s", _PATH_DEV, zpline); zpline = zfree2; } --- unix/detach.c.orig Thu May 29 08:08:48 2003 +++ unix/detach.c Thu Jun 12 05:03:30 2003 @@ -29,6 +29,7 @@ #include "sysdep.h" #include +#include #if HAVE_SYS_IOCTL_H #include @@ -122,7 +123,7 @@ { int o; - o = open ((char *) "/dev/tty", O_RDONLY); + o = open ((char *) _PATH_TTY, O_RDONLY); if (o >= 0) { (void) ioctl (o, TIOCNOTTY, (char *) NULL); @@ -136,10 +137,10 @@ (void) close (0); (void) close (1); (void) close (2); - if (open ((char *) "/dev/null", O_RDONLY) != 0 - || open ((char *) "/dev/null", O_WRONLY) != 1 - || open ((char *) "/dev/null", O_WRONLY) != 2) - ulog (LOG_FATAL, "open (/dev/null): %s", strerror (errno)); + if (open ((char *) _PATH_DEVNULL, O_RDONLY) != 0 + || open ((char *) _PATH_DEVNULL, O_WRONLY) != 1 + || open ((char *) _PATH_DEVNULL, O_WRONLY) != 2) + ulog (LOG_FATAL, "open (%s): %s", _PATH_DEVNULL, strerror (errno)); #if HAVE_SETSID --- unix/init.c.orig Thu May 29 08:08:49 2003 +++ unix/init.c Thu Jun 12 05:03:30 2003 @@ -30,6 +30,7 @@ #include "sysdep.h" #include +#include #include #if HAVE_FCNTL_H @@ -188,13 +189,13 @@ /* Make sure stdin, stdout and stderr are open. */ if (fcntl (0, F_GETFD, 0) < 0 - && open ((char *) "/dev/null", O_RDONLY, 0) != 0) + && open ((char *) _PATH_DEVNULL, O_RDONLY, 0) != 0) exit (EXIT_FAILURE); if (fcntl (1, F_GETFD, 0) < 0 - && open ((char *) "/dev/null", O_WRONLY, 0) != 1) + && open ((char *) _PATH_DEVNULL, O_WRONLY, 0) != 1) exit (EXIT_FAILURE); if (fcntl (2, F_GETFD, 0) < 0 - && open ((char *) "/dev/null", O_WRONLY, 0) != 2) + && open ((char *) _PATH_DEVNULL, O_WRONLY, 0) != 2) exit (EXIT_FAILURE); iuuconf = uuconf_spooldir (puuconf, &zSspooldir); --- unix/portnm.c.orig Thu May 29 08:08:49 2003 +++ unix/portnm.c Thu Jun 12 05:03:30 2003 @@ -12,6 +12,7 @@ #endif #include #endif +#include #ifndef ttyname extern char *ttyname (); @@ -44,8 +45,8 @@ z = ttyname (0); if (z == NULL) return NULL; - if (strncmp (z, "/dev/", sizeof "/dev/" - 1) == 0) - return z + sizeof "/dev/" - 1; + if (strncmp (z, _PATH_DEV, sizeof _PATH_DEV - 1) == 0) + return z + sizeof _PATH_DEV - 1; else return z; } --- unix/serial.c.orig Thu May 29 08:08:49 2003 +++ unix/serial.c Thu Jun 12 05:08:58 2003 @@ -36,6 +36,7 @@ #include #include +#include #if HAVE_SYS_PARAM_H #include @@ -501,10 +502,10 @@ size_t clen; clen = strlen (zdevice); - q->zdevice = zbufalc (sizeof "/dev/" + clen); - memcpy (q->zdevice, "/dev/", sizeof "/dev/" - 1); - memcpy (q->zdevice + sizeof "/dev/" - 1, zdevice, clen); - q->zdevice[sizeof "/dev/" + clen - 1] = '\0'; + q->zdevice = zbufalc (sizeof _PATH_DEV + clen); + memcpy (q->zdevice, _PATH_DEV, sizeof _PATH_DEV - 1); + memcpy (q->zdevice + sizeof _PATH_DEV - 1, zdevice, clen); + q->zdevice[sizeof _PATH_DEV + clen - 1] = '\0'; } q->o = -1; q->ord = -1; @@ -523,7 +524,7 @@ { /* chmod /dev/tty to prevent other users from writing messages to it. This is essentially `mesg n'. */ - (void) chmod ("/dev/tty", S_IRUSR | S_IWUSR); + (void) chmod (_PATH_TTY, S_IRUSR | S_IWUSR); return fsserial_init (qconn, &sstdincmds, (const char *) NULL); } @@ -999,6 +1000,9 @@ #ifdef B4000000 { B4000000, 4000000 }, #endif +#ifdef B230400 + { B230400, 230400 }, +#endif { B0, 0 } }; @@ -1036,8 +1040,8 @@ #else const char *z; - if (strncmp (q->zdevice, "/dev/", sizeof "/dev/" - 1) == 0) - z = q->zdevice + sizeof "/dev/" - 1; + if (strncmp (q->zdevice, _PATH_DEV, sizeof _PATH_DEV - 1) == 0) + z = q->zdevice + sizeof _PATH_DEV - 1; else z = q->zdevice; ulog_device (z); @@ -1764,8 +1768,8 @@ zfree = NULL; if (*z != '/') { - zfree = zbufalc (sizeof "/dev/" + strlen (z)); - sprintf (zfree, "/dev/%s", z); + zfree = zbufalc (sizeof _PATH_DEV + strlen (z)); + sprintf (zfree, "%s%s", _PATH_DEV, z); z = zfree; } @@ -2540,7 +2544,7 @@ else csleepchars = MAX_INPUT - 10; - isleep = (int) (((long) csleepchars * 10000L) / q->ibaud); + isleep = (int) (((long) csleepchars * 10000L) / (q->ibaud? q->ibaud: (long)1200)); isleep -= 10; if (isleep > 10) @@ -2956,8 +2960,8 @@ cwait = 1024; if (cwait > cread) cwait = cread; - stime.tv_sec = (cwait * 10) / q->ibaud; - stime.tv_usec = ((((cwait * 1000000) / q->ibaud) * 10) + stime.tv_sec = (cwait * 10) / (q->ibaud? q->ibaud: (long)1200); + stime.tv_usec = ((((cwait * 1000000) / (q->ibaud? q->ibaud: (long)1200)) * 10) % 1000000); } else @@ -3048,7 +3052,7 @@ that HAVE_RESTARTABLE_SYSCALLS is 0. */ usset_signal (SIGALRM, usalarm, TRUE, (boolean *) NULL); if (q->fterminal) - alarm ((int) ((long) 10240 / q->ibaud) + 1); + alarm ((int) ((long) 10240 / (q->ibaud? q->ibaud: (long)1200)) + 1); else alarm (1); --- unix/spawn.c.orig Thu May 29 08:08:49 2003 +++ unix/spawn.c Thu Jun 12 05:03:30 2003 @@ -28,6 +28,7 @@ #include "sysdep.h" #include +#include #if HAVE_FCNTL_H #include @@ -209,7 +210,7 @@ { if (onull < 0) { - onull = open ((char *) "/dev/null", O_RDWR); + onull = open ((char *) _PATH_DEVNULL, O_RDWR); if (onull < 0 || fcntl (onull, F_SETFD, fcntl (onull, F_GETFD, 0) | FD_CLOEXEC) < 0) --- unix/tli.c.orig Thu May 29 08:08:49 2003 +++ unix/tli.c Thu Jun 12 05:03:30 2003 @@ -37,6 +37,7 @@ #include "system.h" #include +#include #if HAVE_SYS_IOCTL_H #include @@ -268,8 +269,8 @@ zfreedev = NULL; if (*zdevice != '/') { - zfreedev = zbufalc (sizeof "/dev/" + strlen (zdevice)); - sprintf (zfreedev, "/dev/%s", zdevice); + zfreedev = zbufalc (sizeof _PATH_DEV + strlen (zdevice)); + sprintf (zfreedev, "%s%s", _PATH_DEV, zdevice); zdevice = zfreedev; } --- contrib/tstout.c.orig Thu May 29 08:08:48 2003 +++ contrib/tstout.c Thu Jun 12 05:03:30 2003 @@ -36,7 +36,7 @@ char *z; if (argc != 2 - || strncmp (argv[1], "/dev/", sizeof "/dev/" - 1) != 0) + || strncmp (argv[1], _PATH_DEV, sizeof _PATH_DEV - 1) != 0) { fprintf (stderr, "Usage: tstout device\n"); exit (EXIT_FAILURE);