nobody else uses it and it is a GNU extension anyways...
#include <ctype.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
//----------------------------------------------------------------------------
int n_open_or_read_failures = 0;
unsigned char md5buffer[16];
size_t line_number;
- char *line;
- size_t line_chars_allocated;
+ char line[BUFSIZ];
if (STREQ(checkfile_name, "-")) {
have_read_stdin = 1;
}
line_number = 0;
- line = 0;
- line_chars_allocated = 0;
do {
char *filename;
++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)
break;
static int builtin_then(struct child_prog *cmd);
static int builtin_else(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
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 pseudo_exec(struct child_prog *cmd) __attribute__ ((noreturn));
-static int run_command_predicate(char *cmd);
static int busy_loop(FILE * input);
return EXIT_SUCCESS;
}
+#ifdef BB_FEATURE_SH_IF_EXPRESSIONS
/* currently used by if/then/else.
* Needlessly (?) forks and reparses the command line.
* But pseudo_exec on the pre-parsed args doesn't have the
local_pending_command[n]='\0';
return( busy_loop(NULL));
}
+#endif
/* free up all memory from a job */
static void free_job(struct job *cmd)
#include <ctype.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
//----------------------------------------------------------------------------
int n_open_or_read_failures = 0;
unsigned char md5buffer[16];
size_t line_number;
- char *line;
- size_t line_chars_allocated;
+ char line[BUFSIZ];
if (STREQ(checkfile_name, "-")) {
have_read_stdin = 1;
}
line_number = 0;
- line = 0;
- line_chars_allocated = 0;
do {
char *filename;
++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)
break;
static int builtin_then(struct child_prog *cmd);
static int builtin_else(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
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 pseudo_exec(struct child_prog *cmd) __attribute__ ((noreturn));
-static int run_command_predicate(char *cmd);
static int busy_loop(FILE * input);
return EXIT_SUCCESS;
}
+#ifdef BB_FEATURE_SH_IF_EXPRESSIONS
/* currently used by if/then/else.
* Needlessly (?) forks and reparses the command line.
* But pseudo_exec on the pre-parsed args doesn't have the
local_pending_command[n]='\0';
return( busy_loop(NULL));
}
+#endif
/* free up all memory from a job */
static void free_job(struct job *cmd)
static int builtin_then(struct child_prog *cmd);
static int builtin_else(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
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 pseudo_exec(struct child_prog *cmd) __attribute__ ((noreturn));
-static int run_command_predicate(char *cmd);
static int busy_loop(FILE * input);
return EXIT_SUCCESS;
}
+#ifdef BB_FEATURE_SH_IF_EXPRESSIONS
/* currently used by if/then/else.
* Needlessly (?) forks and reparses the command line.
* But pseudo_exec on the pre-parsed args doesn't have the
local_pending_command[n]='\0';
return( busy_loop(NULL));
}
+#endif
/* free up all memory from a job */
static void free_job(struct job *cmd)