]> git.ipfire.org Git - thirdparty/util-linux.git/blobdiff - login-utils/islocal.c
scriptreplay: cleanup usage()
[thirdparty/util-linux.git] / login-utils / islocal.c
index 0235b781c7b0cd5c40b52c26d846cf3e61d8e875..469bc5629de222caf1d047ecc3402a4c77009823 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * islocal.c - returns true if user is registered in the local
- * /etc/passwd file. Written by Alvaro Martinez Echevarria,
+ * /etc/passwd file. Written by Álvaro Martínez Echevarria,
  * alvaro@enano.etsit.upm.es, to allow peaceful coexistence with yp. Nov 94.
  *
  * Hacked a bit by poe@daimi.aau.dk
@@ -10,7 +10,7 @@
  *   to distinguish user names where one is a prefix of the other,
  *   and to use "pathnames.h". Oct 5, 96.
  *
- * 1999-02-22 Arkadiusz Mikiewicz <misiek@pld.ORG.PL>
+ * 1999-02-22 Arkadiusz Miśkiewicz <misiek@pld.ORG.PL>
  * - added Native Language Support
  *
  * 2008-04-06 James Youngman, jay@gnu.org
@@ -82,19 +82,16 @@ static int is_local_in_file(const char *user, const char *filename)
 int is_local(const char *user)
 {
        int rv;
-       if ((rv = is_local_in_file(user, _PATH_PASSWD)) < 0) {
-               perror(_PATH_PASSWD);
-               fprintf(stderr, _("cannot open %s"), _PATH_PASSWD);
-               exit(1);
-       } else {
-               return rv;
-       }
+
+       if ((rv = is_local_in_file(user, _PATH_PASSWD)) < 0)
+               err(EXIT_FAILURE, _("cannot open %s"), _PATH_PASSWD);
+       return rv;
 }
 
 #ifdef TEST_PROGRAM
 int main(int argc, char *argv[])
 {
-       atexit(close_stdout);
+       close_stdout_atexit();
        if (argc <= 2) {
                fprintf(stderr, _("Usage: %s <passwordfile> <username>...\n"),
                        argv[0]);