From: Ralph Corderoy Date: Sat, 20 May 2017 10:48:10 +0000 (+0100) Subject: uip/aliasbr.c: Remove dead code used for Unix groups. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/a8dcf8977f354122e6c5bb82256b56150543da6b uip/aliasbr.c: Remove dead code used for Unix groups. Main functionality removed in afaab789. --- diff --git a/h/aliasbr.h b/h/aliasbr.h index 65542205..d1927b35 100644 --- a/h/aliasbr.h +++ b/h/aliasbr.h @@ -17,25 +17,11 @@ struct adr { char ad_local; /* text is local (check for expansion) */ }; -/* - * in-core version of /etc/passwd - */ -struct home { - char *h_name; /* user name */ - uid_t h_uid; /* user id */ - gid_t h_gid; /* user's group */ - char *h_home; /* user's home directory */ - char *h_shell; /* user's shell */ - int h_ngrps; /* number of groups this user belongs to */ - struct home *h_next; /* next home in list */ -}; - /* * prototypes */ int alias (char *); int akvisible (void); -void init_pw (void); char *akresult (struct aka *); char *akvalue (char *); char *akerror (int); @@ -46,4 +32,3 @@ char *akerror (int); #define AK_NOFILE 1 /* couldn't read file */ #define AK_ERROR 2 /* error parsing file */ #define AK_LIMIT 3 /* memory limit exceeded */ -#define AK_NOGROUP 4 /* no such group */ diff --git a/uip/aliasbr.c b/uip/aliasbr.c index b5add173..3e456782 100644 --- a/uip/aliasbr.c +++ b/uip/aliasbr.c @@ -17,15 +17,11 @@ static char *akerrst; struct aka *akahead = NULL; struct aka *akatail = NULL; -struct home *homehead = NULL; -struct home *hometail = NULL; - /* * prototypes */ int alias (char *); int akvisible (void); -void init_pw (void); char *akresult (struct aka *); char *akvalue (char *); char *akerror (int); @@ -39,7 +35,6 @@ static int addfile (struct aka *, char *); static char *getalias (char *); static void add_aka (struct aka *, char *); static struct aka *akalloc (char *); -static struct home *hmalloc (struct passwd *); /* Do mh alias substitution on 's' and return the results. */ @@ -276,10 +271,6 @@ akerror (int i) snprintf (buffer, sizeof(buffer), "out of memory while on '%s'", akerrst); break; - case AK_NOGROUP: - snprintf (buffer, sizeof(buffer), "no such group as '%s'", akerrst); - break; - default: snprintf (buffer, sizeof(buffer), "unknown error (%d)", i); break; @@ -404,31 +395,6 @@ add_aka (struct aka *ak, char *pp) } -void -init_pw (void) -{ - struct passwd *pw; - static int init; - - if (!init) - { - /* if the list has yet to be initialized */ - /* zap the list, and rebuild from scratch */ - homehead=NULL; - hometail=NULL; - init++; - - setpwent (); - - while ((pw = getpwent ())) - if (!hmalloc (pw)) - break; - - endpwent (); - } -} - - static struct aka * akalloc (char *id) { @@ -447,26 +413,3 @@ akalloc (char *id) return p; } - - -static struct home * -hmalloc (struct passwd *pw) -{ - struct home *p; - - NEW(p); - p->h_name = getcpy (pw->pw_name); - p->h_uid = pw->pw_uid; - p->h_gid = pw->pw_gid; - p->h_home = getcpy (pw->pw_dir); - p->h_shell = getcpy (pw->pw_shell); - p->h_ngrps = 0; - p->h_next = NULL; - if (hometail != NULL) - hometail->h_next = p; - if (homehead == NULL) - homehead = p; - hometail = p; - - return p; -}