148274Sbostic /*- 2*62077Sbostic * Copyright (c) 1988, 1993 3*62077Sbostic * The Regents of the University of California. All rights reserved. 448274Sbostic * 548274Sbostic * %sccs.include.proprietary.c% 648274Sbostic */ 748274Sbostic 834680Sjak #ifndef lint 9*62077Sbostic static char sccsid[] = "@(#)getline.c 8.1 (Berkeley) 06/06/93"; 1048274Sbostic #endif /* not lint */ 1134680Sjak 1234680Sjak #include <stdio.h> 1334680Sjak getline(s,lim)1434680Sjakgetline(s, lim) /* get line into s, return length */ 1534680Sjak char s[]; 1634680Sjak int lim; 1734680Sjak { 1834680Sjak int c, i; 1934680Sjak 2034680Sjak i = 0; 2134680Sjak while (--lim > 0 && (c=getchar()) != EOF && c != '\n') 2234680Sjak s[i++] = c; 2334680Sjak if (c == '\n') 2434680Sjak s[i++] = c; 2534680Sjak s[i] = '\0'; 2634680Sjak return(i); 2734680Sjak } 28