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 | |
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')
-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 | ||||
-rw-r--r-- | gnu/usr.bin/binutils/gdb/alpha/kvm-fbsd.c | 5 | ||||
-rw-r--r-- | gnu/usr.bin/binutils/gdb/i386/kvm-fbsd.c | 5 | ||||
-rw-r--r-- | gnu/usr.bin/binutils/gdb/kvm-fbsd.c | 5 | ||||
-rw-r--r-- | gnu/usr.bin/patch/util.c | 8 |
13 files changed, 71 insertions, 37 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; } diff --git a/gnu/usr.bin/binutils/gdb/alpha/kvm-fbsd.c b/gnu/usr.bin/binutils/gdb/alpha/kvm-fbsd.c index 5c28908..6da1a8e 100644 --- a/gnu/usr.bin/binutils/gdb/alpha/kvm-fbsd.c +++ b/gnu/usr.bin/binutils/gdb/alpha/kvm-fbsd.c @@ -19,6 +19,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/* $FreeBSD$ */ + /* * This works like "remote" but, you use it like this: * target kcore /dev/mem @@ -37,6 +39,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <signal.h> #include <fcntl.h> #include <kvm.h> +#include <paths.h> #include "defs.h" #include "gdb_string.h" @@ -110,7 +113,7 @@ initial_pcb() return (0); /* If this is NOT /dev/mem try for dumppcb. */ - if (strncmp(core_file, "/dev/", 5)) { + if (strncmp(core_file, _PATH_DEV, sizeof _PATH_DEV - 1)) { sym = lookup_minimal_symbol("dumppcb", NULL, NULL); if (sym != NULL) { addr = SYMBOL_VALUE_ADDRESS(sym); diff --git a/gnu/usr.bin/binutils/gdb/i386/kvm-fbsd.c b/gnu/usr.bin/binutils/gdb/i386/kvm-fbsd.c index 2608e3c..a08254d 100644 --- a/gnu/usr.bin/binutils/gdb/i386/kvm-fbsd.c +++ b/gnu/usr.bin/binutils/gdb/i386/kvm-fbsd.c @@ -17,11 +17,14 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/* $FreeBSD$ */ + #include "defs.h" #include <errno.h> #include <signal.h> #include <fcntl.h> +#include <paths.h> #include <sys/sysctl.h> #include <sys/param.h> #include <sys/time.h> @@ -540,7 +543,7 @@ kvm_open (efile, cfile, sfile, perm, errout) && stb.st_rdev == makedev (2, 0)) { devmem = 1; - kfd = open ("/dev/kmem", perm, 0); + kfd = open (_PATH_KMEM, perm, 0); } if (lookup_minimal_symbol("mp_ncpus", NULL, NULL)) { diff --git a/gnu/usr.bin/binutils/gdb/kvm-fbsd.c b/gnu/usr.bin/binutils/gdb/kvm-fbsd.c index 2608e3c..a08254d 100644 --- a/gnu/usr.bin/binutils/gdb/kvm-fbsd.c +++ b/gnu/usr.bin/binutils/gdb/kvm-fbsd.c @@ -17,11 +17,14 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/* $FreeBSD$ */ + #include "defs.h" #include <errno.h> #include <signal.h> #include <fcntl.h> +#include <paths.h> #include <sys/sysctl.h> #include <sys/param.h> #include <sys/time.h> @@ -540,7 +543,7 @@ kvm_open (efile, cfile, sfile, perm, errout) && stb.st_rdev == makedev (2, 0)) { devmem = 1; - kfd = open ("/dev/kmem", perm, 0); + kfd = open (_PATH_KMEM, perm, 0); } if (lookup_minimal_symbol("mp_ncpus", NULL, NULL)) { diff --git a/gnu/usr.bin/patch/util.c b/gnu/usr.bin/patch/util.c index 258490b..277440c 100644 --- a/gnu/usr.bin/patch/util.c +++ b/gnu/usr.bin/patch/util.c @@ -1,3 +1,7 @@ +/* $FreeBSD$ */ + +#include <paths.h> + #include "EXTERN.h" #include "common.h" #include "INTERN.h" @@ -247,7 +251,7 @@ long arg1,arg2,arg3; write(1, buf, strlen(buf)); r = read(1, buf, sizeof buf); } - else if ((ttyfd = open("/dev/tty", 2)) >= 0 && isatty(ttyfd)) { + else if ((ttyfd = open(_PATH_TTY, 2)) >= 0 && isatty(ttyfd)) { /* might be deleted or unwriteable */ write(ttyfd, buf, strlen(buf)); r = read(ttyfd, buf, sizeof buf); @@ -382,7 +386,7 @@ int assume_exists; if (debug & 128) say4("fetchname %s %d %d\n",at,strip_leading,assume_exists); #endif - if (strnEQ(at, "/dev/null", 9)) /* so files can be created by diffing */ + if (strnEQ(at, _PATH_DEVNULL, sizeof _PATH_DEVNULL - 1)) /* so files can be created by diffing */ return Nullch; /* against /dev/null. */ name = fullname = t = savestr(at); |