diff options
author | obrien <obrien@FreeBSD.org> | 2000-12-09 09:35:55 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 2000-12-09 09:35:55 +0000 |
commit | c2ee1dcc02035d781d6c70f06df7106979a9f870 (patch) | |
tree | 757810dc1fdd19be4c8125ccb9e8beb1aff3d929 /gnu/libexec/uucp | |
parent | c174181f432119d1dae3f5e58ecc14c8d7b6f545 (diff) | |
download | FreeBSD-src-c2ee1dcc02035d781d6c70f06df7106979a9f870.zip FreeBSD-src-c2ee1dcc02035d781d6c70f06df7106979a9f870.tar.gz |
Add `_PATH_DEVZERO'.
Use _PATH_* where where possible.
Diffstat (limited to 'gnu/libexec/uucp')
-rw-r--r-- | gnu/libexec/uucp/contrib/tstout.c | 4 | ||||
-rw-r--r-- | gnu/libexec/uucp/libunix/cohtty.c | 10 | ||||
-rw-r--r-- | gnu/libexec/uucp/libunix/cusub.c | 13 | ||||
-rw-r--r-- | gnu/libexec/uucp/libunix/detach.c | 13 | ||||
-rw-r--r-- | gnu/libexec/uucp/libunix/init.c | 9 | ||||
-rw-r--r-- | gnu/libexec/uucp/libunix/portnm.c | 7 | ||||
-rw-r--r-- | gnu/libexec/uucp/libunix/serial.c | 19 | ||||
-rw-r--r-- | gnu/libexec/uucp/libunix/spawn.c | 5 | ||||
-rw-r--r-- | gnu/libexec/uucp/libunix/tli.c | 5 |
9 files changed, 53 insertions, 32 deletions
diff --git a/gnu/libexec/uucp/contrib/tstout.c b/gnu/libexec/uucp/contrib/tstout.c index dd82633..92eca75 100644 --- a/gnu/libexec/uucp/contrib/tstout.c +++ b/gnu/libexec/uucp/contrib/tstout.c @@ -15,6 +15,8 @@ This program must run suid to root. */ +/* $FreeBSD$ */ + #include <stdio.h> #include <string.h> @@ -36,7 +38,7 @@ main (argc, argv) 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); diff --git a/gnu/libexec/uucp/libunix/cohtty.c b/gnu/libexec/uucp/libunix/cohtty.c index 5a52df9..9cbe220 100644 --- a/gnu/libexec/uucp/libunix/cohtty.c +++ b/gnu/libexec/uucp/libunix/cohtty.c @@ -2,6 +2,8 @@ Hemedinger <bob@dalek.mwc.com> of Mark Williams Corporation and lightly edited by Ian Lance Taylor. */ +/* $FreeBSD$ */ + /* The bottom part of this file is lock.c. * This is a hacked lock.c. A full lock.c can be found in the libmisc sources * under /usr/src/misc.tar.Z. @@ -29,6 +31,7 @@ #include <ctype.h> #include <access.h> +#include <paths.h> /* 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 +142,10 @@ char enable_device[16]; /* this will hold our device name 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 +250,7 @@ const char *ttyn; 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 :-) */ } diff --git a/gnu/libexec/uucp/libunix/cusub.c b/gnu/libexec/uucp/libunix/cusub.c index c92eeba..67cd363 100644 --- a/gnu/libexec/uucp/libunix/cusub.c +++ b/gnu/libexec/uucp/libunix/cusub.c @@ -63,6 +63,7 @@ const char cusub_rcsid[] = "$FreeBSD$"; #endif /* ! defined (O_NONBLOCK) */ #include <errno.h> +#include <paths.h> /* 4.2 systems don't define SIGUSR2. This should work for them. On systems which are missing SIGUSR1, or SIGURG, you must find two @@ -156,8 +157,8 @@ fsysdep_port_access (qport) 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; } @@ -188,14 +189,14 @@ fsysdep_port_is_line (qport, zline) 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; } diff --git a/gnu/libexec/uucp/libunix/detach.c b/gnu/libexec/uucp/libunix/detach.c index 88becf1..ad753b4 100644 --- a/gnu/libexec/uucp/libunix/detach.c +++ b/gnu/libexec/uucp/libunix/detach.c @@ -23,6 +23,8 @@ c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144. */ +/* $FreeBSD$ */ + #include "uucp.h" #include "uudefs.h" @@ -30,6 +32,7 @@ #include "sysdep.h" #include <errno.h> +#include <paths.h> #if HAVE_SYS_IOCTL_H #include <sys/ioctl.h> @@ -123,7 +126,7 @@ usysdep_detach () { 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); @@ -137,10 +140,10 @@ usysdep_detach () (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 diff --git a/gnu/libexec/uucp/libunix/init.c b/gnu/libexec/uucp/libunix/init.c index 8a3c416..fade17c 100644 --- a/gnu/libexec/uucp/libunix/init.c +++ b/gnu/libexec/uucp/libunix/init.c @@ -23,6 +23,8 @@ c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144. */ +/* $FreeBSD$ */ + #include "uucp.h" #include "uudefs.h" @@ -31,6 +33,7 @@ #include "sysdep.h" #include <errno.h> +#include <paths.h> #include <pwd.h> #if HAVE_FCNTL_H @@ -189,13 +192,13 @@ usysdep_initialize (puuconf,iflags) /* 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); diff --git a/gnu/libexec/uucp/libunix/portnm.c b/gnu/libexec/uucp/libunix/portnm.c index 9eda4ab..11f1247 100644 --- a/gnu/libexec/uucp/libunix/portnm.c +++ b/gnu/libexec/uucp/libunix/portnm.c @@ -1,6 +1,8 @@ /* portnm.c Get the port name of stdin. */ +/* $FreeBSD$ */ + #include "uucp.h" #include "sysdep.h" @@ -12,6 +14,7 @@ #endif #include <sys/socket.h> #endif +#include <paths.h> #ifndef ttyname extern char *ttyname (); @@ -44,8 +47,8 @@ zsysdep_port_name (ftcp_port) 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; } diff --git a/gnu/libexec/uucp/libunix/serial.c b/gnu/libexec/uucp/libunix/serial.c index f5d8816..0c2a5b3 100644 --- a/gnu/libexec/uucp/libunix/serial.c +++ b/gnu/libexec/uucp/libunix/serial.c @@ -37,6 +37,7 @@ const char serial_rcsid[] = "$FreeBSD$"; #include <errno.h> #include <ctype.h> +#include <paths.h> #if HAVE_SYS_PARAM_H #include <sys/param.h> @@ -497,10 +498,10 @@ fsserial_init (qconn, qcmds, zdevice) 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; @@ -519,7 +520,7 @@ fsysdep_stdin_init (qconn) { /* 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); } @@ -959,8 +960,8 @@ fsserial_open (qconn, ibaud, fwait, tlocal) #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); @@ -1651,8 +1652,8 @@ fsysdep_modem_begin_dial (qconn, qdial) 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; } diff --git a/gnu/libexec/uucp/libunix/spawn.c b/gnu/libexec/uucp/libunix/spawn.c index d39e2ba..6a413c4 100644 --- a/gnu/libexec/uucp/libunix/spawn.c +++ b/gnu/libexec/uucp/libunix/spawn.c @@ -23,12 +23,15 @@ c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144. */ +/* $FreeBSD$ */ + #include "uucp.h" #include "uudefs.h" #include "sysdep.h" #include <errno.h> +#include <paths.h> #if HAVE_FCNTL_H #include <fcntl.h> @@ -210,7 +213,7 @@ ixsspawn (pazargs, aidescs, fkeepuid, fkeepenv, zchdir, fnosigs, fshell, { 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) diff --git a/gnu/libexec/uucp/libunix/tli.c b/gnu/libexec/uucp/libunix/tli.c index 714942e..0330646 100644 --- a/gnu/libexec/uucp/libunix/tli.c +++ b/gnu/libexec/uucp/libunix/tli.c @@ -38,6 +38,7 @@ const char tli_rcsid[] = "$FreeBSD$"; #include "system.h" #include <errno.h> +#include <paths.h> #if HAVE_SYS_IOCTL_H #include <sys/ioctl.h> @@ -267,8 +268,8 @@ ftli_open (qconn, ibaud, fwait) 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; } |