Change 'printf("%s\n", ...)' into 'puts(...)'. Noted and patched in hostname.c

by Larry Doolittle.
This commit is contained in:
Matt Kraai 2001-05-16 14:21:09 +00:00
parent bc604a2f41
commit 59df6f7398
22 changed files with 36 additions and 36 deletions

2
ar.c
View File

@ -119,7 +119,7 @@ extern int ar_main(int argc, char **argv)
(int) ar_extract_list->size, time_string(ar_extract_list->mtime)); (int) ar_extract_list->size, time_string(ar_extract_list->mtime));
} }
if ((funct & display) || (funct & verbose)){ if ((funct & display) || (funct & verbose)){
printf("%s\n", ar_extract_list->name); puts(ar_extract_list->name);
} }
ar_extract_list = ar_extract_list->next; ar_extract_list = ar_extract_list->next;
} }

View File

@ -119,7 +119,7 @@ extern int ar_main(int argc, char **argv)
(int) ar_extract_list->size, time_string(ar_extract_list->mtime)); (int) ar_extract_list->size, time_string(ar_extract_list->mtime));
} }
if ((funct & display) || (funct & verbose)){ if ((funct & display) || (funct & verbose)){
printf("%s\n", ar_extract_list->name); puts(ar_extract_list->name);
} }
ar_extract_list = ar_extract_list->next; ar_extract_list = ar_extract_list->next;
} }

View File

@ -99,7 +99,7 @@ extern int dpkg_deb_main(int argc, char **argv)
field_length = strlen(field); field_length = strlen(field);
field_start += (field_length + 1); field_start += (field_length + 1);
if (strstr(field, argument) == field) { if (strstr(field, argument) == field) {
printf("%s\n", field + strlen(argument) + 2); puts(field + strlen(argument) + 2);
} }
free(field); free(field);
} }

View File

@ -47,6 +47,6 @@ extern int basename_main(int argc, char **argv)
if (m>=n && strncmp(s+m-n, *argv, n)==0) if (m>=n && strncmp(s+m-n, *argv, n)==0)
s[m-n] = '\0'; s[m-n] = '\0';
} }
printf("%s\n", s); puts(s);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

View File

@ -47,6 +47,6 @@ extern int basename_main(int argc, char **argv)
if (m>=n && strncmp(s+m-n, *argv, n)==0) if (m>=n && strncmp(s+m-n, *argv, n)==0)
s[m-n] = '\0'; s[m-n] = '\0';
} }
printf("%s\n", s); puts(s);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

View File

@ -241,7 +241,7 @@ int date_main(int argc, char **argv)
/* Print OUTPUT (after ALL that!) */ /* Print OUTPUT (after ALL that!) */
t_buff = xmalloc(201); t_buff = xmalloc(201);
strftime(t_buff, 200, date_fmt, &tm_time); strftime(t_buff, 200, date_fmt, &tm_time);
printf("%s\n", t_buff); puts(t_buff);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

View File

@ -66,7 +66,7 @@ extern int env_main(int argc, char** argv)
perror_msg_and_die("%s", *argv); perror_msg_and_die("%s", *argv);
} }
for (ep = environ; *ep; ep++) for (ep = environ; *ep; ep++)
printf("%s\n", *ep); puts(*ep);
return 0; return 0;
} }

View File

@ -90,7 +90,7 @@ int expr_main (int argc, char **argv)
if (v->type == integer) if (v->type == integer)
printf ("%d\n", v->u.i); printf ("%d\n", v->u.i);
else else
printf ("%s\n", v->u.s); puts (v->u.s);
exit (null (v)); exit (null (v));
} }

View File

@ -79,12 +79,12 @@ extern int id_main(int argc, char **argv)
if (no_group) { if (no_group) {
if(name_not_number && user) if(name_not_number && user)
printf("%s\n",user); puts(user);
else else
printf("%ld\n", pwnam); printf("%ld\n", pwnam);
} else if (no_user) { } else if (no_user) {
if(name_not_number && group) if(name_not_number && group)
printf("%s\n", group); puts(group);
else else
printf("%ld\n", grnam); printf("%ld\n", grnam);
} else { } else {

2
date.c
View File

@ -241,7 +241,7 @@ int date_main(int argc, char **argv)
/* Print OUTPUT (after ALL that!) */ /* Print OUTPUT (after ALL that!) */
t_buff = xmalloc(201); t_buff = xmalloc(201);
strftime(t_buff, 200, date_fmt, &tm_time); strftime(t_buff, 200, date_fmt, &tm_time);
printf("%s\n", t_buff); puts(t_buff);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

View File

@ -99,7 +99,7 @@ extern int dpkg_deb_main(int argc, char **argv)
field_length = strlen(field); field_length = strlen(field);
field_start += (field_length + 1); field_start += (field_length + 1);
if (strstr(field, argument) == field) { if (strstr(field, argument) == field) {
printf("%s\n", field + strlen(argument) + 2); puts(field + strlen(argument) + 2);
} }
free(field); free(field);
} }

2
env.c
View File

@ -66,7 +66,7 @@ extern int env_main(int argc, char** argv)
perror_msg_and_die("%s", *argv); perror_msg_and_die("%s", *argv);
} }
for (ep = environ; *ep; ep++) for (ep = environ; *ep; ep++)
printf("%s\n", *ep); puts(*ep);
return 0; return 0;
} }

2
expr.c
View File

@ -90,7 +90,7 @@ int expr_main (int argc, char **argv)
if (v->type == integer) if (v->type == integer)
printf ("%d\n", v->u.i); printf ("%d\n", v->u.i);
else else
printf ("%s\n", v->u.s); puts (v->u.s);
exit (null (v)); exit (null (v));
} }

View File

@ -170,7 +170,7 @@ static void grep_file(FILE *file)
} }
/* just grep -l: print just the filename, but only if we grepped the line in the file */ /* just grep -l: print just the filename, but only if we grepped the line in the file */
else if (print_files_with_matches && !print_match_counts && nmatches > 0) { else if (print_files_with_matches && !print_match_counts && nmatches > 0) {
printf("%s\n", cur_file); puts(cur_file);
} }

View File

@ -58,7 +58,7 @@ extern int which_main(int argc, char **argv)
if (stat (buf, &filestat) == 0 if (stat (buf, &filestat) == 0
&& filestat.st_mode & S_IXUSR) && filestat.st_mode & S_IXUSR)
{ {
printf ("%s\n", buf); puts(buf);
found = 1; found = 1;
break; break;
} }

2
grep.c
View File

@ -170,7 +170,7 @@ static void grep_file(FILE *file)
} }
/* just grep -l: print just the filename, but only if we grepped the line in the file */ /* just grep -l: print just the filename, but only if we grepped the line in the file */
else if (print_files_with_matches && !print_match_counts && nmatches > 0) { else if (print_files_with_matches && !print_match_counts && nmatches > 0) {
printf("%s\n", cur_file); puts(cur_file);
} }

View File

@ -1,6 +1,6 @@
/* vi: set sw=4 ts=4: */ /* vi: set sw=4 ts=4: */
/* /*
* $Id: hostname.c,v 1.26 2001/03/09 21:24:12 andersen Exp $ * $Id: hostname.c,v 1.27 2001/05/16 14:21:09 kraai Exp $
* Mini hostname implementation for busybox * Mini hostname implementation for busybox
* *
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org> * Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@ -112,19 +112,19 @@ int hostname_main(int argc, char **argv)
if (!s) if (!s)
s = buf; s = buf;
*s = 0; *s = 0;
printf("%s\n", buf); puts(buf);
} else if (opt_domain) { } else if (opt_domain) {
s = strchr(buf, '.'); s = strchr(buf, '.');
printf("%s\n", (s ? s + 1 : "")); puts(s ? s + 1 : "");
} else if (opt_ip) { } else if (opt_ip) {
h = gethostbyname(buf); h = gethostbyname(buf);
if (!h) { if (!h) {
printf("Host not found\n"); printf("Host not found\n");
exit(1); exit(1);
} }
printf("%s\n", inet_ntoa(*(struct in_addr *) (h->h_addr))); puts(inet_ntoa(*(struct in_addr *) (h->h_addr)));
} else { } else {
printf("%s\n", buf); puts(buf);
} }
} }
return(0); return(0);

4
id.c
View File

@ -79,12 +79,12 @@ extern int id_main(int argc, char **argv)
if (no_group) { if (no_group) {
if(name_not_number && user) if(name_not_number && user)
printf("%s\n",user); puts(user);
else else
printf("%ld\n", pwnam); printf("%ld\n", pwnam);
} else if (no_user) { } else if (no_user) {
if(name_not_number && group) if(name_not_number && group)
printf("%s\n", group); puts(group);
else else
printf("%ld\n", grnam); printf("%ld\n", grnam);
} else { } else {

4
lash.c
View File

@ -416,7 +416,7 @@ static int builtin_pwd(struct child_prog *dummy)
cwd = xgetcwd((char *)cwd); cwd = xgetcwd((char *)cwd);
if (!cwd) if (!cwd)
cwd = unknown; cwd = unknown;
printf( "%s\n", cwd); puts(cwd);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
@ -429,7 +429,7 @@ static int builtin_export(struct child_prog *child)
if (v == NULL) { if (v == NULL) {
char **e; char **e;
for (e = environ; *e; e++) { for (e = environ; *e; e++) {
printf( "%s\n", *e); puts(*e);
} }
return 0; return 0;
} }

View File

@ -1,6 +1,6 @@
/* vi: set sw=4 ts=4: */ /* vi: set sw=4 ts=4: */
/* /*
* $Id: hostname.c,v 1.26 2001/03/09 21:24:12 andersen Exp $ * $Id: hostname.c,v 1.27 2001/05/16 14:21:09 kraai Exp $
* Mini hostname implementation for busybox * Mini hostname implementation for busybox
* *
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org> * Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@ -112,19 +112,19 @@ int hostname_main(int argc, char **argv)
if (!s) if (!s)
s = buf; s = buf;
*s = 0; *s = 0;
printf("%s\n", buf); puts(buf);
} else if (opt_domain) { } else if (opt_domain) {
s = strchr(buf, '.'); s = strchr(buf, '.');
printf("%s\n", (s ? s + 1 : "")); puts(s ? s + 1 : "");
} else if (opt_ip) { } else if (opt_ip) {
h = gethostbyname(buf); h = gethostbyname(buf);
if (!h) { if (!h) {
printf("Host not found\n"); printf("Host not found\n");
exit(1); exit(1);
} }
printf("%s\n", inet_ntoa(*(struct in_addr *) (h->h_addr))); puts(inet_ntoa(*(struct in_addr *) (h->h_addr)));
} else { } else {
printf("%s\n", buf); puts(buf);
} }
} }
return(0); return(0);

View File

@ -416,7 +416,7 @@ static int builtin_pwd(struct child_prog *dummy)
cwd = xgetcwd((char *)cwd); cwd = xgetcwd((char *)cwd);
if (!cwd) if (!cwd)
cwd = unknown; cwd = unknown;
printf( "%s\n", cwd); puts(cwd);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
@ -429,7 +429,7 @@ static int builtin_export(struct child_prog *child)
if (v == NULL) { if (v == NULL) {
char **e; char **e;
for (e = environ; *e; e++) { for (e = environ; *e; e++) {
printf( "%s\n", *e); puts(*e);
} }
return 0; return 0;
} }

View File

@ -58,7 +58,7 @@ extern int which_main(int argc, char **argv)
if (stat (buf, &filestat) == 0 if (stat (buf, &filestat) == 0
&& filestat.st_mode & S_IXUSR) && filestat.st_mode & S_IXUSR)
{ {
printf ("%s\n", buf); puts(buf);
found = 1; found = 1;
break; break;
} }