Commit | Line | Data |
---|---|---|
73bc81fc | 1 | /* |
0880b18e | 2 | * Copyright (c) 1982, 1986 Regents of the University of California. |
73bc81fc KM |
3 | * All rights reserved. The Berkeley software License Agreement |
4 | * specifies the terms and conditions for redistribution. | |
5 | * | |
0880b18e | 6 | * @(#)ls.c 7.1 (Berkeley) %G% |
73bc81fc | 7 | */ |
a34cad54 BJ |
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 | } |