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 /usr.sbin | |
parent | c174181f432119d1dae3f5e58ecc14c8d7b6f545 (diff) | |
download | FreeBSD-src-c2ee1dcc02035d781d6c70f06df7106979a9f870.zip FreeBSD-src-c2ee1dcc02035d781d6c70f06df7106979a9f870.tar.gz |
Add `_PATH_DEVZERO'.
Use _PATH_* where where possible.
Diffstat (limited to 'usr.sbin')
30 files changed, 86 insertions, 52 deletions
diff --git a/usr.sbin/atm/atmarpd/atmarpd.c b/usr.sbin/atm/atmarpd/atmarpd.c index 063a304..d221a59 100644 --- a/usr.sbin/atm/atmarpd/atmarpd.c +++ b/usr.sbin/atm/atmarpd/atmarpd.c @@ -52,6 +52,7 @@ #include <errno.h> #include <fcntl.h> #include <libatm.h> +#include <paths.h> #include <stdio.h> #include <string.h> #include <syslog.h> @@ -247,7 +248,7 @@ start_daemon() atmarp_log(LOG_ERR, "can't change process group"); exit(1); } - fd = open("/dev/tty", O_RDWR); + fd = open(_PATH_TTY, O_RDWR); if (fd >= 0) { ioctl(fd, TIOCNOTTY, (char *)0); close(fd); diff --git a/usr.sbin/atm/scspd/scspd.c b/usr.sbin/atm/scspd/scspd.c index a8a6d89..a6f03f3 100644 --- a/usr.sbin/atm/scspd/scspd.c +++ b/usr.sbin/atm/scspd/scspd.c @@ -53,6 +53,7 @@ #include <errno.h> #include <fcntl.h> #include <libatm.h> +#include <paths.h> #include <stdio.h> #include <string.h> #include <syslog.h> @@ -284,7 +285,7 @@ start_daemon() scsp_log(LOG_ERR, "can't change process group"); exit(1); } - fd = open("/dev/tty", O_RDWR); + fd = open(_PATH_TTY, O_RDWR); if (fd >= 0) { ioctl(fd, TIOCNOTTY, (char *)0); close(fd); diff --git a/usr.sbin/cdcontrol/cdcontrol.c b/usr.sbin/cdcontrol/cdcontrol.c index d5a754e..0161bdd 100644 --- a/usr.sbin/cdcontrol/cdcontrol.c +++ b/usr.sbin/cdcontrol/cdcontrol.c @@ -26,6 +26,7 @@ static const char rcsid[] = #include <ctype.h> #include <err.h> #include <errno.h> +#include <paths.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -1141,7 +1142,7 @@ int open_cd () if (*cdname == '/') { snprintf (devbuf, MAXPATHLEN, "%s", cdname); } else { - snprintf (devbuf, MAXPATHLEN, "/dev/%s", cdname); + snprintf (devbuf, MAXPATHLEN, "%s%s", _PATH_DEV, cdname); } fd = open (devbuf, O_RDONLY); diff --git a/usr.sbin/cron/cron/popen.c b/usr.sbin/cron/cron/popen.c index 1ac775d..f22f421 100644 --- a/usr.sbin/cron/cron/popen.c +++ b/usr.sbin/cron/cron/popen.c @@ -34,6 +34,7 @@ static const char rcsid[] = #include "cron.h" #include <sys/signal.h> #include <fcntl.h> +#include <paths.h> #if defined(SYSLOG) # include <syslog.h> #endif @@ -130,7 +131,7 @@ cron_popen(program, type, e) if (*type == 'r') { /* Do not share our parent's stdin */ (void)close(0); - (void)open("/dev/null", O_RDWR); + (void)open(_PATH_DEVNULL, O_RDWR); if (pdes[1] != 1) { dup2(pdes[1], 1); dup2(pdes[1], 2); /* stderr, too! */ @@ -144,9 +145,9 @@ cron_popen(program, type, e) } /* Hack: stdout gets revoked */ (void)close(1); - (void)open("/dev/null", O_RDWR); + (void)open(_PATH_DEVNULL, O_RDWR); (void)close(2); - (void)open("/dev/null", O_RDWR); + (void)open(_PATH_DEVNULL, O_RDWR); (void)close(pdes[1]); } # if defined(LOGIN_CAP) diff --git a/usr.sbin/cron/crontab/crontab.c b/usr.sbin/cron/crontab/crontab.c index 0071f6a..8ee2ccb 100644 --- a/usr.sbin/cron/crontab/crontab.c +++ b/usr.sbin/cron/crontab/crontab.c @@ -31,6 +31,7 @@ static const char rcsid[] = #include "cron.h" #include <errno.h> #include <fcntl.h> +#include <paths.h> #include <sys/file.h> #include <sys/stat.h> #ifdef USE_UTIMES @@ -297,8 +298,8 @@ edit_cmd() { if (errno != ENOENT) err(ERROR_EXIT, "%s", n); warnx("no crontab for %s - using an empty one", User); - if (!(f = fopen("/dev/null", "r"))) - err(ERROR_EXIT, "/dev/null"); + if (!(f = fopen(_PATH_DEVNULL, "r"))) + err(ERROR_EXIT, _PATH_DEVNULL); } um = umask(077); diff --git a/usr.sbin/cron/lib/compat.c b/usr.sbin/cron/lib/compat.c index 6057b86..9686012 100644 --- a/usr.sbin/cron/lib/compat.c +++ b/usr.sbin/cron/lib/compat.c @@ -32,6 +32,7 @@ static char rcsid[] = "$FreeBSD$"; # include <sys/ioctl.h> #endif #include <errno.h> +#include <paths.h> /* the code does not depend on any of vfork's @@ -109,7 +110,7 @@ setsid() # else newpgrp = setpgrp(0, getpid()); # endif - if ((fd = open("/dev/tty", 2)) >= 0) + if ((fd = open(_PATH_TTY, 2)) >= 0) { (void) ioctl(fd, TIOCNOTTY, (char*)0); (void) close(fd); @@ -117,9 +118,9 @@ setsid() # else /*BSD*/ newpgrp = setpgrp(); - (void) close(STDIN); (void) open("/dev/null", 0); - (void) close(STDOUT); (void) open("/dev/null", 1); - (void) close(STDERR); (void) open("/dev/null", 2); + (void) close(STDIN); (void) open(_PATH_DEVNULL, 0); + (void) close(STDOUT); (void) open(_PATH_DEVNULL, 1); + (void) close(STDERR); (void) open(_PATH_DEVNULL, 2); # endif /*BSD*/ return newpgrp; } diff --git a/usr.sbin/ctm/mkCTM/mkctm.c b/usr.sbin/ctm/mkCTM/mkctm.c index 55e2361..336e824 100644 --- a/usr.sbin/ctm/mkCTM/mkctm.c +++ b/usr.sbin/ctm/mkCTM/mkctm.c @@ -1,3 +1,5 @@ +/* $FreeBSD$ */ + /* Still missing: * * mkctm @@ -27,6 +29,7 @@ #include <unistd.h> #include <md5.h> #include <err.h> +#include <paths.h> #include <signal.h> #define DEFAULT_IGNORE "/CVS$|/\\.#|00_TRANS\\.TBL$" @@ -560,7 +563,7 @@ main(int argc, char **argv) argv += optind; if (!logf) - logf = fopen("/dev/null", "w"); + logf = fopen(_PATH_DEVNULL, "w"); setbuf(stdout, 0); diff --git a/usr.sbin/fdformat/fdformat.c b/usr.sbin/fdformat/fdformat.c index 53db668..3d6b998 100644 --- a/usr.sbin/fdformat/fdformat.c +++ b/usr.sbin/fdformat/fdformat.c @@ -43,6 +43,7 @@ #include <ctype.h> #include <err.h> #include <fcntl.h> +#include <paths.h> #include <stdio.h> #include <stdlib.h> #include <strings.h> @@ -130,7 +131,7 @@ makename(const char *arg, const char *suffix) return arg; if(*arg == '/') /* do not convert absolute pathnames */ return arg; - strcpy(namebuff, "/dev/"); + strcpy(namebuff, _PATH_DEV); strncat(namebuff, arg, 3); strcat(namebuff, suffix); return namebuff; diff --git a/usr.sbin/fdwrite/fdwrite.c b/usr.sbin/fdwrite/fdwrite.c index 4ab858e..00279c5 100644 --- a/usr.sbin/fdwrite/fdwrite.c +++ b/usr.sbin/fdwrite/fdwrite.c @@ -13,6 +13,7 @@ #include <ctype.h> #include <err.h> #include <fcntl.h> +#include <paths.h> #include <stdio.h> #include <stdlib.h> #include <strings.h> @@ -106,9 +107,9 @@ main(int argc, char **argv) if(optind < argc) usage(); - tty = fopen("/dev/tty","r+"); + tty = fopen(_PATH_TTY,"r+"); if(!tty) - err(1, "/dev/tty"); + err(1, _PATH_TTY); setbuf(tty,0); for(j=1;j > 0;) { diff --git a/usr.sbin/i4b/isdnd/exec.c b/usr.sbin/i4b/isdnd/exec.c index db08e77..180b97ab 100644 --- a/usr.sbin/i4b/isdnd/exec.c +++ b/usr.sbin/i4b/isdnd/exec.c @@ -42,6 +42,7 @@ #include <net/if.h> #include <netinet/in.h> #include <arpa/inet.h> +#include <paths.h> #define MAX_PIDS 32 @@ -214,7 +215,8 @@ exec_answer(cfg_entry_t *cep) device = bdrivername(cep->usrdevicename); - snprintf(devicename, sizeof(devicename), "/dev/i4b%s%d", device, cep->usrdeviceunit); + snprintf(devicename, sizeof(devicename), "%si4b%s%d", _PATH_DEV, device, + cep->usrdeviceunit); argv[0] = cep->answerprog; argv[1] = "-D"; diff --git a/usr.sbin/i4b/isdnd/main.c b/usr.sbin/i4b/isdnd/main.c index 9c172e0..292b9da 100644 --- a/usr.sbin/i4b/isdnd/main.c +++ b/usr.sbin/i4b/isdnd/main.c @@ -36,6 +36,7 @@ *---------------------------------------------------------------------------*/ #include <locale.h> +#include <paths.h> #ifdef I4B_EXTERNAL_MONITOR #include "monitor.h" @@ -709,7 +710,7 @@ isdnrdhdl(void) break; default: - log(LL_WRN, "ERROR, unknown message received from /dev/isdn (0x%x)", msg_rd_buf[0]); + log(LL_WRN, "ERROR, unknown message received from %sisdn (0x%x)", _PATH_DEV, msg_rd_buf[0]); break; } } diff --git a/usr.sbin/i4b/isdntelctl/main.c b/usr.sbin/i4b/isdntelctl/main.c index 4820fbd..3d75663 100644 --- a/usr.sbin/i4b/isdntelctl/main.c +++ b/usr.sbin/i4b/isdntelctl/main.c @@ -38,6 +38,7 @@ #include <stdio.h> #include <signal.h> #include <errno.h> +#include <paths.h> #include <string.h> #include <stdlib.h> #include <unistd.h> @@ -212,7 +213,7 @@ static void usage(void) { fprintf(stderr, "\n"); - fprintf(stderr, "isdntelctl - /dev/i4btel control, version %d.%d.%d (%s %s)\n",VERSION, REL, STEP, __DATE__, __TIME__); + fprintf(stderr, "isdntelctl - %si4btel control, version %d.%d.%d (%s %s)\n", _PATH_DEV, VERSION, REL, STEP, __DATE__, __TIME__); fprintf(stderr, "usage: isdntelctl -c -g -u <unit> -A -N -U\n"); fprintf(stderr, " -c clear input queue\n"); fprintf(stderr, " -g get current settings\n"); diff --git a/usr.sbin/memcontrol/memcontrol.c b/usr.sbin/memcontrol/memcontrol.c index e66f2a4..456ac07 100644 --- a/usr.sbin/memcontrol/memcontrol.c +++ b/usr.sbin/memcontrol/memcontrol.c @@ -32,6 +32,7 @@ #include <err.h> #include <fcntl.h> +#include <paths.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -107,8 +108,8 @@ main(int argc, char *argv[]) if (argc < 2) { help(NULL); } else { - if ((memfd = open("/dev/mem", O_RDONLY)) == -1) - err(1, "can't open /dev/mem"); + if ((memfd = open(_PATH_MEM, O_RDONLY)) == -1) + err(1, "can't open %s", _PATH_MEM); for (i = 0; functions[i].cmd != NULL; i++) if (!strcmp(argv[1], functions[i].cmd)) diff --git a/usr.sbin/mptable/mptable.c b/usr.sbin/mptable/mptable.c index ef780f0..784b415 100644 --- a/usr.sbin/mptable/mptable.c +++ b/usr.sbin/mptable/mptable.c @@ -49,6 +49,7 @@ static const char rcsid[] = #include <sys/types.h> #include <err.h> #include <fcntl.h> +#include <paths.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -350,7 +351,7 @@ main( int argc, char *argv[] ) } /* open physical memory for access to MP structures */ - if ( (pfd = open( "/dev/mem", O_RDONLY )) < 0 ) + if ( (pfd = open( _PATH_MEM, O_RDONLY )) < 0 ) err( 1, "mem open" ); /* probe for MP structures */ @@ -866,7 +867,7 @@ static void seekEntry( vm_offset_t addr ) { if ( lseek( pfd, (off_t)addr, SEEK_SET ) < 0 ) - err( 1, "/dev/mem seek" ); + err( 1, "%s seek", _PATH_MEM ); } diff --git a/usr.sbin/mrouted/main.c b/usr.sbin/mrouted/main.c index f3fc676..87ab3ff 100644 --- a/usr.sbin/mrouted/main.c +++ b/usr.sbin/mrouted/main.c @@ -33,6 +33,7 @@ static const char rcsid[] = #include <varargs.h> #endif #include <fcntl.h> +#include <paths.h> #ifdef SNMP #include "snmp.h" @@ -384,7 +385,7 @@ main(argc, argv) (void)setpgrp(); #else #ifdef TIOCNOTTY - t = open("/dev/tty", 2); + t = open(_PATH_TTY, 2); if (t >= 0) { (void)ioctl(t, TIOCNOTTY, (char *)0); (void)close(t); diff --git a/usr.sbin/pcvt/cursor/cursor.c b/usr.sbin/pcvt/cursor/cursor.c index 1c7c140..e4da01a 100644 --- a/usr.sbin/pcvt/cursor/cursor.c +++ b/usr.sbin/pcvt/cursor/cursor.c @@ -34,7 +34,7 @@ */ static char *id = - "@(#)cursor.c, 3.20, Last Edit-Date: [Tue Apr 4 12:27:54 1995]"; + "@(#)cursor.c, 3.20, Last Edit-Date: [Tue Apr 4 12:27:54 1995]\n$FreeBSD$"; /*---------------------------------------------------------------------------* * @@ -48,6 +48,7 @@ static char *id = #include <fcntl.h> #include <sys/stat.h> #include <machine/pcvt_ioctl.h> +#include <paths.h> #define DEFAULTFD 0 @@ -148,7 +149,7 @@ usage() { fprintf(stderr,"\ncursor - set cursor shape for pcvt video driver\n"); fprintf(stderr,"usage: cursor -d [device] -n [no] -s [line] -e [line]\n"); - fprintf(stderr," -d <device> device to use (/dev/ttyvX), default current\n"); + fprintf(stderr," -d <device> device to use (%svX), default current\n", _PATH_TTY); fprintf(stderr," -n <no> screen no if specified, else current screen\n"); fprintf(stderr," -s <line> start scan line (topmost scan line)\n"); fprintf(stderr," -e <line> ending scan line (bottom scan line)\n\n"); diff --git a/usr.sbin/pcvt/vttest/main.c b/usr.sbin/pcvt/vttest/main.c index 02cbc62..341de73 100644 --- a/usr.sbin/pcvt/vttest/main.c +++ b/usr.sbin/pcvt/vttest/main.c @@ -15,6 +15,8 @@ choice to the address below. */ +/* $FreeBSD$ */ + #include "header.h" char inchar(), *instr(), *lookup(); @@ -1846,7 +1848,7 @@ initterminal(pn) int pn; { stty(0,&sgttyNew); #ifdef SIII close(2); - open("/dev/tty",O_RDWR|O_NDELAY); + open(_PATH_TTY,O_RDWR|O_NDELAY); #endif #endif #ifdef SARG10 diff --git a/usr.sbin/pim6dd/main.c b/usr.sbin/pim6dd/main.c index 2cf17f5..5e518b4 100644 --- a/usr.sbin/pim6dd/main.c +++ b/usr.sbin/pim6dd/main.c @@ -52,6 +52,7 @@ * $FreeBSD$ */ +#include <paths.h> #include "defs.h" #ifdef SNMP @@ -424,7 +425,7 @@ main(argc, argv) (void)setpgrp(); #else #ifdef TIOCNOTTY - t = open("/dev/tty", 2); + t = open(_PATH_TTY, 2); if (t >= 0) { (void)ioctl(t, TIOCNOTTY, (char *)0); (void)close(t); diff --git a/usr.sbin/pim6sd/main.c b/usr.sbin/pim6sd/main.c index 0024286..e4ae450 100644 --- a/usr.sbin/pim6sd/main.c +++ b/usr.sbin/pim6sd/main.c @@ -60,6 +60,7 @@ #include <sys/param.h> #include <sys/time.h> #include <errno.h> +#include <paths.h> #include <stdlib.h> #include <stdio.h> #include <signal.h> @@ -466,7 +467,7 @@ usage: (void) setpgrp(); #else #ifdef TIOCNOTTY - t = open("/dev/tty", 2); + t = open(_PATH_TTY, 2); if (t >= 0) { (void) ioctl(t, TIOCNOTTY, (char *) 0); diff --git a/usr.sbin/pkg_install/add/perform.c b/usr.sbin/pkg_install/add/perform.c index a8bb500..9422c54 100644 --- a/usr.sbin/pkg_install/add/perform.c +++ b/usr.sbin/pkg_install/add/perform.c @@ -24,6 +24,7 @@ static const char rcsid[] = */ #include <err.h> +#include <paths.h> #include "lib.h" #include "add.h" @@ -363,9 +364,9 @@ pkg_do(char *pkg) printf("Running mtree for %s..\n", PkgName); p = find_plist(&Plist, PLIST_CWD); if (Verbose) - printf("mtree -U -f %s -d -e -p %s >/dev/null\n", MTREE_FNAME, p ? p->name : "/"); + printf("mtree -U -f %s -d -e -p %s >%s\n", MTREE_FNAME, p ? p->name : "/", _PATH_DEVNULL); if (!Fake) { - if (vsystem("/usr/sbin/mtree -U -f %s -d -e -p %s >/dev/null", MTREE_FNAME, p ? p->name : "/")) + if (vsystem("/usr/sbin/mtree -U -f %s -d -e -p %s >%s", MTREE_FNAME, p ? p->name : "/"), _PATH_DEVNULL) warnx("mtree returned a non-zero status - continuing"); } unlink(MTREE_FNAME); diff --git a/usr.sbin/pkg_install/lib/msg.c b/usr.sbin/pkg_install/lib/msg.c index 43dd7e6..068d305 100644 --- a/usr.sbin/pkg_install/lib/msg.c +++ b/usr.sbin/pkg_install/lib/msg.c @@ -25,6 +25,7 @@ static const char rcsid[] = */ #include <err.h> +#include <paths.h> #include "lib.h" /* Die a relatively simple death */ @@ -51,10 +52,10 @@ y_or_n(Boolean def, const char *msg, ...) * Need to open /dev/tty because file collection may have been * collected on stdin */ - tty = fopen("/dev/tty", "r"); + tty = fopen(_PATH_TTY, "r"); if (!tty) { cleanup(0); - errx(2, "can't open /dev/tty!"); + errx(2, "can't open %s!", _PATH_TTY); } while (ch != 'Y' && ch != 'N') { vfprintf(stderr, msg, args); diff --git a/usr.sbin/pppd/auth.c b/usr.sbin/pppd/auth.c index 4cc40cb..2a580e9 100644 --- a/usr.sbin/pppd/auth.c +++ b/usr.sbin/pppd/auth.c @@ -41,6 +41,7 @@ static char rcsid[] = "$FreeBSD$"; #include <stdlib.h> #include <unistd.h> #include <syslog.h> +#include <paths.h> #include <pwd.h> #include <string.h> #include <sys/types.h> @@ -965,7 +966,7 @@ plogin(user, passwd, msg, msglen) /* Log in wtmp and utmp using login() */ tty = devnam; - if (strncmp(tty, "/dev/", 5) == 0) + if (strncmp(tty, _PATH_DEV, sizeof _PATH_DEV - 1) == 0) tty += 5; if (logout(tty)) /* Already entered (by login?) */ @@ -1031,7 +1032,7 @@ plogout() char *tty; tty = devnam; - if (strncmp(tty, "/dev/", 5) == 0) + if (strncmp(tty, _PATH_DEV, sizeof _PATH_DEV - 1) == 0) tty += 5; logwtmp(tty, "", ""); /* Wipe out wtmp logout entry */ logout(tty); /* Wipe out utmp */ diff --git a/usr.sbin/pppd/options.c b/usr.sbin/pppd/options.c index f18131c..0676e3c 100644 --- a/usr.sbin/pppd/options.c +++ b/usr.sbin/pppd/options.c @@ -31,6 +31,7 @@ static char rcsid[] = "$FreeBSD$"; #include <syslog.h> #include <string.h> #include <netdb.h> +#include <paths.h> #include <pwd.h> #include <sys/types.h> #include <sys/stat.h> @@ -80,7 +81,7 @@ int dflag = 0; /* Tell libpcap we want debugging */ int debug = 0; /* Debug flag */ int kdebugflag = 0; /* Tell kernel to print debug messages */ int default_device = 1; /* Using /dev/tty or equivalent */ -char devnam[MAXPATHLEN] = "/dev/tty"; /* Device name */ +char devnam[MAXPATHLEN] = _PATH_TTY; /* Device name */ int crtscts = 0; /* Use hardware flow control */ int modem = 1; /* Use modem control lines */ int inspeed = 0; /* Input/Output speed requested */ @@ -694,7 +695,7 @@ options_for_tty() int ret; dev = devnam; - if (strncmp(dev, "/dev/", 5) == 0) + if (strncmp(dev, _PATH_DEV, sizeof _PATH_DEV - 1) == 0) dev += 5; if (strcmp(dev, "tty") == 0) return 1; /* don't look for /etc/ppp/options.tty */ @@ -1671,9 +1672,9 @@ setdevname(cp, quiet) if (*cp == 0) return 0; - if (strncmp("/dev/", cp, 5) != 0) { - strcpy(dev, "/dev/"); - strncat(dev, cp, MAXPATHLEN - 5); + if (strncmp(_PATH_DEV, cp, sizeof _PATH_DEV - 1) != 0) { + strcpy(dev, _PATH_DEV); + strncat(dev, cp, MAXPATHLEN - sizeof _PATH_DEV - 1); dev[MAXPATHLEN-1] = 0; cp = dev; } diff --git a/usr.sbin/pw/pw.c b/usr.sbin/pw/pw.c index d854c92..ca3a10a 100644 --- a/usr.sbin/pw/pw.c +++ b/usr.sbin/pw/pw.c @@ -206,7 +206,7 @@ main(int argc, char *argv[]) * don't bother with extraneous errors */ if (getarg(&arglist, 'q') != NULL) - freopen("/dev/null", "w", stderr); + freopen(_PATH_DEVNULL, "w", stderr); /* * Set our base working path if not overridden diff --git a/usr.sbin/quot/quot.c b/usr.sbin/quot/quot.c index ceef657..01f822e 100644 --- a/usr.sbin/quot/quot.c +++ b/usr.sbin/quot/quot.c @@ -44,6 +44,7 @@ static const char rcsid[] = #include <err.h> #include <fcntl.h> #include <errno.h> +#include <paths.h> #include <pwd.h> #include <stdio.h> #include <stdlib.h> @@ -569,7 +570,7 @@ main(argc,argv) for (; --cnt >= 0; mp++) { if (!strncmp(mp->f_fstypename, "ufs", MFSNAMELEN)) { if ((nm = strrchr(mp->f_mntfromname,'/'))) { - sprintf(dev,"/dev/%s",nm + 1); + sprintf(dev,"%s%s",_PATH_DEV,nm + 1); nm = dev; } else nm = mp->f_mntfromname; diff --git a/usr.sbin/rpc.ypxfrd/ypxfrd_main.c b/usr.sbin/rpc.ypxfrd/ypxfrd_main.c index 50a5793..e83b997 100644 --- a/usr.sbin/rpc.ypxfrd/ypxfrd_main.c +++ b/usr.sbin/rpc.ypxfrd/ypxfrd_main.c @@ -38,6 +38,7 @@ static const char rcsid[] = #include "ypxfrd.h" #include <err.h> #include <fcntl.h> +#include <paths.h> #include <stdio.h> #include <stdlib.h> /* getenv, exit */ #include <unistd.h> @@ -240,10 +241,10 @@ main(argc, argv) size = getdtablesize(); for (i = 0; i < size; i++) (void) close(i); - i = open("/dev/console", 2); + i = open(_PATH_CONSOLE, 2); (void) dup2(i, 1); (void) dup2(i, 2); - i = open("/dev/tty", 2); + i = open(_PATH_TTY, 2); if (i >= 0) { (void) ioctl(i, TIOCNOTTY, (char *)NULL); (void) close(i); diff --git a/usr.sbin/sicontrol/sicontrol.c b/usr.sbin/sicontrol/sicontrol.c index 88e1770..eb6560f 100644 --- a/usr.sbin/sicontrol/sicontrol.c +++ b/usr.sbin/sicontrol/sicontrol.c @@ -39,6 +39,7 @@ static const char rcsid[] = #include <ctype.h> #include <err.h> #include <fcntl.h> +#include <paths.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -156,7 +157,7 @@ main(int argc, char **argv) if (strchr(Devname, '/') == NULL) { char *acp = malloc(6 + strlen(Devname)); - strcpy(acp, "/dev/"); + strcpy(acp, _PATH_DEV); strcat(acp, Devname); Devname = acp; } diff --git a/usr.sbin/sliplogin/sliplogin.c b/usr.sbin/sliplogin/sliplogin.c index e8c2f0c..5295682 100644 --- a/usr.sbin/sliplogin/sliplogin.c +++ b/usr.sbin/sliplogin/sliplogin.c @@ -39,6 +39,7 @@ static char copyright[] = #ifndef lint static char sccsid[] = "@(#)sliplogin.c 8.2 (Berkeley) 2/1/94"; +static char rscid[] = "@(#)$FreeBSD$"; #endif /* not lint */ /* @@ -82,6 +83,7 @@ static char sccsid[] = "@(#)sliplogin.c 8.2 (Berkeley) 2/1/94"; #include <stdio.h> #include <errno.h> #include <ctype.h> +#include <paths.h> #include <string.h> #include <unistd.h> #include <stdlib.h> @@ -375,7 +377,7 @@ main(argc, argv) FILE *iffile; /* interfaces file */ char *p; int n; - char devnam[MAXPATHLEN] = "/dev/tty"; /* Device name */ + char devnam[MAXPATHLEN] = _PATH_TTY; /* Device name */ if ((name = strrchr(argv[0], '/')) == NULL) name = argv[0]; @@ -510,7 +512,7 @@ main(argc, argv) (void) close(1); if ((fd = open(_PATH_DEVNULL, O_WRONLY)) != 1) { if (fd < 0) { - syslog(LOG_ERR, "open /dev/null: %m"); + syslog(LOG_ERR, "open %s: %m", _PATH_DEVNULL); exit(1); } (void) dup2(fd, 1); diff --git a/usr.sbin/vnconfig/vnconfig.c b/usr.sbin/vnconfig/vnconfig.c index c80d0db..11f9324 100644 --- a/usr.sbin/vnconfig/vnconfig.c +++ b/usr.sbin/vnconfig/vnconfig.c @@ -49,6 +49,7 @@ static const char rcsid[] = #include <ctype.h> #include <err.h> #include <errno.h> +#include <paths.h> #include <stdio.h> #include <stdlib.h> #include <fcntl.h> @@ -263,7 +264,7 @@ config(vnp) * Operate on vnp->dev because it is used later. */ if (vnp->dev[0] != '/' && vnp->dev[0] != '.') - (void)asprintf(&vnp->dev, "/dev/%s", vnp->dev); + (void)asprintf(&vnp->dev, "%s%s", _PATH_DEV, vnp->dev); dev = vnp->dev; file = vnp->file; flags = vnp->flags; diff --git a/usr.sbin/watch/watch.c b/usr.sbin/watch/watch.c index 817f7fc..da80260 100644 --- a/usr.sbin/watch/watch.c +++ b/usr.sbin/watch/watch.c @@ -26,6 +26,7 @@ static const char rcsid[] = #include <err.h> #include <locale.h> +#include <paths.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> @@ -139,7 +140,7 @@ fatal(err, buf) int open_snp() { - char snp[] = {"/dev/snpX"}; + char snp[] = {_PATH_DEV "snpX"}; char c; int f, mode; @@ -233,14 +234,14 @@ set_dev(name) char buf[DEV_NAME_LEN]; struct stat sb; - if (strlen(name) > 5 && !strncmp(name, "/dev/", 5)) { + if (strlen(name) > 5 && !strncmp(name, _PATH_DEV, sizeof _PATH_DEV - 1)) { snprintf(buf, sizeof buf, "%s", name); } else { if (strlen(name) == 2) - sprintf(buf, "/dev/tty%s", name); + sprintf(buf, "%s%s", _PATH_TTY, name); else - sprintf(buf, "/dev/%s", name); + sprintf(buf, "%s%s", _PATH_DEV, name); } if (*name == '\0' || stat(buf, &sb) < 0) |