xref: /original-bsd/usr.bin/learn/lcount/lcount.c (revision c3e32dec)
1 /*-
2  * Copyright (c) 1983, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * %sccs.include.proprietary.c%
6  */
7 
8 #ifndef lint
9 static char copyright[] =
10 "@(#) Copyright (c) 1983, 1993\n\
11 	The Regents of the University of California.  All rights reserved.\n";
12 #endif /* not lint */
13 
14 #ifndef lint
15 static char sccsid[] = "@(#)lcount.c	8.1 (Berkeley) 06/06/93";
16 #endif /* not lint */
17 
18 #include "stdio.h"
19 
20 main()	/* count lines in something */
21 {
22 	register n, c;
23 
24 	n = 0;
25 	while ((c = getchar()) != EOF)
26 		if (c == '\n')
27 			n++;
28 	printf("%d\n", n);
29 }
30