Annotation of 3BSD/cmd/uucp/gnamef.c, revision 1.1

1.1     ! root        1: #include "uucp.h"
        !             2: #include <sys/types.h>
        !             3: #include <sys/dir.h>
        !             4: 
        !             5: 
        !             6: /*******
        !             7:  *     gnamef(p, filename)     get next file name from directory
        !             8:  *     FILE *p;
        !             9:  *     char *filename;
        !            10:  *
        !            11:  *     return codes:
        !            12:  *             0  -  end of directory read
        !            13:  *             1  -  returned name
        !            14:  */
        !            15: 
        !            16: 
        !            17: gnamef(p, filename)
        !            18: FILE *p;
        !            19: char *filename;
        !            20: {
        !            21:        static struct direct dentry;
        !            22:        int i;
        !            23:        char *s;
        !            24: 
        !            25:        while (1) {
        !            26:                if (fread(&dentry,  sizeof(dentry), 1, p) != 1)
        !            27:                        return(0);
        !            28:                if (dentry.d_ino != 0)
        !            29:                        break;
        !            30:        }
        !            31: 
        !            32:        for (i = 0, s = dentry.d_name; i < DIRSIZ; i++)
        !            33:                if ((filename[i] = *s++) == '\0')
        !            34:                        break;
        !            35:        filename[DIRSIZ] = '\0';
        !            36:        return(1);
        !            37: }
        !            38: 

unix.superglobalmegacorp.com

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