1 /*****************************************************************************
2 Major portions of this software are copyrighted by the Medical College
3 of Wisconsin, 1994-2000, and are released under the Gnu General Public
4 License, Version 2. See the file README.Copyright for details.
5 ******************************************************************************/
6
7 #include "mrilib.h"
8 #include "thd.h"
9
10 /*---------------------------------------------------------------------------*/
11
THD_linecount(char * str)12 int THD_linecount( char * str )
13 {
14 int nlin ;
15 char * cpt ;
16
17 if( str == NULL || str[0] == '\0' ) return 0 ;
18
19 nlin = 0 ;
20 for( cpt=str ; *cpt != '\0' ; cpt++ )
21 if( *cpt == '\n' ) nlin++ ;
22
23 if( *(cpt-1) != '\n' ) nlin++ ;
24
25 return nlin ;
26 }
27