logname.c (336B)
1 /* See LICENSE file for copyright and license details. */ 2 #include <stdio.h> 3 #include <unistd.h> 4 5 #include "util.h" 6 7 int 8 main(int argc, char *argv[]) 9 { 10 char *login; 11 12 argv0 = argv[0]; 13 if (argc != 1) 14 eprintf("usage: %s\n", argv0); 15 if ((login = getlogin())) 16 puts(login); 17 else 18 eprintf("%s: no login name\n", argv0); 19 return 0; 20 }