aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2000-12-20 22:59:16 +0000
committerEric Andersen <andersen@codepoet.org>2000-12-20 22:59:16 +0000
commit70da6a66d2d4be1b93b80616a496985ec347447d (patch)
treec9932f9c89de1452ae47241fbf2823b7a5165b1b
parent3680c58084410768b562cb1982a4189d33880031 (diff)
downloadbusybox-w32-70da6a66d2d4be1b93b80616a496985ec347447d.tar.gz
busybox-w32-70da6a66d2d4be1b93b80616a496985ec347447d.tar.bz2
busybox-w32-70da6a66d2d4be1b93b80616a496985ec347447d.zip
Fix a warning in sh.c. Remove use of getline() in md5sum since
nobody else uses it and it is a GNU extension anyways...
-rw-r--r--coreutils/md5sum.c15
-rw-r--r--lash.c5
-rw-r--r--md5sum.c15
-rw-r--r--sh.c5
-rw-r--r--shell/lash.c5
5 files changed, 18 insertions, 27 deletions
diff --git a/coreutils/md5sum.c b/coreutils/md5sum.c
index ecc1458a2..2c08b29c5 100644
--- a/coreutils/md5sum.c
+++ b/coreutils/md5sum.c
@@ -26,13 +26,6 @@
26#include <ctype.h> 26#include <ctype.h>
27#include <getopt.h> 27#include <getopt.h>
28 28
29/* It turns out that libc5 doesn't have this in its headers
30 * even though it is actually in the lib. Force it to work */
31#if ! defined __GLIBC__ && ! defined __UCLIBC__
32#define getline __getline
33extern _IO_ssize_t getline __P ((char **, size_t *, FILE *));
34#endif
35
36//---------------------------------------------------------------------------- 29//----------------------------------------------------------------------------
37//--------md5.c 30//--------md5.c
38//---------------------------------------------------------------------------- 31//----------------------------------------------------------------------------
@@ -680,8 +673,7 @@ static int md5_check(const char *checkfile_name)
680 int n_open_or_read_failures = 0; 673 int n_open_or_read_failures = 0;
681 unsigned char md5buffer[16]; 674 unsigned char md5buffer[16];
682 size_t line_number; 675 size_t line_number;
683 char *line; 676 char line[BUFSIZ];
684 size_t line_chars_allocated;
685 677
686 if (STREQ(checkfile_name, "-")) { 678 if (STREQ(checkfile_name, "-")) {
687 have_read_stdin = 1; 679 have_read_stdin = 1;
@@ -695,8 +687,6 @@ static int md5_check(const char *checkfile_name)
695 } 687 }
696 688
697 line_number = 0; 689 line_number = 0;
698 line = 0;
699 line_chars_allocated = 0;
700 690
701 do { 691 do {
702 char *filename; 692 char *filename;
@@ -706,7 +696,8 @@ static int md5_check(const char *checkfile_name)
706 696
707 ++line_number; 697 ++line_number;
708 698
709 line_length = getline(&line, &line_chars_allocated, checkfile_stream); 699 fgets(line, BUFSIZ-1, checkfile_stream);
700 line_length = strlen(line);
710 701
711 if (line_length <= 0) 702 if (line_length <= 0)
712 break; 703 break;
diff --git a/lash.c b/lash.c
index 590f5ee89..b8ddc87c1 100644
--- a/lash.c
+++ b/lash.c
@@ -137,6 +137,8 @@ static int builtin_if(struct child_prog *cmd);
137static int builtin_then(struct child_prog *cmd); 137static int builtin_then(struct child_prog *cmd);
138static int builtin_else(struct child_prog *cmd); 138static int builtin_else(struct child_prog *cmd);
139static int builtin_fi(struct child_prog *cmd); 139static int builtin_fi(struct child_prog *cmd);
140/* function prototypes for shell stuff */
141static int run_command_predicate(char *cmd);
140#endif 142#endif
141 143
142 144
@@ -146,7 +148,6 @@ static int get_command(FILE * source, char *command);
146static int parse_command(char **command_ptr, struct job *job, int *inbg); 148static int parse_command(char **command_ptr, struct job *job, int *inbg);
147static int run_command(struct job *newjob, int inbg, int outpipe[2]); 149static int run_command(struct job *newjob, int inbg, int outpipe[2]);
148static int pseudo_exec(struct child_prog *cmd) __attribute__ ((noreturn)); 150static int pseudo_exec(struct child_prog *cmd) __attribute__ ((noreturn));
149static int run_command_predicate(char *cmd);
150static int busy_loop(FILE * input); 151static int busy_loop(FILE * input);
151 152
152 153
@@ -580,6 +581,7 @@ static int builtin_unset(struct child_prog *child)
580 return EXIT_SUCCESS; 581 return EXIT_SUCCESS;
581} 582}
582 583
584#ifdef BB_FEATURE_SH_IF_EXPRESSIONS
583/* currently used by if/then/else. 585/* currently used by if/then/else.
584 * Needlessly (?) forks and reparses the command line. 586 * Needlessly (?) forks and reparses the command line.
585 * But pseudo_exec on the pre-parsed args doesn't have the 587 * But pseudo_exec on the pre-parsed args doesn't have the
@@ -596,6 +598,7 @@ static int run_command_predicate(char *cmd)
596 local_pending_command[n]='\0'; 598 local_pending_command[n]='\0';
597 return( busy_loop(NULL)); 599 return( busy_loop(NULL));
598} 600}
601#endif
599 602
600/* free up all memory from a job */ 603/* free up all memory from a job */
601static void free_job(struct job *cmd) 604static void free_job(struct job *cmd)
diff --git a/md5sum.c b/md5sum.c
index ecc1458a2..2c08b29c5 100644
--- a/md5sum.c
+++ b/md5sum.c
@@ -26,13 +26,6 @@
26#include <ctype.h> 26#include <ctype.h>
27#include <getopt.h> 27#include <getopt.h>
28 28
29/* It turns out that libc5 doesn't have this in its headers
30 * even though it is actually in the lib. Force it to work */
31#if ! defined __GLIBC__ && ! defined __UCLIBC__
32#define getline __getline
33extern _IO_ssize_t getline __P ((char **, size_t *, FILE *));
34#endif
35
36//---------------------------------------------------------------------------- 29//----------------------------------------------------------------------------
37//--------md5.c 30//--------md5.c
38//---------------------------------------------------------------------------- 31//----------------------------------------------------------------------------
@@ -680,8 +673,7 @@ static int md5_check(const char *checkfile_name)
680 int n_open_or_read_failures = 0; 673 int n_open_or_read_failures = 0;
681 unsigned char md5buffer[16]; 674 unsigned char md5buffer[16];
682 size_t line_number; 675 size_t line_number;
683 char *line; 676 char line[BUFSIZ];
684 size_t line_chars_allocated;
685 677
686 if (STREQ(checkfile_name, "-")) { 678 if (STREQ(checkfile_name, "-")) {
687 have_read_stdin = 1; 679 have_read_stdin = 1;
@@ -695,8 +687,6 @@ static int md5_check(const char *checkfile_name)
695 } 687 }
696 688
697 line_number = 0; 689 line_number = 0;
698 line = 0;
699 line_chars_allocated = 0;
700 690
701 do { 691 do {
702 char *filename; 692 char *filename;
@@ -706,7 +696,8 @@ static int md5_check(const char *checkfile_name)
706 696
707 ++line_number; 697 ++line_number;
708 698
709 line_length = getline(&line, &line_chars_allocated, checkfile_stream); 699 fgets(line, BUFSIZ-1, checkfile_stream);
700 line_length = strlen(line);
710 701
711 if (line_length <= 0) 702 if (line_length <= 0)
712 break; 703 break;
diff --git a/sh.c b/sh.c
index 590f5ee89..b8ddc87c1 100644
--- a/sh.c
+++ b/sh.c
@@ -137,6 +137,8 @@ static int builtin_if(struct child_prog *cmd);
137static int builtin_then(struct child_prog *cmd); 137static int builtin_then(struct child_prog *cmd);
138static int builtin_else(struct child_prog *cmd); 138static int builtin_else(struct child_prog *cmd);
139static int builtin_fi(struct child_prog *cmd); 139static int builtin_fi(struct child_prog *cmd);
140/* function prototypes for shell stuff */
141static int run_command_predicate(char *cmd);
140#endif 142#endif
141 143
142 144
@@ -146,7 +148,6 @@ static int get_command(FILE * source, char *command);
146static int parse_command(char **command_ptr, struct job *job, int *inbg); 148static int parse_command(char **command_ptr, struct job *job, int *inbg);
147static int run_command(struct job *newjob, int inbg, int outpipe[2]); 149static int run_command(struct job *newjob, int inbg, int outpipe[2]);
148static int pseudo_exec(struct child_prog *cmd) __attribute__ ((noreturn)); 150static int pseudo_exec(struct child_prog *cmd) __attribute__ ((noreturn));
149static int run_command_predicate(char *cmd);
150static int busy_loop(FILE * input); 151static int busy_loop(FILE * input);
151 152
152 153
@@ -580,6 +581,7 @@ static int builtin_unset(struct child_prog *child)
580 return EXIT_SUCCESS; 581 return EXIT_SUCCESS;
581} 582}
582 583
584#ifdef BB_FEATURE_SH_IF_EXPRESSIONS
583/* currently used by if/then/else. 585/* currently used by if/then/else.
584 * Needlessly (?) forks and reparses the command line. 586 * Needlessly (?) forks and reparses the command line.
585 * But pseudo_exec on the pre-parsed args doesn't have the 587 * But pseudo_exec on the pre-parsed args doesn't have the
@@ -596,6 +598,7 @@ static int run_command_predicate(char *cmd)
596 local_pending_command[n]='\0'; 598 local_pending_command[n]='\0';
597 return( busy_loop(NULL)); 599 return( busy_loop(NULL));
598} 600}
601#endif
599 602
600/* free up all memory from a job */ 603/* free up all memory from a job */
601static void free_job(struct job *cmd) 604static void free_job(struct job *cmd)
diff --git a/shell/lash.c b/shell/lash.c
index 590f5ee89..b8ddc87c1 100644
--- a/shell/lash.c
+++ b/shell/lash.c
@@ -137,6 +137,8 @@ static int builtin_if(struct child_prog *cmd);
137static int builtin_then(struct child_prog *cmd); 137static int builtin_then(struct child_prog *cmd);
138static int builtin_else(struct child_prog *cmd); 138static int builtin_else(struct child_prog *cmd);
139static int builtin_fi(struct child_prog *cmd); 139static int builtin_fi(struct child_prog *cmd);
140/* function prototypes for shell stuff */
141static int run_command_predicate(char *cmd);
140#endif 142#endif
141 143
142 144
@@ -146,7 +148,6 @@ static int get_command(FILE * source, char *command);
146static int parse_command(char **command_ptr, struct job *job, int *inbg); 148static int parse_command(char **command_ptr, struct job *job, int *inbg);
147static int run_command(struct job *newjob, int inbg, int outpipe[2]); 149static int run_command(struct job *newjob, int inbg, int outpipe[2]);
148static int pseudo_exec(struct child_prog *cmd) __attribute__ ((noreturn)); 150static int pseudo_exec(struct child_prog *cmd) __attribute__ ((noreturn));
149static int run_command_predicate(char *cmd);
150static int busy_loop(FILE * input); 151static int busy_loop(FILE * input);
151 152
152 153
@@ -580,6 +581,7 @@ static int builtin_unset(struct child_prog *child)
580 return EXIT_SUCCESS; 581 return EXIT_SUCCESS;
581} 582}
582 583
584#ifdef BB_FEATURE_SH_IF_EXPRESSIONS
583/* currently used by if/then/else. 585/* currently used by if/then/else.
584 * Needlessly (?) forks and reparses the command line. 586 * Needlessly (?) forks and reparses the command line.
585 * But pseudo_exec on the pre-parsed args doesn't have the 587 * But pseudo_exec on the pre-parsed args doesn't have the
@@ -596,6 +598,7 @@ static int run_command_predicate(char *cmd)
596 local_pending_command[n]='\0'; 598 local_pending_command[n]='\0';
597 return( busy_loop(NULL)); 599 return( busy_loop(NULL));
598} 600}
601#endif
599 602
600/* free up all memory from a job */ 603/* free up all memory from a job */
601static void free_job(struct job *cmd) 604static void free_job(struct job *cmd)