1: /*
2: * Copyright (c) 1983 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:
7: #if defined(LIBC_SCCS) && !defined(lint)
8: static char sccsid[] = "@(#)readdir.c 5.2 (Berkeley) 3/9/86";
9: #endif LIBC_SCCS and not lint
10:
11: #include <sys/param.h>
12: #include <sys/dir.h>
13:
14: /*
15: * get next entry in a directory.
16: */
17: struct direct *
18: readdir(dirp)
19: register DIR *dirp;
20: {
21: register struct direct *dp;
22:
23: for (;;) {
24: if (dirp->dd_loc == 0) {
25: dirp->dd_size = read(dirp->dd_fd, dirp->dd_buf,
26: DIRBLKSIZ);
27: if (dirp->dd_size <= 0)
28: return NULL;
29: }
30: if (dirp->dd_loc >= dirp->dd_size) {
31: dirp->dd_loc = 0;
32: continue;
33: }
34: dp = (struct direct *)(dirp->dd_buf + dirp->dd_loc);
35: if (dp->d_reclen <= 0 ||
36: dp->d_reclen > DIRBLKSIZ + 1 - dirp->dd_loc)
37: return NULL;
38: dirp->dd_loc += dp->d_reclen;
39: if (dp->d_ino == 0)
40: continue;
41: return (dp);
42: }
43: }
Defined functions
readdir
defined in line
17; used 100 times
- in /usr/src/bin/chgrp.c line
142-145(4)
- in /usr/src/bin/chmod.c line
108-111(4)
- in /usr/src/bin/cp.c line
197
- in /usr/src/bin/csh/sh.exec.c line
305
- in /usr/src/bin/csh/sh.file.c line
326
- in /usr/src/bin/csh/sh.glob.c line
196
- in /usr/src/bin/diff/diffdir.c line
189
- in /usr/src/bin/du.c line
135
- in /usr/src/bin/ls.c line
254
- in /usr/src/bin/make/files.c line
283(2)
- in /usr/src/bin/ps.c line
754
- in /usr/src/bin/rcp.c line
416
- in /usr/src/bin/rm.c line
131,
152,
158
- in /usr/src/bin/sh/expand.c line
85
- in /usr/src/bin/tar.c line
514
- in /usr/src/bin/tp/tp2.c line
261
- in /usr/src/games/compat/unixtraps.c line
767,
777
- in /usr/src/lib/libc/gen/getwd.c line
72,
80
- in /usr/src/lib/libc/gen/scandir.c line
49
- in /usr/src/lib/libc/gen/seekdir.c line
35
- in /usr/src/lib/libc/gen/ttyname.c line
37
- in /usr/src/new/dsh/src/getwd.c line
40,
47
- in /usr/src/new/help/help.c line
800(2)
- in /usr/src/new/kermit/ckufio.c line
793
- in /usr/src/new/mh/sbr/m_gmsg.c line
76
- in /usr/src/new/mh/sbr/pwd.c line
86,
103
- in /usr/src/new/mh/uip/bbl.c line
298
- in /usr/src/new/mh/uip/conflict.c line
306
- in /usr/src/new/mh/uip/folder.c line
516
- in /usr/src/new/mh/uip/rmf.c line
168
- in /usr/src/new/mkmf/src/buildlist.c line
218,
225(2)
- in /usr/src/new/nntp/server/scandir.c line
40
- in /usr/src/new/spms/src/bin/pfind/Pfind.c line
125,
132(2)
- in /usr/src/new/spms/src/bin/phelp/index.c line
38,
49(2)
- in /usr/src/new/spms/src/lib/libspms/src/getwd.c line
62,
71
- in /usr/src/new/xns/examples/filing/glob.c line
206
- in /usr/src/old/berknet/net.c line
488-493(2)
- in /usr/src/old/berknet/netdaemon.c line
168
- in /usr/src/old/berknet/netq.c line
91,
330
- in /usr/src/old/berknet/netrm.c line
69
- in /usr/src/old/vpr/vpd.c line
153
- in /usr/src/old/vpr/vpq.c line
94
- in /usr/src/old/vpr/vprm.c line
61
- in /usr/src/ucb/ex/expreserve.c line
123
- in /usr/src/ucb/ex/exrecover.c line
244,
444
- in /usr/src/ucb/ftp/glob.c line
200
- in /usr/src/ucb/lastcomm.c line
222
- in /usr/src/ucb/msgs/msgs.c line
236(2)
- in /usr/src/ucb/rdist/docmd.c line
424
- in /usr/src/ucb/rdist/expand.c line
275
- in /usr/src/ucb/rdist/server.c line
326,
1156,
1234
- in /usr/src/ucb/ruptime.c line
94
- in /usr/src/ucb/rwho.c line
74
- in /usr/src/ucb/sccs.c line
994
- in /usr/src/ucb/sendbug/bugfiler.c line
530
- in /usr/src/ucb/whereis.c line
281
- in /usr/src/usr.bin/find/find.c line
658(2)
- in /usr/src/usr.bin/learn/selsub.c line
155(2)
- in /usr/src/usr.bin/learn/start.c line
23(2)
- in /usr/src/usr.bin/uucp/gnamef.c line
29
- in /usr/src/usr.bin/uucp/uuq.c line
203
- in /usr/src/usr.bin/uucp/uusnap.c line
144,
211,
246
- in /usr/src/usr.bin/xsend/xget.c line
124
- in /usr/src/usr.bin/xsend/xsend.c line
57
- in /usr/src/usr.lib/lpr/cmds.c line
666
- in /usr/src/usr.lib/lpr/common.c line
178
- in /usr/src/usr.lib/lpr/recvjob.c line
89
- in /usr/src/usr.lib/sendmail/src/queue.c line
411
Defined variables
sccsid
defined in line
8;
never used