mirror of
https://github.com/GnoConsortium/gno.git
synced 2024-11-18 19:09:31 +00:00
29 lines
527 B
C
29 lines
527 B
C
/*
|
|
* Tests getlogin(2) and setlogin(2).
|
|
* Devin Reade, 1997.
|
|
*
|
|
* $Id: getlogin.c,v 1.1 1997/09/21 16:32:15 gdr Exp $
|
|
*/
|
|
|
|
#include <unistd.h>
|
|
#include <stdio.h>
|
|
|
|
int
|
|
main (int argc, char **argv) {
|
|
char *p;
|
|
|
|
p = getlogin();
|
|
printf("first getlogin() returns \"%s\"\n", (p == NULL)? "(null)" : p);
|
|
|
|
if (setlogin("bork") < 0) {
|
|
perror("setlogin failed");
|
|
} else {
|
|
printf("setlogin passed\n");
|
|
}
|
|
|
|
p = getlogin();
|
|
printf("second getlogin() returns \"%s\"\n", (p == NULL)? "(null)" : p);
|
|
|
|
return 0;
|
|
}
|