Annotation of 42BSD/usr.lib/learn/C/getline.c, revision 1.1.1.1

1.1       root        1: #include <stdio.h>
                      2: 
                      3: getline(s, lim)        /* get line into s, return length */
                      4: char s[];
                      5: int lim;
                      6: {
                      7:        int c, i;
                      8: 
                      9:        i = 0;
                     10:        while (--lim > 0 && (c=getchar()) != EOF && c != '\n')
                     11:                s[i++] = c;
                     12:        if (c == '\n')
                     13:                s[i++] = c;
                     14:        s[i] = '\0';
                     15:        return(i);
                     16: }

unix.superglobalmegacorp.com

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