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: }

Defined functions

ls defined in line 30; used 1 times
  • in line 27
main defined in line 17; used 2 times

Defined variables

line defined in line 15; used 2 times
Last modified: 1986-06-05
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 799
Valid CSS Valid XHTML 1.0 Strict