Annotation of researchv8dc/cmd/inet/etc/whoami.c, revision 1.1.1.1

1.1       root        1: char *
                      2: whoami()
                      3: {
                      4:        static char name[128];
                      5:        int fd, n;
                      6:        char *cp;
                      7: 
                      8:        fd = open("/etc/whoami", 0);
                      9:        if (fd < 0)
                     10:                return ("Kremvax");
                     11:        n = read(fd, name, sizeof(name)-1);
                     12:        if (n <= 0)
                     13:                return ("Kremvax");
                     14:        name[n] = '\0';
                     15:        for (cp=name; *cp; cp++)
                     16:                if (*cp == '\n') {
                     17:                        *cp = '\0';
                     18:                        break;
                     19:                }
                     20:        return name;
                     21: }
                     22: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.