diff --git a/lib/gshadow.c b/lib/gshadow.c index f075aa97..d9b26707 100644 --- a/lib/gshadow.c +++ b/lib/gshadow.c @@ -103,7 +103,7 @@ void endsgent (void) (void) fclose (shadow); } - shadow = (FILE *) 0; + shadow = NULL; } /*@observer@*//*@null@*/struct sgrp *sgetsgent (const char *string) @@ -399,7 +399,7 @@ void endsgent (void) nis_disabled = true; } #endif - while ((sgrp = getsgent ()) != (struct sgrp *) 0) { + while ((sgrp = getsgent ()) != NULL) { if (strcmp (name, sgrp->sg_name) == 0) { break; } diff --git a/lib/port.c b/lib/port.c index 90eb1498..a100a7ce 100644 --- a/lib/port.c +++ b/lib/port.c @@ -79,7 +79,7 @@ static void endportent (void) (void) fclose (ports); } - ports = (FILE *) 0; + ports = NULL; } /* @@ -172,13 +172,13 @@ static struct port *getportent (void) } *cp = '\0'; cp++; - port.pt_names[j + 1] = (char *) 0; + port.pt_names[j + 1] = NULL; /* * Get the list of user names. It is the second colon * separated field, and is a comma separated list of user * names. The entry '*' is used to specify all usernames. - * The last entry in the list is a (char *) 0 pointer. + * The last entry in the list is a NULL pointer. */ if (':' != *cp) { diff --git a/lib/sgetgrent.c b/lib/sgetgrent.c index ad4fcc86..3d749502 100644 --- a/lib/sgetgrent.c +++ b/lib/sgetgrent.c @@ -34,7 +34,7 @@ */ static char **list (char *s) { - static char **members = 0; + static char **members = NULL; static int size = 0; /* max members + 1 */ int i; char **rbuf; @@ -55,9 +55,9 @@ static char **list (char *s) } if (!rbuf) { free (members); - members = 0; + members = NULL; size = 0; - return (char **) 0; + return NULL; } members = rbuf; } @@ -71,14 +71,14 @@ static char **list (char *s) *s++ = '\0'; } } - members[i] = (char *) 0; + members[i] = NULL; return members; } struct group *sgetgrent (const char *buf) { - static char *grpbuf = 0; + static char *grpbuf = NULL; static size_t size = 0; static char *grpfields[NFIELDS]; static struct group grent; @@ -91,9 +91,9 @@ struct group *sgetgrent (const char *buf) free (grpbuf); size = strlen (buf) + 1000; /* at least: strlen(buf) + 1 */ grpbuf = malloc (size); - if (!grpbuf) { + if (grpbuf == NULL) { size = 0; - return 0; + return NULL; } } strcpy (grpbuf, buf); @@ -112,16 +112,16 @@ struct group *sgetgrent (const char *buf) } } if (i < (NFIELDS - 1) || *grpfields[2] == '\0' || cp != NULL) { - return (struct group *) 0; + return NULL; } grent.gr_name = grpfields[0]; grent.gr_passwd = grpfields[1]; if (get_gid (grpfields[2], &grent.gr_gid) == 0) { - return (struct group *) 0; + return NULL; } grent.gr_mem = list (grpfields[3]); if (NULL == grent.gr_mem) { - return (struct group *) 0; /* out of memory */ + return NULL; /* out of memory */ } return &grent; diff --git a/lib/shadow.c b/lib/shadow.c index 6a89a3f6..8959f4b0 100644 --- a/lib/shadow.c +++ b/lib/shadow.c @@ -94,7 +94,7 @@ void endspent (void) (void) fclose (shadow); } - shadow = (FILE *) 0; + shadow = NULL; } /* @@ -336,9 +336,9 @@ struct spwd *fgetspent (FILE * fp) } #ifdef USE_NIS - while (fgets (buf, (int) sizeof buf, fp) != (char *) 0) + while (fgets (buf, (int) sizeof buf, fp) != NULL) #else - if (fgets (buf, (int) sizeof buf, fp) != (char *) 0) + if (fgets (buf, (int) sizeof buf, fp) != NULL) #endif { cp = strchr (buf, '\n'); @@ -511,7 +511,7 @@ struct spwd *getspnam (const char *name) nis_disabled = true; } #endif - while ((sp = getspent ()) != (struct spwd *) 0) { + while ((sp = getspent ()) != NULL) { if (strcmp (name, sp->sp_namp) == 0) { break; } diff --git a/libmisc/age.c b/libmisc/age.c index d10f71b9..744bcd85 100644 --- a/libmisc/age.c +++ b/libmisc/age.c @@ -112,7 +112,7 @@ int expire (const struct passwd *pw, /*@null@*/const struct spwd *sp) _exit (126); } - (void) execl (PASSWD_PROGRAM, PASSWD_PROGRAM, pw->pw_name, (char *) 0); + (void) execl (PASSWD_PROGRAM, PASSWD_PROGRAM, pw->pw_name, (char *) NULL); err = errno; perror ("Can't execute " PASSWD_PROGRAM); _exit ((ENOENT == err) ? E_CMD_NOTFOUND : E_CMD_NOEXEC); @@ -139,7 +139,7 @@ int expire (const struct passwd *pw, /*@null@*/const struct spwd *sp) void agecheck (/*@null@*/const struct spwd *sp) { - long now = (long) time ((time_t *) 0) / SCALE; + long now = (long) time(NULL) / SCALE; long remain; if (NULL == sp) { diff --git a/libmisc/entry.c b/libmisc/entry.c index 87f57545..cc4029d0 100644 --- a/libmisc/entry.c +++ b/libmisc/entry.c @@ -24,7 +24,7 @@ void pw_entry (const char *name, struct passwd *pwent) struct spwd *spwd; if (!(passwd = getpwnam (name))) { /* local, no need for xgetpwnam */ - pwent->pw_name = (char *) 0; + pwent->pw_name = NULL; return; } else { pwent->pw_name = xstrdup (passwd->pw_name); diff --git a/libmisc/env.c b/libmisc/env.c index c6ab6727..859dca08 100644 --- a/libmisc/env.c +++ b/libmisc/env.c @@ -41,7 +41,7 @@ static const char *const forbid[] = { "PATH=", "SHELL=", "SHLIB_PATH=", - (char *) 0 + NULL }; /* these are allowed, but with no slashes inside @@ -50,7 +50,7 @@ static const char *const noslash[] = { "LANG=", "LANGUAGE=", "LC_", /* anything with the LC_ prefix */ - (char *) 0 + NULL }; /* diff --git a/libmisc/isexpired.c b/libmisc/isexpired.c index ff203967..5813015f 100644 --- a/libmisc/isexpired.c +++ b/libmisc/isexpired.c @@ -40,7 +40,7 @@ int isexpired (const struct passwd *pw, /*@null@*/const struct spwd *sp) { long now; - now = (long) time ((time_t *) 0) / SCALE; + now = (long) time(NULL) / SCALE; if (NULL == sp) { return 0; diff --git a/libmisc/list.c b/libmisc/list.c index 9d7ec77b..9470b06c 100644 --- a/libmisc/list.c +++ b/libmisc/list.c @@ -33,7 +33,7 @@ * pointer if it is present. */ - for (i = 0; list[i] != (char *) 0; i++) { + for (i = 0; list[i] != NULL; i++) { if (strcmp (list[i], member) == 0) { return list; } @@ -52,12 +52,12 @@ * is returned to the invoker. */ - for (i = 0; list[i] != (char *) 0; i++) { + for (i = 0; list[i] != NULL; i++) { tmp[i] = list[i]; } tmp[i] = xstrdup (member); - tmp[i+1] = (char *) 0; + tmp[i+1] = NULL; return tmp; } @@ -83,7 +83,7 @@ * pointer if it is not present. */ - for (i = j = 0; list[i] != (char *) 0; i++) { + for (i = j = 0; list[i] != NULL; i++) { if (strcmp (list[i], member) != 0) { j++; } @@ -106,14 +106,14 @@ * is returned to the invoker. */ - for (i = j = 0; list[i] != (char *) 0; i++) { + for (i = j = 0; list[i] != NULL; i++) { if (strcmp (list[i], member) != 0) { tmp[j] = list[i]; j++; } } - tmp[j] = (char *) 0; + tmp[j] = NULL; return tmp; } @@ -142,7 +142,7 @@ list++; } - tmp[i] = (char *) 0; + tmp[i] = NULL; return tmp; } @@ -217,7 +217,7 @@ bool is_on_list (char *const *list, const char *member) */ if ('\0' == *members) { - *array = (char *) 0; + *array = NULL; free (members); return array; } @@ -235,7 +235,7 @@ bool is_on_list (char *const *list, const char *member) cp2++; cp = cp2; } else { - array[i + 1] = (char *) 0; + array[i + 1] = NULL; break; } } diff --git a/libmisc/loginprompt.c b/libmisc/loginprompt.c index 6ada2d05..00320783 100644 --- a/libmisc/loginprompt.c +++ b/libmisc/loginprompt.c @@ -122,7 +122,7 @@ void login_prompt (const char *prompt, char *name, int namesize) int envc; for (envc = 0; envc < MAX_ENV; envc++) { - nvar = strtok ((0 != envc) ? (char *) 0 : cp, " \t,"); + nvar = strtok ((0 != envc) ? NULL : cp, " \t,"); if (NULL == nvar) { break; } diff --git a/libmisc/pwdcheck.c b/libmisc/pwdcheck.c index e72920e8..a1f85cef 100644 --- a/libmisc/pwdcheck.c +++ b/libmisc/pwdcheck.c @@ -26,7 +26,7 @@ void passwd_check (const char *user, const char *passwd, unused const char *prog if (NULL != sp) { passwd = sp->sp_pwdp; } - if (pw_auth (passwd, user, PW_LOGIN, (char *) 0) != 0) { + if (pw_auth (passwd, user, PW_LOGIN, NULL) != 0) { SYSLOG ((LOG_WARN, "incorrect password for `%s'", user)); (void) sleep (1); fprintf (log_get_logfd(), _("Incorrect password for %s.\n"), user); diff --git a/libmisc/shell.c b/libmisc/shell.c index 7c67500d..b0d7e87d 100644 --- a/libmisc/shell.c +++ b/libmisc/shell.c @@ -33,7 +33,7 @@ int shell (const char *file, /*@null@*/const char *arg, char *const envp[]) char arg0[1024]; int err; - if (file == (char *) 0) { + if (file == NULL) { errno = EINVAL; return errno; } @@ -44,7 +44,7 @@ int shell (const char *file, /*@null@*/const char *arg, char *const envp[]) * that. So, we determine the 0'th entry only if they * don't want to tell us what it is themselves. */ - if (arg == (char *) 0) { + if (arg == NULL) { (void) snprintf (arg0, sizeof arg0, "-%s", Basename (file)); arg0[sizeof arg0 - 1] = '\0'; arg = arg0; @@ -55,7 +55,7 @@ int shell (const char *file, /*@null@*/const char *arg, char *const envp[]) * able to figure out what we are up to without too much * grief. */ - (void) execle (file, arg, (char *) 0, envp); + (void) execle (file, arg, (char *) NULL, envp); err = errno; if (access (file, R_OK|X_OK) == 0) { @@ -63,7 +63,7 @@ int shell (const char *file, /*@null@*/const char *arg, char *const envp[]) * Assume this is a shell script (with no shebang). * Interpret it with /bin/sh */ - (void) execle (SHELL, "sh", "-", file, (char *)0, envp); + (void) execle (SHELL, "sh", "-", file, (char *) NULL, envp); err = errno; } diff --git a/libmisc/sulog.c b/libmisc/sulog.c index 3e956134..2ef22b2e 100644 --- a/libmisc/sulog.c +++ b/libmisc/sulog.c @@ -64,7 +64,7 @@ void sulog (const char *tty, bool success, const char *oldname, const char *name /* Do not return if the group permission were raised. */ exit (EXIT_FAILURE); } - if (fp == (FILE *) 0) { + if (fp == NULL) { return; /* can't open or create logfile */ } diff --git a/src/chfn.c b/src/chfn.c index b1793e18..246e2e82 100644 --- a/src/chfn.c +++ b/src/chfn.c @@ -510,28 +510,28 @@ static void get_old_fields (const char *gecos) * Now get the full name. It is the first comma separated field in * the GECOS field. */ - cp = copy_field (old_gecos, fflg ? (char *) 0 : fullnm, slop); + cp = copy_field (old_gecos, fflg ? NULL : fullnm, slop); /* * Now get the room number. It is the next comma separated field, * if there is indeed one. */ if (NULL != cp) { - cp = copy_field (cp, rflg ? (char *) 0 : roomno, slop); + cp = copy_field (cp, rflg ? NULL : roomno, slop); } /* * Now get the work phone number. It is the third field. */ if (NULL != cp) { - cp = copy_field (cp, wflg ? (char *) 0 : workph, slop); + cp = copy_field (cp, wflg ? NULL : workph, slop); } /* * Now get the home phone number. It is the fourth field. */ if (NULL != cp) { - cp = copy_field (cp, hflg ? (char *) 0 : homeph, slop); + cp = copy_field (cp, hflg ? NULL : homeph, slop); } /* diff --git a/src/chgpasswd.c b/src/chgpasswd.c index d17acb67..f6c92293 100644 --- a/src/chgpasswd.c +++ b/src/chgpasswd.c @@ -441,7 +441,7 @@ int main (int argc, char **argv) * group entry for each group will be looked up in the appropriate * file (gshadow or group) and the password changed. */ - while (fgets (buf, (int) sizeof buf, stdin) != (char *) 0) { + while (fgets (buf, (int) sizeof buf, stdin) != NULL) { line++; cp = strrchr (buf, '\n'); if (NULL != cp) { diff --git a/src/chpasswd.c b/src/chpasswd.c index 48d5178b..e3188a76 100644 --- a/src/chpasswd.c +++ b/src/chpasswd.c @@ -482,7 +482,7 @@ int main (int argc, char **argv) * last change date is set in the age only if aging information is * present. */ - while (fgets (buf, (int) sizeof buf, stdin) != (char *) 0) { + while (fgets (buf, (int) sizeof buf, stdin) != NULL) { line++; cp = strrchr (buf, '\n'); if (NULL != cp) { @@ -491,7 +491,7 @@ int main (int argc, char **argv) if (feof (stdin) == 0) { // Drop all remaining characters on this line. - while (fgets (buf, (int) sizeof buf, stdin) != (char *) 0) { + while (fgets (buf, (int) sizeof buf, stdin) != NULL) { cp = strchr (buf, '\n'); if (cp != NULL) { break; diff --git a/src/faillog.c b/src/faillog.c index 0f94836f..72b8a956 100644 --- a/src/faillog.c +++ b/src/faillog.c @@ -57,7 +57,7 @@ static bool rflg = false; /* reset the counters of login failures */ static struct stat statbuf; /* fstat buffer for file size */ -#define NOW (time((time_t *) 0)) +#define NOW time(NULL) static /*@noreturn@*/void usage (int status) { diff --git a/src/gpasswd.c b/src/gpasswd.c index e8befac3..a1739fce 100644 --- a/src/gpasswd.c +++ b/src/gpasswd.c @@ -721,7 +721,7 @@ static void check_perms (const struct group *gr) * --marekm */ if (!amroot) { - if (gr->gr_mem[0] == (char *) 0) { + if (gr->gr_mem[0] == NULL) { failure (); } diff --git a/src/groupdel.c b/src/groupdel.c index c84faa79..a9b15dca 100644 --- a/src/groupdel.c +++ b/src/groupdel.c @@ -275,7 +275,7 @@ static void group_busy (gid_t gid) * If pwd isn't NULL, it stopped because the gid's matched. */ - if (pwd == (struct passwd *) 0) { + if (pwd == NULL) { return; } diff --git a/src/groupmod.c b/src/groupmod.c index 8c219194..4921aca3 100644 --- a/src/groupmod.c +++ b/src/groupmod.c @@ -248,7 +248,7 @@ static void grp_update (void) if (NULL != grp.gr_mem[0]) gr_free_members(&grp); grp.gr_mem = (char **)xmalloc(sizeof(char *)); - grp.gr_mem[0] = (char *)0; + grp.gr_mem[0] = NULL; } else { // append to existing groups if (NULL != grp.gr_mem[0]) diff --git a/src/lastlog.c b/src/lastlog.c index f5c0a5cc..3338d6bd 100644 --- a/src/lastlog.c +++ b/src/lastlog.c @@ -56,7 +56,7 @@ static bool bflg = false; /* print excludes most recent days */ static bool Cflg = false; /* clear record for user */ static bool Sflg = false; /* set record for user */ -#define NOW (time ((time_t *) 0)) +#define NOW time(NULL) static /*@noreturn@*/void usage (int status) { diff --git a/src/login.c b/src/login.c index ea2b52ee..7d247cc4 100644 --- a/src/login.c +++ b/src/login.c @@ -974,7 +974,7 @@ int main (int argc, char **argv) goto auth_ok; } - if (pw_auth (user_passwd, username, reason, (char *) 0) == 0) { + if (pw_auth (user_passwd, username, reason, NULL) == 0) { goto auth_ok; } @@ -1041,7 +1041,7 @@ int main (int argc, char **argv) * all). --marekm */ if (user_passwd[0] == '\0') { - pw_auth ("!", username, reason, (char *) 0); + pw_auth ("!", username, reason, NULL); } /* @@ -1081,7 +1081,7 @@ int main (int argc, char **argv) * by Ivan Nejgebauer . --marekm */ if ( getdef_bool ("PORTTIME_CHECKS_ENAB") - && !isttytime (username, tty, time ((time_t *) 0))) { + && !isttytime (username, tty, time (NULL))) { SYSLOG ((LOG_WARN, "invalid login time for '%s'%s", username, fromhost)); closelog (); @@ -1308,7 +1308,7 @@ int main (int argc, char **argv) err = shell (tmp, pwd->pw_shell, newenvp); /* fake shell */ } else { /* exec the shell finally */ - err = shell (pwd->pw_shell, (char *) 0, newenvp); + err = shell (pwd->pw_shell, NULL, newenvp); } return ((err == ENOENT) ? E_CMD_NOTFOUND : E_CMD_NOEXEC); diff --git a/src/login_nopam.c b/src/login_nopam.c index 18072a43..e3c00ef0 100644 --- a/src/login_nopam.c +++ b/src/login_nopam.c @@ -117,9 +117,9 @@ int login_access (const char *user, const char *from) continue; } if ( ((perm = strtok (line, fs)) == NULL) - || ((users = strtok ((char *) 0, fs)) == NULL) - || ((froms = strtok ((char *) 0, fs)) == NULL) - || (strtok ((char *) 0, fs) != NULL)) { + || ((users = strtok (NULL, fs)) == NULL) + || ((froms = strtok (NULL, fs)) == NULL) + || (strtok (NULL, fs) != NULL)) { SYSLOG ((LOG_ERR, "%s: line %d: bad field count", TABLE, lineno)); @@ -154,7 +154,7 @@ static bool list_match (char *list, const char *item, bool (*match_fn) (const ch * a match, look for an "EXCEPT" list and recurse to determine whether * the match is affected by any exceptions. */ - for (tok = strtok (list, sep); tok != NULL; tok = strtok ((char *) 0, sep)) { + for (tok = strtok (list, sep); tok != NULL; tok = strtok (NULL, sep)) { if (strcasecmp (tok, "EXCEPT") == 0) { /* EXCEPT: give up */ break; } @@ -166,10 +166,10 @@ static bool list_match (char *list, const char *item, bool (*match_fn) (const ch /* Process exceptions to matches. */ if (match) { - while ( ((tok = strtok ((char *) 0, sep)) != NULL) + while ( ((tok = strtok (NULL, sep)) != NULL) && (strcasecmp (tok, "EXCEPT") != 0)) /* VOID */ ; - if (tok == 0 || !list_match ((char *) 0, item, match_fn)) { + if (tok == 0 || !list_match (NULL, item, match_fn)) { return (match); } } @@ -193,9 +193,9 @@ static char *myhostname (void) static bool netgroup_match (const char *group, const char *machine, const char *user) { - static char *mydomain = (char *)0; + static char *mydomain = NULL; - if (mydomain == (char *)0) { + if (mydomain == NULL) { static char domain[MAXHOSTNAMELEN + 1]; getdomainname (domain, MAXHOSTNAMELEN); @@ -228,7 +228,7 @@ static bool user_match (const char *tok, const char *string) && from_match (at + 1, myhostname ())); #if HAVE_INNETGR } else if (tok[0] == '@') { /* netgroup */ - return (netgroup_match (tok + 1, (char *) 0, string)); + return (netgroup_match (tok + 1, NULL, string)); #endif } else if (string_match (tok, string)) { /* ALL or exact match */ return true; @@ -303,7 +303,7 @@ static bool from_match (const char *tok, const char *string) */ #if HAVE_INNETGR if (tok[0] == '@') { /* netgroup */ - return (netgroup_match (tok + 1, string, (char *) 0)); + return (netgroup_match (tok + 1, string, NULL)); } else #endif if (string_match (tok, string)) { /* ALL or exact match */ diff --git a/src/newgrp.c b/src/newgrp.c index bdc007fe..7e949c95 100644 --- a/src/newgrp.c +++ b/src/newgrp.c @@ -504,7 +504,7 @@ int main (int argc, char **argv) if ((argc > 0) && (argv[0][0] == '-')) { usage (); goto failure; - } else if (argv[0] != (char *) 0) { + } else if (argv[0] != NULL) { group = argv[0]; } else { /* @@ -740,7 +740,7 @@ int main (int argc, char **argv) */ if (cflag) { closelog (); - execl (SHELL, "sh", "-c", command, (char *) 0); + execl (SHELL, "sh", "-c", command, (char *) NULL); #ifdef WITH_AUDIT snprintf (audit_buf, sizeof(audit_buf), "changing new-gid=%lu", (unsigned long) gid); @@ -820,7 +820,7 @@ int main (int argc, char **argv) * Exec the login shell and go away. We are trying to get back to * the previous environment which should be the user's login shell. */ - err = shell (prog, initflag ? (char *) 0 : progbase, newenvp); + err = shell (prog, initflag ? NULL : progbase, newenvp); exit ((err == ENOENT) ? E_CMD_NOTFOUND : E_CMD_NOEXEC); /*@notreached@*/ failure: diff --git a/src/newusers.c b/src/newusers.c index deeb3614..22db1e9a 100644 --- a/src/newusers.c +++ b/src/newusers.c @@ -1088,7 +1088,7 @@ int main (int argc, char **argv) * over 100 is allocated. The pw_gid field will be updated with that * value. */ - while (fgets (buf, (int) sizeof buf, stdin) != (char *) 0) { + while (fgets (buf, (int) sizeof buf, stdin) != NULL) { line++; cp = strrchr (buf, '\n'); if (NULL != cp) { diff --git a/src/pwck.c b/src/pwck.c index eaa4163f..83aaaca9 100644 --- a/src/pwck.c +++ b/src/pwck.c @@ -812,7 +812,7 @@ static void check_spw_file (int *errors, bool *changed) * Warn if last password change in the future. --marekm */ if (!quiet) { - time_t t = time ((time_t *) 0); + time_t t = time (NULL); if ( (t != 0) && (spw->sp_lstchg > (long) t / SCALE)) { printf (_("user %s: last password change in the future\n"), diff --git a/src/su.c b/src/su.c index 9578ab2b..4fe86fee 100644 --- a/src/su.c +++ b/src/su.c @@ -575,7 +575,7 @@ static void check_perms_nopam (const struct passwd *pw) * The first character of an administrator defined method is an '@' * character. */ - if (pw_auth (password, name, PW_SU, (char *) 0) != 0) { + if (pw_auth (password, name, PW_SU, NULL) != 0) { SYSLOG (((pw->pw_uid != 0)? LOG_NOTICE : LOG_WARN, "Authentication failed for %s", name)); fprintf(stderr, _("%s: Authentication failure\n"), Prog); @@ -598,7 +598,7 @@ static void check_perms_nopam (const struct passwd *pw) * there is a "SU" entry in the /etc/porttime file denying access to * the account. */ - if (!isttytime (name, "SU", time ((time_t *) 0))) { + if (!isttytime (name, "SU", time (NULL))) { SYSLOG (((0 != pw->pw_uid) ? LOG_WARN : LOG_CRIT, "SU by %s to restricted account %s", caller_name, name)); @@ -1130,7 +1130,7 @@ int main (int argc, char **argv) int fd = open ("/dev/tty", O_RDWR); if (fd >= 0) { - err = ioctl (fd, TIOCNOTTY, (char *) 0); + err = ioctl (fd, TIOCNOTTY, (char *) NULL); (void) close (fd); } else if (ENXIO == errno) { /* There are no controlling terminal already */ diff --git a/src/sulogin.c b/src/sulogin.c index 0d5b411d..002dc930 100644 --- a/src/sulogin.c +++ b/src/sulogin.c @@ -127,7 +127,7 @@ static void catch_signals (unused int sig) while (true) { /* repeatedly get login/password pairs */ char *cp; pw_entry (name, &pwent); /* get entry from password file */ - if (pwent.pw_name == (char *) 0) { + if (pwent.pw_name == NULL) { /* * Fail secure */ @@ -155,7 +155,7 @@ static void catch_signals (unused int sig) erase_pass (cp); (void) puts (""); #ifdef TELINIT - execl (PATH_TELINIT, "telinit", RUNLEVEL, (char *) 0); + execl (PATH_TELINIT, "telinit", RUNLEVEL, (char *) NULL); #endif exit (0); } @@ -177,7 +177,7 @@ static void catch_signals (unused int sig) (void) puts (_("Entering System Maintenance Mode")); /* exec the shell finally. */ - err = shell (pwent.pw_shell, (char *) 0, environ); + err = shell (pwent.pw_shell, NULL, environ); return ((err == ENOENT) ? E_CMD_NOTFOUND : E_CMD_NOEXEC); } diff --git a/src/useradd.c b/src/useradd.c index 1ade54a2..2da418b3 100644 --- a/src/useradd.c +++ b/src/useradd.c @@ -894,7 +894,7 @@ static int get_groups (char *list) close_group_files (); unlock_group_files (); - user_groups[ngroups] = (char *) 0; + user_groups[ngroups] = NULL; /* * Any errors in finding group names are fatal @@ -2546,7 +2546,7 @@ int main (int argc, char **argv) /* * Initialize the list to be empty */ - user_groups[0] = (char *) 0; + user_groups[0] = NULL; is_shadow_pwd = spw_file_present (); diff --git a/src/userdel.c b/src/userdel.c index 7012b0e0..6da6db1b 100644 --- a/src/userdel.c +++ b/src/userdel.c @@ -763,7 +763,7 @@ static void user_cancel (const char *user) } argv[0] = cmd; argv[1] = user; - argv[2] = (char *)0; + argv[2] = NULL; (void) run_command (cmd, argv, NULL, &status); } diff --git a/src/usermod.c b/src/usermod.c index c1a5b2cd..1c65a934 100644 --- a/src/usermod.c +++ b/src/usermod.c @@ -205,7 +205,7 @@ static int get_groups (char *list) /* * Initialize the list to be empty */ - user_groups[0] = (char *) 0; + user_groups[0] = NULL; if ('\0' == *list) { return 0; @@ -280,7 +280,7 @@ static int get_groups (char *list) gr_free ((struct group *)grp); } while (NULL != list); - user_groups[ngroups] = (char *) 0; + user_groups[ngroups] = NULL; /* * Any errors in finding group names are fatal @@ -2154,7 +2154,7 @@ int main (int argc, char **argv) sys_ngroups = sysconf (_SC_NGROUPS_MAX); user_groups = (char **) malloc (sizeof (char *) * (1 + sys_ngroups)); - user_groups[0] = (char *) 0; + user_groups[0] = NULL; is_shadow_pwd = spw_file_present (); #ifdef SHADOWGRP