xref: /csrg-svn/usr.bin/learn/lcount/lcount.c (revision 62053)
148270Sbostic /*-
2*62053Sbostic  * Copyright (c) 1983, 1993
3*62053Sbostic  *	The Regents of the University of California.  All rights reserved.
448270Sbostic  *
548270Sbostic  * %sccs.include.proprietary.c%
648270Sbostic  */
748270Sbostic 
811254Smckusick #ifndef lint
9*62053Sbostic static char copyright[] =
10*62053Sbostic "@(#) Copyright (c) 1983, 1993\n\
11*62053Sbostic 	The Regents of the University of California.  All rights reserved.\n";
1248270Sbostic #endif /* not lint */
1311254Smckusick 
1448270Sbostic #ifndef lint
15*62053Sbostic static char sccsid[] = "@(#)lcount.c	8.1 (Berkeley) 06/06/93";
1648270Sbostic #endif /* not lint */
1748270Sbostic 
1811254Smckusick #include "stdio.h"
1911254Smckusick 
main()2011254Smckusick main()	/* count lines in something */
2111254Smckusick {
2211254Smckusick 	register n, c;
2311254Smckusick 
2411254Smckusick 	n = 0;
2511254Smckusick 	while ((c = getchar()) != EOF)
2611254Smckusick 		if (c == '\n')
2711254Smckusick 			n++;
2811254Smckusick 	printf("%d\n", n);
2911254Smckusick }
30