Skip to content

Commit 7cd6ae5

Browse files
committed
minor tweaks
1 parent ac885ab commit 7cd6ae5

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

chapter07/7-1.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,22 @@
1212
int main(int argc, char *argv[])
1313
{
1414
int c, function;
15-
char *p;
15+
char *pname; /* program name */
1616

1717
if (argc != 1)
1818
return -1;
1919

20-
p = (strrchr(*argv, '/')) + 1; /* parse program name */
20+
pname = (strrchr(*argv, '/')) + 1; /* parse program name */
2121

22-
if (strcmp("tolower", p) == 0)
22+
if (strcmp("tolower", pname) == 0)
2323
function = 0;
24-
else if (strcmp("toupper", p) == 0)
24+
else if (strcmp("toupper", pname) == 0)
2525
function = 1;
2626
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");
2829
return -1;
2930
}
30-
3131
while ((c = getchar()) != EOF)
3232
putchar((function) ? toupper(c) : tolower(c));
3333
return 0;

0 commit comments

Comments
 (0)