home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / c / cops_104.zip / cops_104 / src / tilde.c < prev    next >
C/C++ Source or Header  |  1992-03-10  |  401b  |  24 lines

  1. #include <pwd.h>
  2. #include <sys/types.h>
  3. #include <sys/stat.h>
  4.  
  5. main(argc,argv)
  6. int argc;
  7. char **argv;
  8. {
  9. struct passwd *pp;
  10.  
  11. if (argc != 2) {
  12.     printf("Usage: %s\n",argv[0]);
  13.     exit(1);
  14. }
  15.  
  16. /* print directory of user, else "Error"  -- need to print
  17.   something, or kuang won't parse dir correctly */
  18. if ((pp = getpwnam(argv[1])) != (struct passwd *)0)
  19.     printf("%s", pp->pw_dir);
  20. else
  21.     printf("Error");
  22.  
  23. }
  24.