From c9384f1d982e4695904ef82271714a049cd32827 Mon Sep 17 00:00:00 2001 From: obrien Date: Wed, 13 Jan 1999 19:23:16 +0000 Subject: Virgin import of AMD (am-utils) v6.0 --- contrib/amd/libamu/amu.h | 4 +-- contrib/amd/libamu/hasmntopt.c | 6 ++-- contrib/amd/libamu/misc_rpc.c | 6 ++-- contrib/amd/libamu/mount_fs.c | 6 ++-- contrib/amd/libamu/mtab.c | 4 +-- contrib/amd/libamu/nfs_prot_xdr.c | 4 +-- contrib/amd/libamu/util.c | 6 ++-- contrib/amd/libamu/wire.c | 6 ++-- contrib/amd/libamu/xdr_func.c | 4 +-- contrib/amd/libamu/xutil.c | 68 ++++++++++++++++++++++++++++++++------- 10 files changed, 80 insertions(+), 34 deletions(-) (limited to 'contrib/amd/libamu') diff --git a/contrib/amd/libamu/amu.h b/contrib/amd/libamu/amu.h index f69b99e..38532d0 100644 --- a/contrib/amd/libamu/amu.h +++ b/contrib/amd/libamu/amu.h @@ -17,7 +17,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: + * must display the following acknowledgment: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors @@ -38,7 +38,7 @@ * * %W% (Berkeley) %G% * - * $Id: amu.h,v 1.1 1996/01/13 23:23:39 ezk Exp ezk $ + * $Id: amu.h,v 1.1.1.1 1998/11/05 02:04:45 ezk Exp $ * */ diff --git a/contrib/amd/libamu/hasmntopt.c b/contrib/amd/libamu/hasmntopt.c index 7cf9167..2ed75f5 100644 --- a/contrib/amd/libamu/hasmntopt.c +++ b/contrib/amd/libamu/hasmntopt.c @@ -17,7 +17,7 @@ n * modification, are permitted provided that the following conditions * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: + * must display the following acknowledgment: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors @@ -38,7 +38,7 @@ n * modification, are permitted provided that the following conditions * * %W% (Berkeley) %G% * - * $Id: hasmntopt.c,v 5.2.2.2 1992/05/31 16:35:45 jsp Exp $ + * $Id: hasmntopt.c,v 1.1.1.1 1998/11/05 02:04:44 ezk Exp $ * */ @@ -84,7 +84,7 @@ nextmntopt(char **p) cp++; /* - * If separator found the overwrite with nul char. + * If separator found the overwrite with null char. */ if (*cp) { *cp = '\0'; diff --git a/contrib/amd/libamu/misc_rpc.c b/contrib/amd/libamu/misc_rpc.c index b6d23cd..ec34e35 100644 --- a/contrib/amd/libamu/misc_rpc.c +++ b/contrib/amd/libamu/misc_rpc.c @@ -17,7 +17,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: + * must display the following acknowledgment: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors @@ -38,7 +38,7 @@ * * %W% (Berkeley) %G% * - * $Id: misc_rpc.c,v 5.2.2.1 1992/02/09 15:08:40 jsp beta $ + * $Id: misc_rpc.c,v 1.1.1.1 1998/11/05 02:04:45 ezk Exp $ * */ @@ -65,7 +65,7 @@ void rpc_msg_init(struct rpc_msg *mp, u_long prog, u_long vers, u_long proc) { /* - * Initialise the message + * Initialize the message */ memset((voidp) mp, 0, sizeof(*mp)); mp->rm_xid = 0; diff --git a/contrib/amd/libamu/mount_fs.c b/contrib/amd/libamu/mount_fs.c index 948b18d..49e6c2d 100644 --- a/contrib/amd/libamu/mount_fs.c +++ b/contrib/amd/libamu/mount_fs.c @@ -17,7 +17,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: + * must display the following acknowledgment: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors @@ -38,7 +38,7 @@ * * %W% (Berkeley) %G% * - * $Id: mount_fs.c,v 5.2.2.2 1992/05/31 16:35:45 jsp Exp $ + * $Id: mount_fs.c,v 1.1.1.1 1998/11/05 02:04:45 ezk Exp $ * */ @@ -315,7 +315,7 @@ again: /* * Fill in the many possible fields and flags of struct nfs_args. * - * nap: pre-allocted structure to fill in. + * nap: pre-allocated structure to fill in. * mntp: mount entry structure (includes options) * genflags: generic mount flags already determined * nfsncp: (TLI only) netconfig entry for this NFS mount diff --git a/contrib/amd/libamu/mtab.c b/contrib/amd/libamu/mtab.c index 20cae62..7fe95de 100644 --- a/contrib/amd/libamu/mtab.c +++ b/contrib/amd/libamu/mtab.c @@ -17,7 +17,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: + * must display the following acknowledgment: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors @@ -38,7 +38,7 @@ * * %W% (Berkeley) %G% * - * $Id: mtab.c,v 5.2.2.1 1992/02/09 15:08:45 jsp beta $ + * $Id: mtab.c,v 1.1.1.1 1998/11/05 02:04:45 ezk Exp $ * */ diff --git a/contrib/amd/libamu/nfs_prot_xdr.c b/contrib/amd/libamu/nfs_prot_xdr.c index 2098b5d..cbe6793 100644 --- a/contrib/amd/libamu/nfs_prot_xdr.c +++ b/contrib/amd/libamu/nfs_prot_xdr.c @@ -17,7 +17,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: + * must display the following acknowledgment: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors @@ -38,7 +38,7 @@ * * %W% (Berkeley) %G% * - * $Id: nfs_prot_xdr.c,v 5.2.2.1 1992/02/09 15:09:32 jsp beta $ + * $Id: nfs_prot_xdr.c,v 1.1.1.1 1998/11/05 02:04:45 ezk Exp $ * */ diff --git a/contrib/amd/libamu/util.c b/contrib/amd/libamu/util.c index 1198347..0650de2 100644 --- a/contrib/amd/libamu/util.c +++ b/contrib/amd/libamu/util.c @@ -17,7 +17,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: + * must display the following acknowledgment: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors @@ -38,12 +38,12 @@ * * %W% (Berkeley) %G% * - * $Id: util.c,v 5.2.2.2 1992/03/07 17:52:06 jsp Exp $ + * $Id: util.c,v 1.1.1.1 1998/11/05 02:04:45 ezk Exp $ * */ /* - * General Utilitiles. + * General Utilities. */ #ifdef HAVE_CONFIG_H diff --git a/contrib/amd/libamu/wire.c b/contrib/amd/libamu/wire.c index f610f92..bd7b5ad 100644 --- a/contrib/amd/libamu/wire.c +++ b/contrib/amd/libamu/wire.c @@ -17,7 +17,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: + * must display the following acknowledgment: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors @@ -38,14 +38,14 @@ * * %W% (Berkeley) %G% * - * $Id: wire.c,v 5.2.2.2 1992/06/07 18:06:46 jsp Exp jsp $ + * $Id: wire.c,v 1.1.1.1 1998/11/05 02:04:45 ezk Exp $ * */ /* * This function returns the subnet (address&netmask) for the primary network * interface. If the resulting address has an entry in the hosts file, the - * corresponding name is retuned, otherwise the address is returned in + * corresponding name is returned, otherwise the address is returned in * standard internet format. * As a side-effect, a list of local IP/net address is recorded for use * by the islocalnet() function. diff --git a/contrib/amd/libamu/xdr_func.c b/contrib/amd/libamu/xdr_func.c index feafbae..365d390 100644 --- a/contrib/amd/libamu/xdr_func.c +++ b/contrib/amd/libamu/xdr_func.c @@ -17,7 +17,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: + * must display the following acknowledgment: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors @@ -38,7 +38,7 @@ * * %W% (Berkeley) %G% * - * $Id: xdr_func.c,v 5.2.2.1 1992/02/09 15:08:40 jsp beta $ + * $Id: xdr_func.c,v 1.1.1.1 1998/11/05 02:04:45 ezk Exp $ * */ diff --git a/contrib/amd/libamu/xutil.c b/contrib/amd/libamu/xutil.c index 35e7f91..d069f7a 100644 --- a/contrib/amd/libamu/xutil.c +++ b/contrib/amd/libamu/xutil.c @@ -17,7 +17,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: + * must display the following acknowledgment: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors @@ -38,7 +38,7 @@ * * %W% (Berkeley) %G% * - * $Id: xutil.c,v 1.1 1997-1998/01/11 21:06:22 ezk Exp ezk $ + * $Id: xutil.c,v 1.2 1998/12/27 06:25:24 ezk Exp $ * */ @@ -50,6 +50,15 @@ FILE *logfp = stderr; /* Log errors to stderr initially */ +static char *am_progname = "unknown"; /* "amd" */ +static char am_hostname[MAXHOSTNAMELEN + 1] = "unknown"; /* Hostname */ +pid_t am_mypid = -1; /* process ID */ +serv_state amd_state; /* amd's state */ +int foreground = 1; /* 1 == this is the top-level server */ +#ifdef DEBUG +int debug_flags = 0; +#endif /* DEBUG */ + #ifdef HAVE_SYSLOG int syslogging; #endif /* HAVE_SYSLOG */ @@ -113,6 +122,43 @@ struct opt_tab xlog_opt[] = }; +void +am_set_progname(char *pn) +{ + am_progname = pn; +} + + +const char * +am_get_progname(void) +{ + return am_progname; +} + + +void +am_set_hostname(char *hn) +{ + strncpy(am_hostname, hn, MAXHOSTNAMELEN); + am_hostname[MAXHOSTNAMELEN] = '\0'; +} + + +const char * +am_get_hostname(void) +{ + return am_hostname; +} + + +pid_t +am_set_mypid(void) +{ + am_mypid = getpid(); + return am_mypid; +} + + voidp xmalloc(int len) { @@ -209,7 +255,7 @@ checkup_mem(void) if (orig_mem_bytes == 0) mem_bytes = orig_mem_bytes = uordbytes; else { - fprintf(logfp, "%s[%ld]: ", progname, (long) mypid); + fprintf(logfp, "%s[%ld]: ", am_get_progname(), (long) am_mypid); if (mem_bytes < uordbytes) { fprintf(logfp, "ALLOC: %ld bytes", uordbytes - mem_bytes); } else { @@ -225,7 +271,7 @@ checkup_mem(void) /* - * Take a log format string and expand occurences of %m + * Take a log format string and expand occurrences of %m * with the current error code taken from errno. */ static void @@ -298,9 +344,9 @@ show_time_host_and_name(int lvl) break; } fprintf(logfp, "%15.15s %s %s[%ld]/%s ", - last_ctime + 4, hostname, - progname, - (long) mypid, + last_ctime + 4, am_get_hostname(), + am_get_progname(), + (long) am_mypid, sev); } @@ -530,7 +576,7 @@ cmdoption(char *s, struct opt_tab *optb, int *flags) * This will log to stderr when parsing the command line * since any -l option will not yet have taken effect. */ - plog(XLOG_USER, "option \"%s\" not recognised", s); + plog(XLOG_USER, "option \"%s\" not recognized", s); errs++; } @@ -672,7 +718,7 @@ get_syslog_facility(const char *logfile) * Change current logfile */ int -switch_to_logfile(char *logfile) +switch_to_logfile(char *logfile, int old_umask) { FILE *new_logfp = stderr; @@ -688,7 +734,7 @@ switch_to_logfile(char *logfile) #ifdef HAVE_SYSLOG syslogging = 1; new_logfp = stderr; - openlog(progname, + openlog(am_get_progname(), LOG_PID # ifdef LOG_CONS | LOG_CONS @@ -705,7 +751,7 @@ switch_to_logfile(char *logfile) #endif /* not HAVE_SYSLOG */ } else { - (void) umask(orig_umask); + (void) umask(old_umask); new_logfp = fopen(logfile, "a"); umask(0); } -- cgit v1.1