Annotation of 43BSDTahoe/usr.bin/learn/getline.c, revision 1.1.1.1

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

unix.superglobalmegacorp.com

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