From: Ben Gras Date: Fri, 26 Aug 2005 12:14:54 +0000 (+0000) Subject: Update commands to use paths from instead of X-Git-Tag: v3.1.0~264 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zpipe.c?a=commitdiff_plain;h=efdae0743d0fe6c2ff0a29e6ba4e4c3fe862b86c;p=minix.git Update commands to use paths from instead of hard-coding them (some) --- diff --git a/commands/dhcpd/dhcpd.h b/commands/dhcpd/dhcpd.h index 06badf55a..11b8d6abd 100755 --- a/commands/dhcpd/dhcpd.h +++ b/commands/dhcpd/dhcpd.h @@ -5,11 +5,13 @@ #define nil ((void*)0) +#include + /* Paths to files. */ -#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_DHCPCONF _PATH_DHCPCONF +#define PATH_DHCPPID _PATH_DHCPPID +#define PATH_DHCPCACHE _PATH_DHCPCACHE +#define PATH_DHCPPOOL _PATH_DHCPPOOL #define CLID_MAX 32 /* Maximum client ID length. */ diff --git a/commands/simple/finger.c b/commands/simple/finger.c index 60c29546f..900b325ac 100755 --- a/commands/simple/finger.c +++ b/commands/simple/finger.c @@ -97,8 +97,10 @@ struct person { /* one for each person fingered */ char hostt[HMAX+1]; /* login host */ }; -char LASTLOG[] = "/usr/adm/lastlog"; /* last login info */ -char USERLOG[] = "/etc/utmp"; /* who is logged in */ +#include + +char LASTLOG[] = _PATH_LASTLOG; /* last login info */ +char USERLOG[] = _PATH_UTMP; /* who is logged in */ char PLAN[] = "/.plan"; /* what plan file is */ char PROJ[] = "/.project"; /* what project file */ diff --git a/commands/simple/hostaddr.c b/commands/simple/hostaddr.c index b0a0eb629..989f36603 100755 --- a/commands/simple/hostaddr.c +++ b/commands/simple/hostaddr.c @@ -30,9 +30,11 @@ Created: Jan 27, 1992 by Philip Homburg #include #include +#include + char *prog_name; -char DHCPCACHE[]="/usr/adm/dhcp.cache"; +char DHCPCACHE[]=_PATH_DHCPCACHE; void main _ARGS(( int argc, char *argv[] )); void usage _ARGS(( void )); diff --git a/commands/simple/last.c b/commands/simple/last.c index 4da5f830b..2343fb9d3 100755 --- a/commands/simple/last.c +++ b/commands/simple/last.c @@ -57,6 +57,7 @@ #include #include +#include #define FALSE 0 #define TRUE 1 @@ -307,7 +308,7 @@ long to; */ void Print_Uptime() { - char *utmp_file = "/etc/utmp"; + char *utmp_file = _PATH_UTMP; unsigned nusers; struct utmp ut; FILE *uf; @@ -380,7 +381,7 @@ int main(argc, argv) int argc; char *argv[]; { - char *wtmp_file = "/usr/adm/wtmp"; + char *wtmp_file = _PATH_WTMP; FILE *f; long size; /* Number of wtmp records in the file */ int wtmp_count; /* How many to read into wtmp_buffer */ diff --git a/commands/simple/login.c b/commands/simple/login.c index 802fe1131..c5cf560ca 100755 --- a/commands/simple/login.c +++ b/commands/simple/login.c @@ -75,11 +75,12 @@ #include #include #include +#include -char PATH_UTMP[] = "/etc/utmp"; /* current logins */ -char PATH_WTMP[] = "/usr/adm/wtmp"; /* login/logout history */ -char PATH_LASTLOG[] = "/usr/adm/lastlog"; /* last login history */ -char PATH_MOTD[] = "/etc/motd"; /* message of the day */ +char PATH_UTMP[] = _PATH_UTMP; /* current logins */ +char PATH_WTMP[] = _PATH_WTMP; /* login/logout history */ +char PATH_LASTLOG[] = _PATH_LASTLOG; /* last login history */ +char PATH_MOTD[] = _PATH_MOTD; /* message of the day */ #define TTY_GID 4 /* group ID of ttys */ diff --git a/commands/simple/modem.c b/commands/simple/modem.c index f7ed1b083..99ddcf21b 100755 --- a/commands/simple/modem.c +++ b/commands/simple/modem.c @@ -23,7 +23,9 @@ #include #include -char PATH_UTMP[] = "/etc/utmp"; /* current logins */ +#include + +char PATH_UTMP[] = _PATH_UTMP; /* current logins */ _PROTOTYPE(void usage , (void)); _PROTOTYPE(int main , (int argc , char *argv [])); diff --git a/commands/simple/nonamed.c b/commands/simple/nonamed.c index c1b823aba..f59c5ee8f 100755 --- a/commands/simple/nonamed.c +++ b/commands/simple/nonamed.c @@ -40,6 +40,8 @@ static const char version[] = "2.7"; #include #include +#include + #define HTTL 3600L /* Default time to live for /etc/hosts data. */ #define SHORT_TIMEOUT 2 /* If you expect an answer soon. */ #define MEDIUM_TIMEOUT 4 /* Soon, but not that soon. */ @@ -54,10 +56,10 @@ static const char version[] = "2.7"; #define DO_TCP (__minix_vmd || !__minix) /* Host data, file to store our process id in, our cache, DHCP's cache. */ -static char HOSTS[]= "/etc/hosts"; +static char HOSTS[]= _PATH_HOSTS; static char PIDFILE[]= "/usr/run/nonamed.pid"; static char NNCACHE[]= "/usr/adm/nonamed.cache"; -static char DHCPCACHE[]="/usr/adm/dhcp.cache"; +static char DHCPCACHE[]= _PATH_DHCPCACHE; /* Magic string to head the cache file. */ static char MAGIC[4]= "NND\2"; diff --git a/commands/simple/who.c b/commands/simple/who.c index ac25dc0a6..0989bd29c 100755 --- a/commands/simple/who.c +++ b/commands/simple/who.c @@ -10,8 +10,9 @@ #include #include #include +#include -char PATH_UTMP[] = "/etc/utmp"; +char PATH_UTMP[] = _PATH_UTMP; char day[] = "SunMonTueWedThuFriSat"; char month[] = "JanFebMarAprMayJunJulAugSepOctNovDec"; diff --git a/commands/simple/write.c b/commands/simple/write.c index 14d0c9390..36a8a7d99 100755 --- a/commands/simple/write.c +++ b/commands/simple/write.c @@ -25,6 +25,7 @@ #include #include #include +#include static char *Version = "@(#) WRITE 1.6 (10/24/92)"; @@ -68,7 +69,7 @@ char *finduser() if (verbose) fprintf(stderr, "Trying to write to %s\n", userptr->pw_gecos); - if ((utmpfd = open("/etc/utmp", O_RDONLY)) < 0) { + if ((utmpfd = open(_PATH_UTMP, O_RDONLY)) < 0) { fprintf(stderr, "Cannot open utmp file\n"); return(NULL); }