stamp for 4bsd
[unix-history] / usr / src / sys / stand.att / ls.c
CommitLineData
a7a8eebc 1/* ls.c 4.1 %G% */
a34cad54
BJ
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
9char line[100];
10
11main()
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
24ls(io)
25register 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}