From 998af6f1111386b8b1dc620aa4bf4c1bad860e06 Mon Sep 17 00:00:00 2001 From: Arun Thomas Date: Sat, 6 Nov 2010 20:40:15 +0000 Subject: [PATCH] Move minix/paths.h to paths.h Also, merge in relevant macros from NetBSD --- commands/ash/Makefile | 2 +- commands/dhcpd/dhcpd.h | 2 +- commands/diff/diffdir.c | 2 +- commands/diff/pathnames.h | 2 +- commands/finger/finger.c | 2 +- commands/hostaddr/hostaddr.c | 2 +- commands/last/last.c | 2 +- commands/login/login.c | 2 +- commands/man/pathnames.h | 2 +- commands/modem/modem.c | 2 +- commands/nonamed/nonamed.c | 2 +- commands/patch/pathnames.h | 2 +- commands/patch/util.c | 2 +- commands/pax/options.c | 2 +- commands/pax/pax.c | 2 +- commands/ps/ps.c | 6 +-- commands/ramdisk/ramdisk.c | 2 +- commands/service/service.c | 2 +- commands/tar/config.h | 2 +- commands/top/top.c | 6 +-- commands/who/who.c | 2 +- commands/write/write.c | 2 +- include/Makefile | 4 +- include/minix/paths.h | 28 -------------- include/paths.h | 72 ++++++++++++++++++++++++++++++++++++ lib/libarchive/config.h | 2 +- lib/libc/other/_mount.c | 2 +- lib/libc/other/sysconf.c | 4 +- lib/libc/posix/getloadavg.c | 4 +- 29 files changed, 106 insertions(+), 62 deletions(-) delete mode 100644 include/minix/paths.h create mode 100644 include/paths.h diff --git a/commands/ash/Makefile b/commands/ash/Makefile index 86991e8c6..05ed3bc37 100644 --- a/commands/ash/Makefile +++ b/commands/ash/Makefile @@ -31,7 +31,7 @@ YFLAGS= -d EDIT=-DEDITLINE # Enable this line if your system does not have a -NO_PATHS_H=-DNO_PATHS_H +#NO_PATHS_H=-DNO_PATHS_H # Enable this if you don't want job control NO_JOBS=-DJOBS=0 diff --git a/commands/dhcpd/dhcpd.h b/commands/dhcpd/dhcpd.h index 11b8d6abd..ba7a1329b 100644 --- a/commands/dhcpd/dhcpd.h +++ b/commands/dhcpd/dhcpd.h @@ -5,7 +5,7 @@ #define nil ((void*)0) -#include +#include /* Paths to files. */ #define PATH_DHCPCONF _PATH_DHCPCONF diff --git a/commands/diff/diffdir.c b/commands/diff/diffdir.c index 763e9728e..2d6f091be 100644 --- a/commands/diff/diffdir.c +++ b/commands/diff/diffdir.c @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/commands/diff/pathnames.h b/commands/diff/pathnames.h index 958c12314..ab79dca28 100644 --- a/commands/diff/pathnames.h +++ b/commands/diff/pathnames.h @@ -20,6 +20,6 @@ * Materiel Command, USAF, under agreement number F39502-99-1-0512. */ -#include +#include #define _PATH_PR "/usr/bin/pr" diff --git a/commands/finger/finger.c b/commands/finger/finger.c index a1ce1fdd3..ef39187fb 100644 --- a/commands/finger/finger.c +++ b/commands/finger/finger.c @@ -97,7 +97,7 @@ struct person { /* one for each person fingered */ char hostt[HMAX+1]; /* login host */ }; -#include +#include char LASTLOG[] = _PATH_LASTLOG; /* last login info */ char USERLOG[] = _PATH_UTMP; /* who is logged in */ diff --git a/commands/hostaddr/hostaddr.c b/commands/hostaddr/hostaddr.c index f463a1628..01d7f4807 100644 --- a/commands/hostaddr/hostaddr.c +++ b/commands/hostaddr/hostaddr.c @@ -30,7 +30,7 @@ Created: Jan 27, 1992 by Philip Homburg #include #include -#include +#include char *prog_name; diff --git a/commands/last/last.c b/commands/last/last.c index 80b085bf9..a8094c5c9 100644 --- a/commands/last/last.c +++ b/commands/last/last.c @@ -57,7 +57,7 @@ #include #include -#include +#include #define FALSE 0 #define TRUE 1 diff --git a/commands/login/login.c b/commands/login/login.c index b720faa49..9f2fd81b4 100644 --- a/commands/login/login.c +++ b/commands/login/login.c @@ -75,7 +75,7 @@ #include #include #include -#include +#include char PATH_UTMP[] = _PATH_UTMP; /* current logins */ char PATH_WTMP[] = _PATH_WTMP; /* login/logout history */ diff --git a/commands/man/pathnames.h b/commands/man/pathnames.h index 6de096bf6..95c2280d4 100644 --- a/commands/man/pathnames.h +++ b/commands/man/pathnames.h @@ -31,7 +31,7 @@ * @(#)pathnames.h 8.3 (Berkeley) 1/2/94 */ -#include +#include #define _PATH_MANCONF "/etc/man.conf" #define _PATH_PAGER "/usr/bin/more -s" diff --git a/commands/modem/modem.c b/commands/modem/modem.c index 99ddcf21b..e3e3119f5 100644 --- a/commands/modem/modem.c +++ b/commands/modem/modem.c @@ -23,7 +23,7 @@ #include #include -#include +#include char PATH_UTMP[] = _PATH_UTMP; /* current logins */ diff --git a/commands/nonamed/nonamed.c b/commands/nonamed/nonamed.c index 7dd1d95f4..d713ff788 100644 --- a/commands/nonamed/nonamed.c +++ b/commands/nonamed/nonamed.c @@ -41,7 +41,7 @@ static const char version[] = "2.7"; #include #include -#include +#include #define HTTL 3600L /* Default time to live for /etc/hosts data. */ #define SHORT_TIMEOUT 2 /* If you expect an answer soon. */ diff --git a/commands/patch/pathnames.h b/commands/patch/pathnames.h index 99182f300..e9d3ccbee 100644 --- a/commands/patch/pathnames.h +++ b/commands/patch/pathnames.h @@ -9,6 +9,6 @@ * on July 29, 2003. */ -#include +#include #define _PATH_ED "/bin/ed" diff --git a/commands/patch/util.c b/commands/patch/util.c index 0e2032ab6..f7c94a652 100644 --- a/commands/patch/util.c +++ b/commands/patch/util.c @@ -39,7 +39,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/commands/pax/options.c b/commands/pax/options.c index 66e963c04..49b6fde84 100644 --- a/commands/pax/options.c +++ b/commands/pax/options.c @@ -50,7 +50,7 @@ static char sccsid[] = "@(#)options.c 8.2 (Berkeley) 4/18/94"; #include #include #include -#include +#include #include #include diff --git a/commands/pax/pax.c b/commands/pax/pax.c index f249a28d5..e454e1a45 100644 --- a/commands/pax/pax.c +++ b/commands/pax/pax.c @@ -50,7 +50,7 @@ static char sccsid[] = "@(#)pax.c 8.2 (Berkeley) 4/18/94"; #include #include #include -#include +#include #include #include #include diff --git a/commands/ps/ps.c b/commands/ps/ps.c index 797a43e7f..d3a5e3957 100644 --- a/commands/ps/ps.c +++ b/commands/ps/ps.c @@ -53,7 +53,7 @@ #include #include -#include +#include #include #include #include @@ -229,10 +229,10 @@ PRIVATE void getkinfo(void) FILE *fp; if ((fp = fopen("kinfo", "r")) == NULL) - err("Unable to open " _PATH_PROC "/kinfo"); + err("Unable to open " _PATH_PROC "kinfo"); if (fscanf(fp, "%u %u", &nr_procs, &nr_tasks) != 2) - err("Unable to read from " _PATH_PROC "/kinfo"); + err("Unable to read from " _PATH_PROC "kinfo"); fclose(fp); } diff --git a/commands/ramdisk/ramdisk.c b/commands/ramdisk/ramdisk.c index 560429f78..cab1b38b9 100644 --- a/commands/ramdisk/ramdisk.c +++ b/commands/ramdisk/ramdisk.c @@ -1,5 +1,5 @@ -#include +#include #include #include diff --git a/commands/service/service.c b/commands/service/service.c index f7726854e..c32583dc6 100644 --- a/commands/service/service.c +++ b/commands/service/service.c @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/commands/tar/config.h b/commands/tar/config.h index bc080821e..133b6d5bc 100644 --- a/commands/tar/config.h +++ b/commands/tar/config.h @@ -335,7 +335,7 @@ /* #undef HAVE_OPENSSL_SHA_H */ /* Define to 1 if you have the header file. */ -/* #undef HAVE_PATHS_H */ +#define HAVE_PATHS_H 1 /* Define to 1 if you have the `pipe' function. */ #define HAVE_PIPE 1 diff --git a/commands/top/top.c b/commands/top/top.c index 79f0aad27..be90c07f8 100644 --- a/commands/top/top.c +++ b/commands/top/top.c @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include u32_t system_hz; @@ -544,12 +544,12 @@ void getkinfo(void) FILE *fp; if ((fp = fopen("kinfo", "r")) == NULL) { - fprintf(stderr, "opening " _PATH_PROC "/kinfo failed\n"); + fprintf(stderr, "opening " _PATH_PROC "kinfo failed\n"); exit(1); } if (fscanf(fp, "%u %u", &nr_procs, &nr_tasks) != 2) { - fprintf(stderr, "reading from " _PATH_PROC "/kinfo failed\n"); + fprintf(stderr, "reading from " _PATH_PROC "kinfo failed\n"); exit(1); } diff --git a/commands/who/who.c b/commands/who/who.c index 0989bd29c..eebeaceea 100644 --- a/commands/who/who.c +++ b/commands/who/who.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include char PATH_UTMP[] = _PATH_UTMP; diff --git a/commands/write/write.c b/commands/write/write.c index 36a8a7d99..21402c918 100644 --- a/commands/write/write.c +++ b/commands/write/write.c @@ -25,7 +25,7 @@ #include #include #include -#include +#include static char *Version = "@(#) WRITE 1.6 (10/24/92)"; diff --git a/include/Makefile b/include/Makefile index a39997e17..37a8ca72b 100644 --- a/include/Makefile +++ b/include/Makefile @@ -10,7 +10,7 @@ INCS= alloca.h ansi.h a.out.h ar.h assert.h configfile.h ctype.h \ syslog.h tar.h termcap.h termios.h time.h timers.h tools.h \ ttyent.h ucontext.h unistd.h utime.h utmp.h wchar.h wctype.h \ hgfs.h tzfile.h util.h fetch.h mpool.h ndbm.h db.h poll.h resolv.h \ - memory.h + memory.h paths.h INCS+= arpa/inet.h arpa/nameser.h INCS+= minix/a.out.h minix/bitmap.h minix/callnr.h minix/cdrom.h \ minix/com.h minix/config.h minix/const.h minix/cpufeature.h \ @@ -21,7 +21,7 @@ INCS+= minix/a.out.h minix/bitmap.h minix/callnr.h minix/cdrom.h \ minix/drivers.h minix/drvlib.h minix/ds.h minix/endpoint.h \ minix/fslib.h minix/ioctl.h minix/ipc.h minix/ipcconst.h \ minix/keymap.h minix/minlib.h minix/mq.h minix/mthread.h \ - minix/netdriver.h minix/partition.h minix/paths.h \ + minix/netdriver.h minix/partition.h \ minix/portio.h minix/priv.h minix/procfs.h minix/profile.h \ minix/queryparam.h \ minix/rs.h minix/safecopies.h minix/sched.h minix/sef.h minix/sound.h \ diff --git a/include/minix/paths.h b/include/minix/paths.h deleted file mode 100644 index 88a82efe2..000000000 --- a/include/minix/paths.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef _MINIX_PATHS_H -#define _MINIX_PATHS_H 1 - -#define _PATH_DHCPCONF "/etc/dhcp.conf" -#define _PATH_DHCPPID "/usr/run/dhcpd.pid" -#define _PATH_DHCPCACHE "/usr/adm/dhcp.cache" -#define _PATH_DHCPPOOL "/usr/adm/dhcp.pool" - -#define _PATH_WTMP "/usr/adm/wtmp" -#define _PATH_UTMP "/etc/utmp" -#define _PATH_LASTLOG "/usr/adm/lastlog" -#define _PATH_MOTD "/etc/motd" -#define _PATH_HOSTS "/etc/hosts" - -#define _PATH_DEFTAPE "/dev/sa0" -#define _PATH_RAMDISK "/dev/ram" -#define _PATH_TTY "/dev/tty" -#define _PATH_TMP "/tmp" -#define _PATH_DEVNULL "/dev/null" - -#define _PATH_BSHELL "/bin/sh" -#define _PATH_SERVICE "/bin/service" -#define _PATH_SYSTEM_CONF "/etc/system.conf" -#define _PATH_SYSTEM_CONF_DIR "/etc/system.conf.d" - -#define _PATH_PROC "/proc" - -#endif diff --git a/include/paths.h b/include/paths.h new file mode 100644 index 000000000..6ee679cdb --- /dev/null +++ b/include/paths.h @@ -0,0 +1,72 @@ +/* + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)paths.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _PATHS_H +#define _PATHS_H + +/* Default search path. */ +#define _PATH_DEFPATH "/usr/bin:/bin:/usr/pkg/bin:/usr/local/bin" +/* All standard utilities path. */ +#define _PATH_STDPATH \ + "/usr/bin:/bin:/usr/sbin:/sbin:/usr/pkg/bin:/usr/pkg/sbin:/usr/local/bin:/usr/local/sbin" + +#define _PATH_DHCPCONF "/etc/dhcp.conf" +#define _PATH_DHCPPID "/usr/run/dhcpd.pid" +#define _PATH_DHCPCACHE "/usr/adm/dhcp.cache" +#define _PATH_DHCPPOOL "/usr/adm/dhcp.pool" + +#define _PATH_WTMP "/usr/adm/wtmp" +#define _PATH_UTMP "/etc/utmp" +#define _PATH_LASTLOG "/usr/adm/lastlog" +#define _PATH_MOTD "/etc/motd" +#define _PATH_HOSTS "/etc/hosts" + +#define _PATH_DEFTAPE "/dev/sa0" +#define _PATH_RAMDISK "/dev/ram" +#define _PATH_TTY "/dev/tty" +#define _PATH_DEVNULL "/dev/null" +#define _PATH_CONSOLE "/dev/console" +#define _PATH_KMEM "/dev/kmem" +#define _PATH_MEM "/dev/mem" +#define _PATH_RANDOM "/dev/random" +#define _PATH_URANDOM "/dev/urandom" + +#define _PATH_BSHELL "/bin/sh" +#define _PATH_SERVICE "/bin/service" +#define _PATH_SYSTEM_CONF "/etc/system.conf" +#define _PATH_SYSTEM_CONF_DIR "/etc/system.conf.d" + +/* Provide trailing slash, since mostly used for building pathnames. */ +#define _PATH_DEV "/dev/" +#define _PATH_TMP "/tmp/" +#define _PATH_PROC "/proc/" + +#endif diff --git a/lib/libarchive/config.h b/lib/libarchive/config.h index 9e2a1f626..4b35ca4c1 100644 --- a/lib/libarchive/config.h +++ b/lib/libarchive/config.h @@ -335,7 +335,7 @@ /* #undef HAVE_OPENSSL_SHA_H */ /* Define to 1 if you have the header file. */ -/* #undef HAVE_PATHS_H */ +#define HAVE_PATHS_H 1 /* Define to 1 if you have the `pipe' function. */ #define HAVE_PIPE 1 diff --git a/lib/libc/other/_mount.c b/lib/libc/other/_mount.c index 8c473ce8b..38ef0c3e0 100644 --- a/lib/libc/other/_mount.c +++ b/lib/libc/other/_mount.c @@ -9,7 +9,7 @@ #include #include #include -#include +#include #define OK 0 #define FSPATH "/sbin/" diff --git a/lib/libc/other/sysconf.c b/lib/libc/other/sysconf.c index f70b2f179..ac0124141 100644 --- a/lib/libc/other/sysconf.c +++ b/lib/libc/other/sysconf.c @@ -11,7 +11,7 @@ #include #include #include -#include +#include PRIVATE u32_t get_hz(void) { @@ -19,7 +19,7 @@ PRIVATE u32_t get_hz(void) u32_t hz; int r; - if ((fp = fopen(_PATH_PROC "/hz", "r")) != NULL) + if ((fp = fopen(_PATH_PROC "hz", "r")) != NULL) { r = fscanf(fp, "%lu", &hz); diff --git a/lib/libc/posix/getloadavg.c b/lib/libc/posix/getloadavg.c index c19f3a4d5..7debfcabb 100644 --- a/lib/libc/posix/getloadavg.c +++ b/lib/libc/posix/getloadavg.c @@ -1,6 +1,6 @@ #include -#include +#include #include #include #include @@ -17,7 +17,7 @@ int getloadavg(double *loadavg, int nelem) return -1; } - if((fp = fopen(_PATH_PROC "/loadavg", "r")) == NULL) + if((fp = fopen(_PATH_PROC "loadavg", "r")) == NULL) return -1; for(i = 0; i < nelem; i++) -- 2.44.0