1: /*
   2:  * Sample program to access remote password lookup.
   3:  *
   4:  * Usage: lookup machine username
   5:  */
   6: #include <stdio.h>
   7: #include "PasswordLookup.h"
   8: 
   9: main(argc, argv)
  10:     int argc;
  11:     char **argv;
  12: {
  13:     Passwd passwd;
  14: 
  15:     if (argc != 3) {
  16:         fprintf(stderr, "Usage: %s machine username\n", argv[0]);
  17:         exit(1);
  18:     }
  19:     BindPasswordLookupToMachine(argv[1]);
  20:     passwd = LookupUser(argv[2]);
  21:     if (strcmp(passwd.pw_name, argv[2]) != 0)
  22:         printf("User %s unknown on %s.\n", argv[2], argv[1]);
  23:     else
  24:         display(&passwd);
  25: }
  26: 
  27: display(p)
  28:     Passwd *p;
  29: {
  30:     printf("%s:%s:%d:%d:%s:%s:%s\n",
  31:         p->pw_name,
  32:         p->pw_passwd,
  33:         p->pw_uid,
  34:         p->pw_gid,
  35:         p->pw_gecos,
  36:         p->pw_dir,
  37:         p->pw_shell);
  38: }

Defined functions

display defined in line 27; used 1 times
  • in line 24
main defined in line 9; never used
Last modified: 1983-05-12
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 856
Valid CSS Valid XHTML 1.0 Strict