mirror of
https://github.com/sheumann/hush.git
synced 2024-07-10 13:29:00 +00:00
Fix a warning in sh.c. Remove use of getline() in md5sum since
nobody else uses it and it is a GNU extension anyways...
This commit is contained in:
parent
3680c58084
commit
70da6a66d2
@ -26,13 +26,6 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
|
|
||||||
/* It turns out that libc5 doesn't have this in its headers
|
|
||||||
* even though it is actually in the lib. Force it to work */
|
|
||||||
#if ! defined __GLIBC__ && ! defined __UCLIBC__
|
|
||||||
#define getline __getline
|
|
||||||
extern _IO_ssize_t getline __P ((char **, size_t *, FILE *));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
//--------md5.c
|
//--------md5.c
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@ -680,8 +673,7 @@ static int md5_check(const char *checkfile_name)
|
|||||||
int n_open_or_read_failures = 0;
|
int n_open_or_read_failures = 0;
|
||||||
unsigned char md5buffer[16];
|
unsigned char md5buffer[16];
|
||||||
size_t line_number;
|
size_t line_number;
|
||||||
char *line;
|
char line[BUFSIZ];
|
||||||
size_t line_chars_allocated;
|
|
||||||
|
|
||||||
if (STREQ(checkfile_name, "-")) {
|
if (STREQ(checkfile_name, "-")) {
|
||||||
have_read_stdin = 1;
|
have_read_stdin = 1;
|
||||||
@ -695,8 +687,6 @@ static int md5_check(const char *checkfile_name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
line_number = 0;
|
line_number = 0;
|
||||||
line = 0;
|
|
||||||
line_chars_allocated = 0;
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
char *filename;
|
char *filename;
|
||||||
@ -706,7 +696,8 @@ static int md5_check(const char *checkfile_name)
|
|||||||
|
|
||||||
++line_number;
|
++line_number;
|
||||||
|
|
||||||
line_length = getline(&line, &line_chars_allocated, checkfile_stream);
|
fgets(line, BUFSIZ-1, checkfile_stream);
|
||||||
|
line_length = strlen(line);
|
||||||
|
|
||||||
if (line_length <= 0)
|
if (line_length <= 0)
|
||||||
break;
|
break;
|
||||||
|
5
lash.c
5
lash.c
@ -137,6 +137,8 @@ static int builtin_if(struct child_prog *cmd);
|
|||||||
static int builtin_then(struct child_prog *cmd);
|
static int builtin_then(struct child_prog *cmd);
|
||||||
static int builtin_else(struct child_prog *cmd);
|
static int builtin_else(struct child_prog *cmd);
|
||||||
static int builtin_fi(struct child_prog *cmd);
|
static int builtin_fi(struct child_prog *cmd);
|
||||||
|
/* function prototypes for shell stuff */
|
||||||
|
static int run_command_predicate(char *cmd);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -146,7 +148,6 @@ static int get_command(FILE * source, char *command);
|
|||||||
static int parse_command(char **command_ptr, struct job *job, int *inbg);
|
static int parse_command(char **command_ptr, struct job *job, int *inbg);
|
||||||
static int run_command(struct job *newjob, int inbg, int outpipe[2]);
|
static int run_command(struct job *newjob, int inbg, int outpipe[2]);
|
||||||
static int pseudo_exec(struct child_prog *cmd) __attribute__ ((noreturn));
|
static int pseudo_exec(struct child_prog *cmd) __attribute__ ((noreturn));
|
||||||
static int run_command_predicate(char *cmd);
|
|
||||||
static int busy_loop(FILE * input);
|
static int busy_loop(FILE * input);
|
||||||
|
|
||||||
|
|
||||||
@ -580,6 +581,7 @@ static int builtin_unset(struct child_prog *child)
|
|||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef BB_FEATURE_SH_IF_EXPRESSIONS
|
||||||
/* currently used by if/then/else.
|
/* currently used by if/then/else.
|
||||||
* Needlessly (?) forks and reparses the command line.
|
* Needlessly (?) forks and reparses the command line.
|
||||||
* But pseudo_exec on the pre-parsed args doesn't have the
|
* But pseudo_exec on the pre-parsed args doesn't have the
|
||||||
@ -596,6 +598,7 @@ static int run_command_predicate(char *cmd)
|
|||||||
local_pending_command[n]='\0';
|
local_pending_command[n]='\0';
|
||||||
return( busy_loop(NULL));
|
return( busy_loop(NULL));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* free up all memory from a job */
|
/* free up all memory from a job */
|
||||||
static void free_job(struct job *cmd)
|
static void free_job(struct job *cmd)
|
||||||
|
15
md5sum.c
15
md5sum.c
@ -26,13 +26,6 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
|
|
||||||
/* It turns out that libc5 doesn't have this in its headers
|
|
||||||
* even though it is actually in the lib. Force it to work */
|
|
||||||
#if ! defined __GLIBC__ && ! defined __UCLIBC__
|
|
||||||
#define getline __getline
|
|
||||||
extern _IO_ssize_t getline __P ((char **, size_t *, FILE *));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
//--------md5.c
|
//--------md5.c
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@ -680,8 +673,7 @@ static int md5_check(const char *checkfile_name)
|
|||||||
int n_open_or_read_failures = 0;
|
int n_open_or_read_failures = 0;
|
||||||
unsigned char md5buffer[16];
|
unsigned char md5buffer[16];
|
||||||
size_t line_number;
|
size_t line_number;
|
||||||
char *line;
|
char line[BUFSIZ];
|
||||||
size_t line_chars_allocated;
|
|
||||||
|
|
||||||
if (STREQ(checkfile_name, "-")) {
|
if (STREQ(checkfile_name, "-")) {
|
||||||
have_read_stdin = 1;
|
have_read_stdin = 1;
|
||||||
@ -695,8 +687,6 @@ static int md5_check(const char *checkfile_name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
line_number = 0;
|
line_number = 0;
|
||||||
line = 0;
|
|
||||||
line_chars_allocated = 0;
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
char *filename;
|
char *filename;
|
||||||
@ -706,7 +696,8 @@ static int md5_check(const char *checkfile_name)
|
|||||||
|
|
||||||
++line_number;
|
++line_number;
|
||||||
|
|
||||||
line_length = getline(&line, &line_chars_allocated, checkfile_stream);
|
fgets(line, BUFSIZ-1, checkfile_stream);
|
||||||
|
line_length = strlen(line);
|
||||||
|
|
||||||
if (line_length <= 0)
|
if (line_length <= 0)
|
||||||
break;
|
break;
|
||||||
|
5
sh.c
5
sh.c
@ -137,6 +137,8 @@ static int builtin_if(struct child_prog *cmd);
|
|||||||
static int builtin_then(struct child_prog *cmd);
|
static int builtin_then(struct child_prog *cmd);
|
||||||
static int builtin_else(struct child_prog *cmd);
|
static int builtin_else(struct child_prog *cmd);
|
||||||
static int builtin_fi(struct child_prog *cmd);
|
static int builtin_fi(struct child_prog *cmd);
|
||||||
|
/* function prototypes for shell stuff */
|
||||||
|
static int run_command_predicate(char *cmd);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -146,7 +148,6 @@ static int get_command(FILE * source, char *command);
|
|||||||
static int parse_command(char **command_ptr, struct job *job, int *inbg);
|
static int parse_command(char **command_ptr, struct job *job, int *inbg);
|
||||||
static int run_command(struct job *newjob, int inbg, int outpipe[2]);
|
static int run_command(struct job *newjob, int inbg, int outpipe[2]);
|
||||||
static int pseudo_exec(struct child_prog *cmd) __attribute__ ((noreturn));
|
static int pseudo_exec(struct child_prog *cmd) __attribute__ ((noreturn));
|
||||||
static int run_command_predicate(char *cmd);
|
|
||||||
static int busy_loop(FILE * input);
|
static int busy_loop(FILE * input);
|
||||||
|
|
||||||
|
|
||||||
@ -580,6 +581,7 @@ static int builtin_unset(struct child_prog *child)
|
|||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef BB_FEATURE_SH_IF_EXPRESSIONS
|
||||||
/* currently used by if/then/else.
|
/* currently used by if/then/else.
|
||||||
* Needlessly (?) forks and reparses the command line.
|
* Needlessly (?) forks and reparses the command line.
|
||||||
* But pseudo_exec on the pre-parsed args doesn't have the
|
* But pseudo_exec on the pre-parsed args doesn't have the
|
||||||
@ -596,6 +598,7 @@ static int run_command_predicate(char *cmd)
|
|||||||
local_pending_command[n]='\0';
|
local_pending_command[n]='\0';
|
||||||
return( busy_loop(NULL));
|
return( busy_loop(NULL));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* free up all memory from a job */
|
/* free up all memory from a job */
|
||||||
static void free_job(struct job *cmd)
|
static void free_job(struct job *cmd)
|
||||||
|
@ -137,6 +137,8 @@ static int builtin_if(struct child_prog *cmd);
|
|||||||
static int builtin_then(struct child_prog *cmd);
|
static int builtin_then(struct child_prog *cmd);
|
||||||
static int builtin_else(struct child_prog *cmd);
|
static int builtin_else(struct child_prog *cmd);
|
||||||
static int builtin_fi(struct child_prog *cmd);
|
static int builtin_fi(struct child_prog *cmd);
|
||||||
|
/* function prototypes for shell stuff */
|
||||||
|
static int run_command_predicate(char *cmd);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -146,7 +148,6 @@ static int get_command(FILE * source, char *command);
|
|||||||
static int parse_command(char **command_ptr, struct job *job, int *inbg);
|
static int parse_command(char **command_ptr, struct job *job, int *inbg);
|
||||||
static int run_command(struct job *newjob, int inbg, int outpipe[2]);
|
static int run_command(struct job *newjob, int inbg, int outpipe[2]);
|
||||||
static int pseudo_exec(struct child_prog *cmd) __attribute__ ((noreturn));
|
static int pseudo_exec(struct child_prog *cmd) __attribute__ ((noreturn));
|
||||||
static int run_command_predicate(char *cmd);
|
|
||||||
static int busy_loop(FILE * input);
|
static int busy_loop(FILE * input);
|
||||||
|
|
||||||
|
|
||||||
@ -580,6 +581,7 @@ static int builtin_unset(struct child_prog *child)
|
|||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef BB_FEATURE_SH_IF_EXPRESSIONS
|
||||||
/* currently used by if/then/else.
|
/* currently used by if/then/else.
|
||||||
* Needlessly (?) forks and reparses the command line.
|
* Needlessly (?) forks and reparses the command line.
|
||||||
* But pseudo_exec on the pre-parsed args doesn't have the
|
* But pseudo_exec on the pre-parsed args doesn't have the
|
||||||
@ -596,6 +598,7 @@ static int run_command_predicate(char *cmd)
|
|||||||
local_pending_command[n]='\0';
|
local_pending_command[n]='\0';
|
||||||
return( busy_loop(NULL));
|
return( busy_loop(NULL));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* free up all memory from a job */
|
/* free up all memory from a job */
|
||||||
static void free_job(struct job *cmd)
|
static void free_job(struct job *cmd)
|
||||||
|
Loading…
Reference in New Issue
Block a user