xref: /original-bsd/usr.bin/learn/lcount/lcount.c (revision 963f8367)
1 /*-
2  * Copyright (c) 1983 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.proprietary.c%
6  */
7 
8 #ifndef lint
9 char copyright[] =
10 "@(#) Copyright (c) 1983 The Regents of the University of California.\n\
11  All rights reserved.\n";
12 #endif /* not lint */
13 
14 #ifndef lint
15 static char sccsid[] = "@(#)lcount.c	4.3 (Berkeley) 04/17/91";
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