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

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

unix.superglobalmegacorp.com

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