File tree 1 file changed +6
-6
lines changed
1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 12
12
int main (int argc , char * argv [])
13
13
{
14
14
int c , function ;
15
- char * p ;
15
+ char * pname ; /* program name */
16
16
17
17
if (argc != 1 )
18
18
return -1 ;
19
19
20
- p = (strrchr (* argv , '/' )) + 1 ; /* parse program name */
20
+ pname = (strrchr (* argv , '/' )) + 1 ; /* parse program name */
21
21
22
- if (strcmp ("tolower" , p ) == 0 )
22
+ if (strcmp ("tolower" , pname ) == 0 )
23
23
function = 0 ;
24
- else if (strcmp ("toupper" , p ) == 0 )
24
+ else if (strcmp ("toupper" , pname ) == 0 )
25
25
function = 1 ;
26
26
else {
27
- printf ("Unknown function:\nRename program to tolower or toupper.\n" );
27
+ printf ("%s: Unknown function: " , pname );
28
+ printf ("Rename program to tolower or toupper.\n" );
28
29
return -1 ;
29
30
}
30
-
31
31
while ((c = getchar ()) != EOF )
32
32
putchar ((function ) ? toupper (c ) : tolower (c ));
33
33
return 0 ;
You can’t perform that action at this time.
0 commit comments