123231Smckusick /* 229303Smckusick * Copyright (c) 1982, 1986 Regents of the University of California. 323231Smckusick * All rights reserved. The Berkeley software License Agreement 423231Smckusick * specifies the terms and conditions for redistribution. 523231Smckusick * 6*33408Skarels * @(#)ls.c 7.2 (Berkeley) 01/28/88 723231Smckusick */ 8320Sbill 9*33408Skarels #include "param.h" 10*33408Skarels #include "inode.h" 11*33408Skarels #include "ino.h" 12*33408Skarels #include "dir.h" 13320Sbill #include "saio.h" 14320Sbill 15320Sbill char line[100]; 16320Sbill 17320Sbill main() 18320Sbill { 19320Sbill int i; 20320Sbill 21320Sbill printf("ls\n"); 22320Sbill do { 23320Sbill printf(": "); gets(line); 24320Sbill i = open(line, 0); 25320Sbill } while (i < 0); 26320Sbill 27320Sbill ls(i); 28320Sbill } 29320Sbill 30320Sbill ls(io) 31320Sbill register io; 32320Sbill { 33320Sbill struct direct d; 34320Sbill register i; 35320Sbill 36320Sbill while (read(io, (char *)&d, sizeof d) == sizeof d) { 37320Sbill if (d.d_ino == 0) 38320Sbill continue; 39320Sbill printf("%d\t", d.d_ino); 40320Sbill for (i=0; i<DIRSIZ; i++) { 41320Sbill if (d.d_name[i] == 0) 42320Sbill break; 43320Sbill printf("%c", d.d_name[i]); 44320Sbill } 45320Sbill printf("\n"); 46320Sbill } 47320Sbill } 48