Annotation of 42BSD/usr.bin/uucp/gnamef.c, revision 1.1

1.1     ! root        1: #ifndef lint
        !             2: static char sccsid[] = "@(#)gnamef.c   5.2 (Berkeley) 7/2/83";
        !             3: #endif
        !             4: 
        !             5: #include "uucp.h"
        !             6: #include <sys/types.h>
        !             7: #ifdef NDIR
        !             8: #include "ndir.h"
        !             9: #else
        !            10: #include <sys/dir.h>
        !            11: #endif
        !            12: 
        !            13: /*******
        !            14:  *     gnamef(dirp, filename)  get next file name from directory
        !            15:  *     DIR *dirp;
        !            16:  *     char *filename;
        !            17:  *
        !            18:  *     return codes:
        !            19:  *             0  -  end of directory read
        !            20:  *             1  -  returned name
        !            21:  */
        !            22: 
        !            23: gnamef(dirp, filename)
        !            24: register DIR *dirp;
        !            25: register char *filename;
        !            26: {
        !            27:        register struct direct *dentp;
        !            28: 
        !            29:        while (1) {
        !            30:                if ((dentp = readdir(dirp)) == NULL)
        !            31:                        return(0);
        !            32:                if (dentp->d_ino != 0)
        !            33:                        break;
        !            34:        }
        !            35: 
        !            36:        /* Truncate filename.  This may become a problem someday. rti!trt */
        !            37:        strncpy(filename, dentp->d_name, NAMESIZE-1);
        !            38:        filename[NAMESIZE-1] = '\0';
        !            39:        return(1);
        !            40: }

unix.superglobalmegacorp.com

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