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 97 times
- in /usr/ingres/source/support/destroydb.c line
155
- in /usr/ingres/source/support/purge.c line
185-189(3)
- in /usr/ingres/source/support/restore.c line
198-199(2),
207
- in /usr/ingres/source/support/subs.c line
122-123(2),
172
- in /usr/src/bin/chflags/chflags.c line
126-129(4)
- in /usr/src/bin/chgrp.c line
148-151(4)
- in /usr/src/bin/chmod.c line
118-121(4)
- in /usr/src/bin/cp.c line
197
- in /usr/src/bin/csh/sh.exec.c line
282
- 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
187,
199
- in /usr/src/bin/du.c line
135
- in /usr/src/bin/ls/ls.c line
279
- in /usr/src/bin/make/files.c line
296(2)
- in /usr/src/bin/ps.c line
312
- in /usr/src/bin/rcp.c line
530
- 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
520
- in /usr/src/bin/tcsh/glob.c line
514
- in /usr/src/bin/tcsh/sh.exec.c line
475
- in /usr/src/bin/tcsh/sh.file.c line
448
- in /usr/src/bin/tcsh/tc.os.c line
792(2)
- in /usr/src/bin/tcsh/tw.parse.c line
1140,
1473,
1493
- in /usr/src/bin/tp/tp2.c line
261
- 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/libexec/ftpd/ftpd.c line
1355
- in /usr/src/new/crash/crashsubs.c line
457
- in /usr/src/new/kermit5.188/ckufio.c line
2511,
2556
- in /usr/src/new/nntp/server/scandir.c line
39
- in /usr/src/ucb/ex/expreserve.c line
121
- in /usr/src/ucb/ex/exrecover.c line
242,
442
- in /usr/src/ucb/ftp/glob.c line
214
- in /usr/src/ucb/msgs/msgs.c line
236(2)
- in /usr/src/ucb/rdist/docmd.c line
423
- in /usr/src/ucb/rdist/expand.c line
275
- in /usr/src/ucb/rdist/server.c line
334,
1174,
1252
- in /usr/src/ucb/ruptime.c line
93
- in /usr/src/ucb/rwho.c line
74
- in /usr/src/ucb/sccs.c line
993
- in /usr/src/ucb/sendbug/bugfiler.c line
528
- in /usr/src/ucb/whereis.c line
278
- in /usr/src/usr.bin/find/find.c line
654(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
201
- in /usr/src/usr.bin/uucp/uusnap.c line
144,
211,
246
- in /usr/src/usr.sbin/catman/catman.c line
158
- in /usr/src/usr.sbin/chown/chown.c line
141-144(4)
- in /usr/src/usr.sbin/cron/database.c line
103
- in /usr/src/usr.sbin/dev_mkdb/dev_mkdb.c line
108
- in /usr/src/usr.sbin/lpr/cmds.c line
666
- in /usr/src/usr.sbin/lpr/common.c line
178
- in /usr/src/usr.sbin/lpr/recvjob.c line
90
- in /usr/src/usr.sbin/sendmail.MX/src/queue.c line
419
- in /usr/src/usr.sbin/sendmail/src/queue.c line
406
Defined variables
sccsid
defined in line
8;
never used