Annotation of 40BSD/sys/stand/ls.c, revision 1.1

1.1     ! root        1: /*     ls.c    4.1     11/9/80 */
        !             2: 
        !             3: #include "../h/param.h"
        !             4: #include "../h/inode.h"
        !             5: #include "../h/ino.h"
        !             6: #include "../h/dir.h"
        !             7: #include "saio.h"
        !             8: 
        !             9: char line[100];
        !            10: 
        !            11: main()
        !            12: {
        !            13:        int i;
        !            14: 
        !            15:        printf("ls\n");
        !            16:        do  {
        !            17:                printf(": "); gets(line);
        !            18:                i = open(line, 0);
        !            19:        } while (i < 0);
        !            20: 
        !            21:        ls(i);
        !            22: }
        !            23: 
        !            24: ls(io)
        !            25: register io;
        !            26: {
        !            27:        struct direct d;
        !            28:        register i;
        !            29: 
        !            30:        while (read(io, (char *)&d, sizeof d) == sizeof d) {
        !            31:                if (d.d_ino == 0)
        !            32:                        continue;
        !            33:                printf("%d\t", d.d_ino);
        !            34:                for (i=0; i<DIRSIZ; i++) {
        !            35:                        if (d.d_name[i] == 0)
        !            36:                                break;
        !            37:                        printf("%c", d.d_name[i]);
        !            38:                }
        !            39:                printf("\n");
        !            40:        }
        !            41: }

unix.superglobalmegacorp.com

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