]> andersk Git - openssh.git/blobdiff - logintest.c
- jakob@cvs.openbsd.org 2001/08/02 16:14:05
[openssh.git] / logintest.c
index e942bbef29c385f3d4138873d258dcfd4167d262..aa3f5f41f4e242b1e7188b19844d7d7b537d2ac5 100644 (file)
@@ -27,7 +27,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-/** 
+/**
  ** logintest.c:  simple test driver for platform-independent login recording
  **               and lastlog retrieval
  **/
 
 RCSID("$Id$");
 
+#ifdef HAVE___PROGNAME
+extern char *__progname;
+#else
+char *__progname;
+#endif
 
 #define PAUSE_BEFORE_LOGOUT 3
 
@@ -74,10 +79,10 @@ dump_logininfo(struct logininfo *li, char *descname)
               "\t\t\tfamily\t%d\n\t\t}\n"
               "\t}\n"
               "}\n",
-              descname, li->progname, li->type, 
+              descname, li->progname, li->type,
               li->pid, li->uid, li->line,
-              li->username, li->hostname, li->exit, 
-              li->termination, li->tv_sec, li->tv_usec, 
+              li->username, li->hostname, li->exit,
+              li->termination, li->tv_sec, li->tv_usec,
               li->hostaddr.sa.sa_family);
 }
 
@@ -134,7 +139,7 @@ testAPI()
 
        if (nologtest)
                return 1;
-  
+
        line_stripname(stripline, li1->line, sizeof(stripline));
 
        printf("Performing an invalid login attempt (no type field)\n--\n");
@@ -159,11 +164,11 @@ testAPI()
 #endif
        printf("--\n");
        login_login(li1);
-  
+
        snprintf(cmdstring, sizeof(cmdstring), "who | grep '%s '",
                 stripline);
        system(cmdstring);
-  
+
        printf("--\nPausing for %d second(s)...\n", PAUSE_BEFORE_LOGOUT);
        sleep(PAUSE_BEFORE_LOGOUT);
 
@@ -205,12 +210,12 @@ testAPI()
 #endif
 
        printf("--\nThe output of 'last' shown next should have "
-              "an entry for root \n  on %s for the time shown above:\n--\n", 
+              "an entry for root \n  on %s for the time shown above:\n--\n",
               stripline);
        snprintf(cmdstring, sizeof(cmdstring), "last | grep '%s ' | head -3",
                 stripline);
        system(cmdstring);
-            
+
        printf("--\nEnd of login test.\n");
 
        login_free_entry(li1);
@@ -255,9 +260,9 @@ testOutput()
 /* show which options got compiled in */
 void
 showOptions(void)
-{  
+{
        printf("**\n** Compile-time options\n**\n");
-  
+
        printf("login recording methods selected:\n");
 #ifdef USE_LOGIN
        printf("\tUSE_LOGIN\n");
@@ -287,23 +292,24 @@ main(int argc, char *argv[])
 {
        printf("Platform-independent login recording test driver\n");
 
+       __progname = get_progname(argv[0]);
        if (argc == 2) {
                if (strncmp(argv[1], "-i", 3) == 0)
                        compile_opts_only = 1;
                else if (strncmp(argv[1], "-v", 3) == 0)
                        be_verbose=1;
        }
-      
+
        if (!compile_opts_only) {
                if (be_verbose && !testOutput())
                        return 1;
-    
+
                if (!testAPI())
                        return 1;
        }
 
        showOptions();
-  
+
        return 0;
 } /* main() */
 
This page took 0.166966 seconds and 4 git commands to generate.