Annotation of 43BSDReno/include/dirent.h, revision 1.1.1.1

1.1       root        1: /*-
                      2:  * Copyright (c) 1989 The Regents of the University of California.
                      3:  * All rights reserved.
                      4:  *
                      5:  * Redistribution and use in source and binary forms are permitted provided
                      6:  * that: (1) source distributions retain this entire copyright notice and
                      7:  * comment, and (2) distributions including binaries display the following
                      8:  * acknowledgement:  ``This product includes software developed by the
                      9:  * University of California, Berkeley and its contributors'' in the
                     10:  * documentation or other materials provided with the distribution and in
                     11:  * all advertising materials mentioning features or use of this software.
                     12:  * Neither the name of the University nor the names of its contributors may
                     13:  * be used to endorse or promote products derived from this software without
                     14:  * specific prior written permission.
                     15:  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
                     16:  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
                     17:  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
                     18:  *
                     19:  *     @(#)dirent.h    5.13 (Berkeley) 6/24/90
                     20:  */
                     21: 
                     22: #ifndef _DIRENT_
                     23: #define _DIRENT_
                     24: 
                     25: /*
                     26:  * A directory entry has a struct direct at the front of it, containing its
                     27:  * inode number, the length of the entry, and the length of the name
                     28:  * contained in the entry.  These are followed by the name padded to a 4
                     29:  * byte boundary with null bytes.  All names are guaranteed null terminated.
                     30:  * The maximum length of a name in a directory is MAXNAMLEN.
                     31:  */
                     32: 
                     33: struct dirent {
                     34:        u_long  d_fileno;               /* file number of entry */
                     35:        u_short d_reclen;               /* length of this record */
                     36:        u_short d_namlen;               /* length of string in d_name */
                     37: #ifdef _POSIX_SOURCE
                     38:        char    d_name[255 + 1];        /* name must be no longer than this */
                     39: #else
                     40: #define        MAXNAMLEN       255
                     41:        char    d_name[MAXNAMLEN + 1];  /* name must be no longer than this */
                     42: #endif
                     43: };
                     44: 
                     45: #ifdef _POSIX_SOURCE
                     46: typedef void * DIR;
                     47: #else
                     48: 
                     49: #define        d_ino           d_fileno        /* backward compatibility */
                     50: 
                     51: /* definitions for library routines operating on directories. */
                     52: #define        DIRBLKSIZ       1024
                     53: 
                     54: /* structure describing an open directory. */
                     55: typedef struct _dirdesc {
                     56:        int     dd_fd;          /* file descriptor associated with directory */
                     57:        long    dd_loc;         /* offset in current buffer */
                     58:        long    dd_size;        /* amount of data returned by getdirentries */
                     59:        char    *dd_buf;        /* data buffer */
                     60:        int     dd_len;         /* size of data buffer */
                     61:        long    dd_seek;        /* magic cookie returned by getdirentries */
                     62: } DIR;
                     63: 
                     64: #define        dirfd(dirp)     ((dirp)->dd_fd)
                     65: 
                     66: #ifndef NULL
                     67: #define        NULL    0
                     68: #endif
                     69: 
                     70: #endif /* _POSIX_SOURCE */
                     71: 
                     72: #if __STDC__ || c_plusplus
                     73: extern DIR *opendir(const char *);
                     74: extern struct dirent *readdir(DIR *);
                     75: extern void rewinddir(DIR *);
                     76: extern int closedir(DIR *);
                     77: #ifndef _POSIX_SOURCE
                     78: extern long telldir(const DIR *);
                     79: extern void seekdir(DIR *, long);
                     80: extern int scandir(const char *, struct direct ***,
                     81:     int (* )(struct direct *), int (* )(void *, void *));
                     82: extern int alphasort(const void *, const void *);
                     83: #endif
                     84: #else
                     85: extern DIR *opendir();
                     86: extern struct dirent *readdir();
                     87: extern void rewinddir();
                     88: extern int closedir();
                     89: #ifndef _POSIX_SOURCE
                     90: extern long telldir();
                     91: extern void seekdir();
                     92: extern int scandir();
                     93: extern int alphasort();
                     94: #endif
                     95: #endif
                     96: #endif /* _DIRENT_ */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.