BSD 4_4_Lite1 release
[unix-history] / usr / src / libexec / rshd / rshd.c
index 0163da9..1b9eea9 100644 (file)
@@ -1,5 +1,5 @@
 /*-
 /*-
- * Copyright (c) 1988, 1989, 1992, 1993
+ * Copyright (c) 1988, 1989, 1992, 1993, 1994
  *     The Regents of the University of California.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  *     The Regents of the University of California.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
 
 #ifndef lint
 static char copyright[] =
 
 #ifndef lint
 static char copyright[] =
-"@(#) Copyright (c) 1988, 1989, 1992, 1993\n\
+"@(#) Copyright (c) 1988, 1989, 1992, 1993, 1994\n\
        The Regents of the University of California.  All rights reserved.\n";
 #endif /* not lint */
 
 #ifndef lint
        The Regents of the University of California.  All rights reserved.\n";
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)rshd.c     8.1 (Berkeley) 6/4/93";
+static char sccsid[] = "@(#)rshd.c     8.2 (Berkeley) 4/6/94";
 #endif /* not lint */
 
 /*
 #endif /* not lint */
 
 /*
@@ -58,16 +58,16 @@ static char sccsid[] = "@(#)rshd.c  8.1 (Berkeley) 6/4/93";
 #include <arpa/inet.h>
 #include <netdb.h>
 
 #include <arpa/inet.h>
 #include <netdb.h>
 
+#include <errno.h>
 #include <fcntl.h>
 #include <fcntl.h>
-#include <signal.h>
+#include <paths.h>
 #include <pwd.h>
 #include <pwd.h>
-#include <syslog.h>
-#include <unistd.h>
-#include <errno.h>
+#include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <paths.h>
+#include <syslog.h>
+#include <unistd.h>
 
 int    keepalive = 1;
 int    check_all;
 
 int    keepalive = 1;
 int    check_all;
@@ -140,7 +140,7 @@ main(argc, argv)
                case '?':
                default:
                        usage();
                case '?':
                default:
                        usage();
-                       exit(2);
+                       break;
                }
 
        argc -= optind;
                }
 
        argc -= optind;
@@ -654,7 +654,7 @@ fail:
        strcat(path, _PATH_DEFPATH);
        strncat(shell, pwd->pw_shell, sizeof(shell)-7);
        strncat(username, pwd->pw_name, sizeof(username)-6);
        strcat(path, _PATH_DEFPATH);
        strncat(shell, pwd->pw_shell, sizeof(shell)-7);
        strncat(username, pwd->pw_name, sizeof(username)-6);
-       cp = rindex(pwd->pw_shell, '/');
+       cp = strrchr(pwd->pw_shell, '/');
        if (cp)
                cp++;
        else
        if (cp)
                cp++;
        else
@@ -761,8 +761,7 @@ char *
 topdomain(h)
        char *h;
 {
 topdomain(h)
        char *h;
 {
-       register char *p;
-       char *maybe = NULL;
+       char *p, *maybe = NULL;
        int dots = 0;
 
        for (p = h + strlen(h); p >= h; p--) {
        int dots = 0;
 
        for (p = h + strlen(h); p >= h; p--) {
@@ -778,5 +777,7 @@ topdomain(h)
 void
 usage()
 {
 void
 usage()
 {
+
        syslog(LOG_ERR, "usage: rshd [-%s]", OPTIONS);
        syslog(LOG_ERR, "usage: rshd [-%s]", OPTIONS);
+       exit(2);
 }
 }