* libmisc/console.c, libmisc/motd.c, libmisc/setupenv.c,
libmisc/sulog.c, libmisc/hushed.c, libmisc/failure.c, libmisc/loginprompt.c, libmisc/ttytype.c, libmisc/pam_pass_non_interractive.c, src/userdel.c, src/login.c, lib/commonio.c, lib/commonio.h: Fix some const issues. * libmisc/motd.c: Avoid multi-statements lines. * libmisc/motd.c: Support long MOTD_FILE. * libmisc/list.c, lib/prototypes.h: Revert previous change. dup_list and is_on_list are used with members as defined for the group structure, and thus even if the list is not modified, the list elements cannot be constant strings. * libmisc/system.c: Avoid C++ comments. * src/vipw.c: WITH_TCB cannot be tested inside a gettextized string. Split the Usage string. * lib/commonio.h: Re-indent.
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
* Copyright (c) 1989 - 1991, Julianne Frances Haugh
|
||||
* Copyright (c) 1996 - 1997, Marek Michałkiewicz
|
||||
* Copyright (c) 2003 - 2005, Tomasz Kłoczko
|
||||
* Copyright (c) 2010 , Nicolas François
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -47,21 +48,34 @@
|
||||
void motd (void)
|
||||
{
|
||||
FILE *fp;
|
||||
char motdlist[BUFSIZ], *motdfile, *mb;
|
||||
char *motdlist;
|
||||
const char *motdfile;
|
||||
char *mb;
|
||||
register int c;
|
||||
|
||||
if ((mb = getdef_str ("MOTD_FILE")) == NULL)
|
||||
motdfile = getdef_str ("MOTD_FILE");
|
||||
if (NULL == motdfile) {
|
||||
return;
|
||||
}
|
||||
|
||||
strncpy (motdlist, mb, sizeof (motdlist));
|
||||
motdlist[sizeof (motdlist) - 1] = '\0';
|
||||
motdlist = xstrdup (motdfile);
|
||||
|
||||
for (mb = motdlist; (motdfile = strtok (mb, ":")) != NULL; mb = NULL) {
|
||||
if ((fp = fopen (motdfile, "r")) != NULL) {
|
||||
while ((c = getc (fp)) != EOF)
|
||||
for (mb = motdlist; ;mb = NULL) {
|
||||
motdfile = strtok (mb, ":");
|
||||
if (NULL == motdfile) {
|
||||
break;
|
||||
}
|
||||
|
||||
fp = fopen (motdfile, "r");
|
||||
if (NULL != fp) {
|
||||
while ((c = getc (fp)) != EOF) {
|
||||
putchar (c);
|
||||
}
|
||||
fclose (fp);
|
||||
}
|
||||
}
|
||||
fflush (stdout);
|
||||
|
||||
free (motdlist);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user