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: }