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

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1982, 1986 Regents of the University of California.
        !             3:  * All rights reserved.  The Berkeley software License Agreement
        !             4:  * specifies the terms and conditions for redistribution.
        !             5:  *
        !             6:  *     @(#)ls.c        7.1 (Berkeley) 6/5/86
        !             7:  */
        !             8: 
        !             9: #include "../h/param.h"
        !            10: #include "../h/inode.h"
        !            11: #include "../h/ino.h"
        !            12: #include "../h/dir.h"
        !            13: #include "saio.h"
        !            14: 
        !            15: char line[100];
        !            16: 
        !            17: main()
        !            18: {
        !            19:        int i;
        !            20: 
        !            21:        printf("ls\n");
        !            22:        do  {
        !            23:                printf(": "); gets(line);
        !            24:                i = open(line, 0);
        !            25:        } while (i < 0);
        !            26: 
        !            27:        ls(i);
        !            28: }
        !            29: 
        !            30: ls(io)
        !            31: register io;
        !            32: {
        !            33:        struct direct d;
        !            34:        register i;
        !            35: 
        !            36:        while (read(io, (char *)&d, sizeof d) == sizeof d) {
        !            37:                if (d.d_ino == 0)
        !            38:                        continue;
        !            39:                printf("%d\t", d.d_ino);
        !            40:                for (i=0; i<DIRSIZ; i++) {
        !            41:                        if (d.d_name[i] == 0)
        !            42:                                break;
        !            43:                        printf("%c", d.d_name[i]);
        !            44:                }
        !            45:                printf("\n");
        !            46:        }
        !            47: }

unix.superglobalmegacorp.com

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