projects
/
mmh
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Removed the global alias file
[mmh]
/
uip
/
conflict.c
diff --git
a/uip/conflict.c
b/uip/conflict.c
index
fdd6de2
..
30ff189
100644
(file)
--- a/
uip/conflict.c
+++ b/
uip/conflict.c
@@
-47,19
+47,19
@@
extern struct home *homehead;
/*
** prototypes
*/
/*
** prototypes
*/
-void alias_files (int, char **);
-void pwd_names (void);
-void grp_names (void);
-void grp_members (void);
-void grp_ids (void);
-void maildrops (void);
+void alias_files(int, char **);
+void pwd_names(void);
+void grp_names(void);
+void grp_members(void);
+void grp_ids(void);
+void maildrops(void);
void mdrop(char *);
void mdrop(char *);
-int check (char *);
-void setup (void);
+int check(char *);
+void setup(void);
int
int
-main (int argc, char **argv)
+main(int argc, char **argv)
{
int akp = 0, dp = 0;
char *cp, **argp, **arguments;
{
int akp = 0, dp = 0;
char *cp, **argp, **arguments;
@@
-68,48
+68,47
@@
main (int argc, char **argv)
#ifdef LOCALE
setlocale(LC_ALL, "");
#endif
#ifdef LOCALE
setlocale(LC_ALL, "");
#endif
- invo_name = r1bindex (argv[0], '/');
+ invo_name = mhbasename(argv[0]);
/* foil search of user profile/context */
/* foil search of user profile/context */
- if (context_foil (NULL) == -1)
- done (1);
+ if (context_foil(NULL) == -1)
+ done(1);
- mts_init (invo_name);
- arguments = getarguments (invo_name, argc, argv, 0);
+ mts_init(invo_name);
+ arguments = getarguments(invo_name, argc, argv, 0);
argp = arguments;
while ((cp = *argp++)) {
if (*cp == '-') {
argp = arguments;
while ((cp = *argp++)) {
if (*cp == '-') {
- switch (smatch (++cp, switches)) {
+ switch (smatch(++cp, switches)) {
case AMBIGSW:
case AMBIGSW:
- ambigsw (cp, switches);
- done (1);
+ ambigsw(cp, switches);
+ done(1);
case UNKWNSW:
case UNKWNSW:
- adios (NULL, "-%s unknown", cp);
+ adios(NULL, "-%s unknown", cp);
case HELPSW:
case HELPSW:
- snprintf (buf, sizeof(buf), "%s [switches] [aliasfiles ...]",
- invo_name);
- print_help (buf, switches, 0);
- done (1);
+ snprintf(buf, sizeof(buf), "%s [switches] [aliasfiles ...]", invo_name);
+ print_help(buf, switches, 0);
+ done(1);
case VERSIONSW:
print_version(invo_name);
case VERSIONSW:
print_version(invo_name);
- done (1);
+ done(1);
case MAILSW:
if (!(cp = *argp++) || *cp == '-')
case MAILSW:
if (!(cp = *argp++) || *cp == '-')
- adios (NULL, "missing argument to %s", argp[-2]);
+ adios(NULL, "missing argument to %s", argp[-2]);
if (mail)
if (mail)
- adios (NULL, "mail to one address only");
+ adios(NULL, "mail to one address only");
else
mail = cp;
continue;
case SERCHSW:
if (!(cp = *argp++) || *cp == '-')
else
mail = cp;
continue;
case SERCHSW:
if (!(cp = *argp++) || *cp == '-')
- adios (NULL, "missing argument to %s", argp[-2]);
+ adios(NULL, "missing argument to %s", argp[-2]);
if (dp >= NDIRS)
if (dp >= NDIRS)
- adios (NULL, "more than %d directories", NDIRS);
+ adios(NULL, "more than %d directories", NDIRS);
dirs[dp++] = cp;
continue;
}
dirs[dp++] = cp;
continue;
}
@@
-117,66
+116,65
@@
main (int argc, char **argv)
akv[akp++] = cp;
}
akv[akp++] = cp;
}
- if (akp == 0)
- akv[akp++] = AliasFile;
if (!homehead)
if (!homehead)
- init_pw ();
+ init_pw();
if (!mail)
out = stdout;
dirs[dp] = NULL;
if (!mail)
out = stdout;
dirs[dp] = NULL;
- alias_files (akp, akv);
- pwd_names ();
- grp_names ();
- grp_members ();
- grp_ids ();
+ alias_files(akp, akv);
+ pwd_names();
+ grp_names();
+ grp_members();
+ grp_ids();
#ifdef UCI
#ifdef UCI
- ldr_names ();
- ldr_ship ();
+ ldr_names();
+ ldr_ship();
#endif /* UCI */
#endif /* UCI */
- maildrops ();
+ maildrops();
- done (0);
+ done(0);
return 1;
}
void
return 1;
}
void
-alias_files (int akp, char **akv)
+alias_files(int akp, char **akv)
{
register int i, err;
for (i = 0; i < akp; i++)
{
register int i, err;
for (i = 0; i < akp; i++)
- if ((err = alias (akv[i])) != AK_OK) {
- setup ();
- fprintf (out, "aliasing error in %s - %s\n", akv[i], akerror (err));
+ if ((err = alias(akv[i])) != AK_OK) {
+ setup();
+ fprintf(out, "aliasing error in %s - %s\n", akv[i],
+ akerror(err));
} else if (out && !mail)
} else if (out && !mail)
- fprintf (out, "alias file %s is ok\n", akv[i]);
+ fprintf(out, "alias file %s is ok\n", akv[i]);
}
void
}
void
-pwd_names (void)
+pwd_names(void)
{
int hit = 0;
register struct home *hm, *lm;
for (hm = homehead; hm; hm = hm->h_next)
for (lm = hm->h_next; lm; lm = lm->h_next)
{
int hit = 0;
register struct home *hm, *lm;
for (hm = homehead; hm; hm = hm->h_next)
for (lm = hm->h_next; lm; lm = lm->h_next)
- if (strcmp (hm->h_name, lm->h_name) == 0) {
- setup ();
- fprintf (out, "duplicate user %s(uid=%d)\n",
+ if (strcmp(hm->h_name, lm->h_name) == 0) {
+ setup();
+ fprintf(out, "duplicate user %s(uid=%d)\n",
lm->h_name, (int) lm->h_uid);
hit++;
}
if (!hit && out && !mail)
lm->h_name, (int) lm->h_uid);
hit++;
}
if (!hit && out && !mail)
- fprintf (out, "no duplicate users\n");
+ fprintf(out, "no duplicate users\n");
}
void
}
void
-grp_names (void)
+grp_names(void)
{
int numgroups, maxgroups;
int i, hit = 0;
{
int numgroups, maxgroups;
int i, hit = 0;
@@
-188,12
+186,12
@@
grp_names (void)
maxgroups = NGRPS;
grps = (char **) mh_xmalloc((size_t) (maxgroups * sizeof(*grps)));
maxgroups = NGRPS;
grps = (char **) mh_xmalloc((size_t) (maxgroups * sizeof(*grps)));
- setgrent ();
- while ((gr = getgrent ())) {
+ setgrent();
+ while ((gr = getgrent())) {
for (i = 0; i < numgroups; i++)
for (i = 0; i < numgroups; i++)
- if (!strcmp (grps[i], gr->gr_name)) {
- setup ();
- fprintf (out, "duplicate group %s(gid=%d)\n",
+ if (!strcmp(grps[i], gr->gr_name)) {
+ setup();
+ fprintf(out, "duplicate group %s(gid=%d)\n",
gr->gr_name, (int) gr->gr_gid);
hit++;
break;
gr->gr_name, (int) gr->gr_gid);
hit++;
break;
@@
-204,97
+202,94
@@
grp_names (void)
grps = (char **) mh_xrealloc(grps,
(size_t) (maxgroups * sizeof(*grps)));
}
grps = (char **) mh_xrealloc(grps,
(size_t) (maxgroups * sizeof(*grps)));
}
- grps[numgroups++] = getcpy (gr->gr_name);
+ grps[numgroups++] = getcpy(gr->gr_name);
}
}
}
}
- endgrent ();
+ endgrent();
for (i = 0; i < numgroups; i++)
for (i = 0; i < numgroups; i++)
- free (grps[i]);
- free (grps);
+ free(grps[i]);
+ free(grps);
if (!hit && out && !mail)
if (!hit && out && !mail)
- fprintf (out, "no duplicate groups\n");
+ fprintf(out, "no duplicate groups\n");
}
void
}
void
-grp_members (void)
+grp_members(void)
{
register int hit = 0;
register char **cp, **dp;
register struct group *gr;
register struct home *hm;
{
register int hit = 0;
register char **cp, **dp;
register struct group *gr;
register struct home *hm;
- setgrent ();
- while ((gr = getgrent ())) {
+ setgrent();
+ while ((gr = getgrent())) {
for (cp = gr->gr_mem; *cp; cp++) {
for (hm = homehead; hm; hm = hm->h_next)
for (cp = gr->gr_mem; *cp; cp++) {
for (hm = homehead; hm; hm = hm->h_next)
- if (!strcmp (*cp, hm->h_name))
+ if (!strcmp(*cp, hm->h_name))
break;
if (hm == NULL) {
break;
if (hm == NULL) {
- setup ();
- fprintf (out, "group %s(gid=%d) has unknown member %s\n",
- gr->gr_name, (int) gr->gr_gid, *cp);
+ setup();
+ fprintf(out, "group %s(gid=%d) has unknown member %s\n", gr->gr_name, (int) gr->gr_gid, *cp);
hit++;
} else {
hm->h_ngrps++;
}
for (dp = cp + 1; *dp; dp++)
hit++;
} else {
hm->h_ngrps++;
}
for (dp = cp + 1; *dp; dp++)
- if (strcmp (*cp, *dp) == 0) {
- setup ();
- fprintf (out, "group %s(gid=%d) has duplicate member %s\n",
- gr->gr_name, (int) gr->gr_gid, *cp);
+ if (strcmp(*cp, *dp) == 0) {
+ setup();
+ fprintf(out, "group %s(gid=%d) has duplicate member %s\n", gr->gr_name, (int) gr->gr_gid, *cp);
hit++;
}
}
}
hit++;
}
}
}
- endgrent ();
+ endgrent();
for (hm = homehead; hm; hm = hm->h_next)
if (hm->h_ngrps > NGROUPS_MAX) {
for (hm = homehead; hm; hm = hm->h_next)
if (hm->h_ngrps > NGROUPS_MAX) {
- setup ();
- fprintf (out, "user %s is a member of %d groups (max %d)\n",
+ setup();
+ fprintf(out, "user %s is a member of %d groups (max %d)\n",
hm->h_name, hm->h_ngrps, NGROUPS_MAX);
hit++;
}
if (!hit && out && !mail)
hm->h_name, hm->h_ngrps, NGROUPS_MAX);
hit++;
}
if (!hit && out && !mail)
- fprintf (out, "all group members accounted for\n");
+ fprintf(out, "all group members accounted for\n");
}
void
}
void
-grp_ids (void)
+grp_ids(void)
{ /* -DRAND not implemented at most places */
register int hit = 0;
register struct home *hm;
for (hm = homehead; hm; hm = hm->h_next)
{ /* -DRAND not implemented at most places */
register int hit = 0;
register struct home *hm;
for (hm = homehead; hm; hm = hm->h_next)
- if (getgrgid (hm->h_gid) == NULL) {
- setup ();
- fprintf (out, "user %s(uid=%d) has unknown group-id %d\n",
- hm->h_name, (int) hm->h_uid, (int) hm->h_gid);
+ if (getgrgid(hm->h_gid) == NULL) {
+ setup();
+ fprintf(out, "user %s(uid=%d) has unknown group-id %d\n", hm->h_name, (int) hm->h_uid, (int) hm->h_gid);
hit++;
}
if (!hit && out && !mail)
hit++;
}
if (!hit && out && !mail)
- fprintf (out, "all group-id users accounted for\n");
+ fprintf(out, "all group-id users accounted for\n");
}
void
}
void
-maildrops (void)
+maildrops(void)
{
register int i;
if (mmdfldir && *mmdfldir)
{
register int i;
if (mmdfldir && *mmdfldir)
- mdrop (mmdfldir);
+ mdrop(mmdfldir);
if (uucpldir && *uucpldir)
if (uucpldir && *uucpldir)
- mdrop (uucpldir);
+ mdrop(uucpldir);
for (i = 0; dirs[i]; i++)
for (i = 0; dirs[i]; i++)
- mdrop (dirs[i]);
+ mdrop(dirs[i]);
}
}
@@
-303,41
+298,40
@@
mdrop(char *drop)
{
register int hit = 0;
register struct dirent *dp;
{
register int hit = 0;
register struct dirent *dp;
- register DIR *dd = opendir (drop);
+ register DIR *dd = opendir(drop);
if (!dd) {
if (!dd) {
- setup ();
- fprintf (out, "unable to open maildrop area %s\n", drop);
+ setup();
+ fprintf(out, "unable to open maildrop area %s\n", drop);
return;
}
return;
}
- while ((dp = readdir (dd)))
- if (dp->d_name[0] != '.' && !check (dp->d_name)) {
- setup ();
- fprintf (out, "there is a maildrop for the unknown user %s in %s\n",
- dp->d_name, drop);
+ while ((dp = readdir(dd)))
+ if (dp->d_name[0] != '.' && !check(dp->d_name)) {
+ setup();
+ fprintf(out, "there is a maildrop for the unknown user %s in %s\n", dp->d_name, drop);
hit++;
}
hit++;
}
- closedir (dd);
+ closedir(dd);
if (!hit && out && !mail)
if (!hit && out && !mail)
- fprintf (out, "all maildrops accounted for in %s\n", drop);
+ fprintf(out, "all maildrops accounted for in %s\n", drop);
}
int
}
int
-check (char *s)
+check(char *s)
{
register struct home *hm;
for (hm = homehead; hm; hm = hm->h_next)
{
register struct home *hm;
for (hm = homehead; hm; hm = hm->h_next)
- if (!strcmp (s, hm->h_name))
+ if (!strcmp(s, hm->h_name))
return 1;
return 0;
}
void
return 1;
return 0;
}
void
-setup (void)
+setup(void)
{
int fd, pd[2];
{
int fd, pd[2];
@@
-345,33
+339,34
@@
setup (void)
return;
if (mail) {
return;
if (mail) {
- if (pipe (pd) == NOTOK)
- adios ("pipe", "unable to");
+ if (pipe(pd) == NOTOK)
+ adios("pipe", "unable to");
- switch (fork ()) {
+ switch (fork()) {
case NOTOK:
case NOTOK:
- adios ("fork", "unable to");
+ adios("fork", "unable to");
case OK:
case OK:
- close (pd[1]);
+ close(pd[1]);
if (pd[0] != 0) {
if (pd[0] != 0) {
- dup2 (pd[0], 0);
- close (pd[0]);
+ dup2(pd[0], 0);
+ close(pd[0]);
}
}
- if ((fd = open ("/dev/null", O_WRONLY)) != NOTOK)
+ if ((fd = open("/dev/null", O_WRONLY))
+ != NOTOK)
if (fd != 1) {
if (fd != 1) {
- dup2 (fd, 1);
- close (fd);
+ dup2(fd, 1);
+ close(fd);
}
}
- execlp (mailproc, r1bindex (mailproc, '/'),
- mail, "-subject", invo_name, NULL);
- adios (mailproc, "unable to exec ");
+ execlp(mailproc, mhbasename(mailproc),
+ mail, "-subject", invo_name,
+ NULL);
+ adios(mailproc, "unable to exec ");
default:
default:
- close (pd[0]);
- out = fdopen (pd[1], "w");
- fprintf (out, "%s: the following is suspicious\n\n",
- invo_name);
+ close(pd[0]);
+ out = fdopen(pd[1], "w");
+ fprintf(out, "%s: the following is suspicious\n\n", invo_name);
}
}
}
}
}
}
@@
-390,8
+385,8
@@
struct grpldr {
char **gl_ldr;
};
char **gl_ldr;
};
-int setglent (), endglent ();
-struct grpldr *getglent (), *getglnam ();
+int setglent(), endglent();
+struct grpldr *getglent(), *getglnam();
/* taken from the getglent() routines */
/* taken from the getglent() routines */
@@
-406,9
+401,9
@@
static char *gl_ldr[MAXGLS + 1];
setglent() {
if (glp == NULL)
setglent() {
if (glp == NULL)
- glp = fopen (GLDRS, "r");
+ glp = fopen(GLDRS, "r");
else
else
- rewind (glp);
+ rewind(glp);
return (glp != NULL);
}
return (glp != NULL);
}
@@
-416,28
+411,28
@@
setglent() {
endglent() {
if (glp != NULL) {
endglent() {
if (glp != NULL) {
- fclose (glp);
+ fclose(glp);
glp = NULL;
}
return 1;
}
glp = NULL;
}
return 1;
}
-struct grpldr *getglent () {
+struct grpldr *getglent() {
register char *cp, **q;
register char *cp, **q;
- if (glp == NULL && !setglent ())
+ if (glp == NULL && !setglent())
return NULL;
return NULL;
- if ((cp = fgets (line, BUFSIZ, glp)) == NULL)
+ if ((cp = fgets(line, BUFSIZ, glp)) == NULL)
return NULL;
grpldr.gl_name = cp;
grpldr.gl_ldr = q = gl_ldr;
while (*cp) {
return NULL;
grpldr.gl_name = cp;
grpldr.gl_ldr = q = gl_ldr;
while (*cp) {
- while (*cp && !isspace (*cp))
+ while (*cp && !isspace(*cp))
cp++;
cp++;
- while (*cp && isspace (*cp))
+ while (*cp && isspace(*cp))
*cp++ = '\0';
if (*cp == '\0')
break;
*cp++ = '\0';
if (*cp == '\0')
break;
@@
-451,89
+446,85
@@
struct grpldr *getglent () {
return (&grpldr);
}
return (&grpldr);
}
-struct grpldr *getglnam (name)
+struct grpldr *getglnam(name)
char *name;
{
register struct grpldr *gl = NULL;
char *name;
{
register struct grpldr *gl = NULL;
- setglent ();
- while (gl = getglent ())
- if (strcmp (name, gl->gl_name) == 0)
+ setglent();
+ while (gl = getglent())
+ if (strcmp(name, gl->gl_name) == 0)
break;
break;
- endglent ();
+ endglent();
return gl;
}
return gl;
}
-ldr_names () {
+ldr_names() {
register int gp, hit = 0;
char *gldrs[NGRPS];
register struct grpldr *gl;
gldrs[0] = NULL;
register int gp, hit = 0;
char *gldrs[NGRPS];
register struct grpldr *gl;
gldrs[0] = NULL;
- setglent ();
- while (gl = getglent ()) {
- if (getgrnam (gl->gl_name) == NULL) {
- setup ();
- fprintf (out, "unknown group %s in group leaders file\n",
+ setglent();
+ while (gl = getglent()) {
+ if (getgrnam(gl->gl_name) == NULL) {
+ setup();
+ fprintf(out, "unknown group %s in group leaders file\n",
gl->gl_name);
hit++;
}
for (gp = 0; gldrs[gp]; gp++)
gl->gl_name);
hit++;
}
for (gp = 0; gldrs[gp]; gp++)
- if (strcmp (gldrs[gp], gl->gl_name) == 0) {
- setup ();
- fprintf (out, "duplicate group %s in group leaders file\n",
- gl->gl_name);
+ if (strcmp(gldrs[gp], gl->gl_name) == 0) {
+ setup();
+ fprintf(out, "duplicate group %s in group leaders file\n", gl->gl_name);
hit++;
break;
}
if (gldrs[gp] == NULL)
if (gp < NGRPS) {
hit++;
break;
}
if (gldrs[gp] == NULL)
if (gp < NGRPS) {
- gldrs[gp++] = getcpy (gl->gl_name);
+ gldrs[gp++] = getcpy(gl->gl_name);
gldrs[gp] = NULL;
} else {
gldrs[gp] = NULL;
} else {
- setup ();
- fprintf (out, "more than %d groups in group leaders file%s\n",
- " (time to recompile)", NGRPS - 1);
+ setup();
+ fprintf(out, "more than %d groups in group leaders file (time to recompile)\n", NGRPS - 1);
hit++;
}
}
hit++;
}
}
- endglent ();
+ endglent();
for (gp = 0; gldrs[gp]; gp++)
for (gp = 0; gldrs[gp]; gp++)
- free (gldrs[gp]);
+ free(gldrs[gp]);
if (!hit && out && !mail)
if (!hit && out && !mail)
- fprintf (out, "all groups in group leaders file accounted for\n");
+ fprintf(out, "all groups in group leaders file accounted for\n");
}
}
-ldr_ship () {
+ldr_ship() {
register int hit = 0;
register char **cp, **dp;
register struct grpldr *gl;
register int hit = 0;
register char **cp, **dp;
register struct grpldr *gl;
- setglent ();
- while (gl = getglent ())
+ setglent();
+ while (gl = getglent())
for (cp = gl->gl_ldr; *cp; cp++) {
for (cp = gl->gl_ldr; *cp; cp++) {
- if (!check (*cp)) {
- setup ();
- fprintf (out, "group %s has unknown leader %s\n",
- gl->gl_name, *cp);
+ if (!check(*cp)) {
+ setup();
+ fprintf(out, "group %s has unknown leader %s\n", gl->gl_name, *cp);
hit++;
}
for (dp = cp + 1; *dp; dp++)
hit++;
}
for (dp = cp + 1; *dp; dp++)
- if (strcmp (*cp, *dp) == 0) {
- setup ();
- fprintf (out, "group %s had duplicate leader %s\n",
- gl->gl_name, *cp);
+ if (strcmp(*cp, *dp) == 0) {
+ setup();
+ fprintf(out, "group %s had duplicate leader %s\n", gl->gl_name, *cp);
hit++;
}
}
hit++;
}
}
- endglent ();
+ endglent();
if (!hit && out && !mail)
if (!hit && out && !mail)
- fprintf (out, "all group leaders accounted for\n");
+ fprintf(out, "all group leaders accounted for\n");
}
#endif /* UCI */
}
#endif /* UCI */