*: more uniform naming: s/xmalloc_getline/xmalloc_fgetline/
This commit is contained in:
parent
ce7eb4443c
commit
8ee649a02e
@ -1162,7 +1162,7 @@ static char **create_list(const char *filename)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((line = xmalloc_getline(list_stream)) != NULL) {
|
while ((line = xmalloc_fgetline(list_stream)) != NULL) {
|
||||||
file_list = xrealloc(file_list, sizeof(char *) * (count + 2));
|
file_list = xrealloc(file_list, sizeof(char *) * (count + 2));
|
||||||
file_list[count] = line;
|
file_list[count] = line;
|
||||||
count++;
|
count++;
|
||||||
|
@ -660,7 +660,7 @@ static llist_t *append_file_list_to_list(llist_t *list)
|
|||||||
tmp = cur;
|
tmp = cur;
|
||||||
cur = cur->link;
|
cur = cur->link;
|
||||||
free(tmp);
|
free(tmp);
|
||||||
while ((line = xmalloc_getline(src_stream)) != NULL) {
|
while ((line = xmalloc_fgetline(src_stream)) != NULL) {
|
||||||
/* kill trailing '/' unless the string is just "/" */
|
/* kill trailing '/' unless the string is just "/" */
|
||||||
char *cp = last_char_is(line, '/');
|
char *cp = last_char_is(line, '/');
|
||||||
if (cp > line)
|
if (cp > line)
|
||||||
|
@ -51,7 +51,7 @@ static void cut_file(FILE *file, char delim)
|
|||||||
unsigned int linenum = 0; /* keep these zero-based to be consistent */
|
unsigned int linenum = 0; /* keep these zero-based to be consistent */
|
||||||
|
|
||||||
/* go through every line in the file */
|
/* go through every line in the file */
|
||||||
while ((line = xmalloc_getline(file)) != NULL) {
|
while ((line = xmalloc_fgetline(file)) != NULL) {
|
||||||
|
|
||||||
/* set up a list so we can keep track of what's been printed */
|
/* set up a list so we can keep track of what's been printed */
|
||||||
char * printed = xzalloc(strlen(line) * sizeof(char));
|
char * printed = xzalloc(strlen(line) * sizeof(char));
|
||||||
|
@ -115,7 +115,7 @@ int md5_sha1_sum_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
|||||||
|
|
||||||
pre_computed_stream = xfopen_stdin(argv[0]);
|
pre_computed_stream = xfopen_stdin(argv[0]);
|
||||||
|
|
||||||
while ((line = xmalloc_getline(pre_computed_stream)) != NULL) {
|
while ((line = xmalloc_fgetline(pre_computed_stream)) != NULL) {
|
||||||
char *filename_ptr;
|
char *filename_ptr;
|
||||||
|
|
||||||
count_total++;
|
count_total++;
|
||||||
|
@ -150,9 +150,9 @@ static struct sort_key *add_key(void)
|
|||||||
#define GET_LINE(fp) \
|
#define GET_LINE(fp) \
|
||||||
((option_mask32 & FLAG_z) \
|
((option_mask32 & FLAG_z) \
|
||||||
? bb_get_chunk_from_file(fp, NULL) \
|
? bb_get_chunk_from_file(fp, NULL) \
|
||||||
: xmalloc_getline(fp))
|
: xmalloc_fgetline(fp))
|
||||||
#else
|
#else
|
||||||
#define GET_LINE(fp) xmalloc_getline(fp)
|
#define GET_LINE(fp) xmalloc_fgetline(fp)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Iterate through keys list and perform comparisons */
|
/* Iterate through keys list and perform comparisons */
|
||||||
|
@ -71,7 +71,7 @@ int uniq_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
|||||||
dups = 0;
|
dups = 0;
|
||||||
|
|
||||||
/* gnu uniq ignores newlines */
|
/* gnu uniq ignores newlines */
|
||||||
while ((s1 = xmalloc_getline(in)) != NULL) {
|
while ((s1 = xmalloc_fgetline(in)) != NULL) {
|
||||||
e1 = s1;
|
e1 = s1;
|
||||||
for (i = skip_fields; i; i--) {
|
for (i = skip_fields; i; i--) {
|
||||||
e1 = skip_whitespace(e1);
|
e1 = skip_whitespace(e1);
|
||||||
|
@ -18,7 +18,7 @@ static void read_stduu(FILE *src_stream, FILE *dst_stream)
|
|||||||
{
|
{
|
||||||
char *line;
|
char *line;
|
||||||
|
|
||||||
while ((line = xmalloc_getline(src_stream)) != NULL) {
|
while ((line = xmalloc_fgetline(src_stream)) != NULL) {
|
||||||
int encoded_len, str_len;
|
int encoded_len, str_len;
|
||||||
char *line_ptr, *dst;
|
char *line_ptr, *dst;
|
||||||
|
|
||||||
@ -151,7 +151,7 @@ int uudecode_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
|||||||
src_stream = xfopen_stdin(*argv);
|
src_stream = xfopen_stdin(*argv);
|
||||||
|
|
||||||
/* Search for the start of the encoding */
|
/* Search for the start of the encoding */
|
||||||
while ((line = xmalloc_getline(src_stream)) != NULL) {
|
while ((line = xmalloc_fgetline(src_stream)) != NULL) {
|
||||||
void (*decode_fn_ptr)(FILE * src, FILE * dst);
|
void (*decode_fn_ptr)(FILE * src, FILE * dst);
|
||||||
char *line_ptr;
|
char *line_ptr;
|
||||||
FILE *dst_stream;
|
FILE *dst_stream;
|
||||||
|
@ -391,7 +391,7 @@ static void load_fs_info(const char *filename)
|
|||||||
}
|
}
|
||||||
while (1) {
|
while (1) {
|
||||||
int r;
|
int r;
|
||||||
char *buf = xmalloc_getline(f);
|
char *buf = xmalloc_fgetline(f);
|
||||||
if (!buf) break;
|
if (!buf) break;
|
||||||
r = parse_fstab_line(buf, &fs);
|
r = parse_fstab_line(buf, &fs);
|
||||||
free(buf);
|
free(buf);
|
||||||
|
@ -85,7 +85,7 @@ int patch_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
|||||||
patch_file = xfopen_stdin(i);
|
patch_file = xfopen_stdin(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
patch_line = xmalloc_getline(patch_file);
|
patch_line = xmalloc_fgetline(patch_file);
|
||||||
while (patch_line) {
|
while (patch_line) {
|
||||||
FILE *src_stream;
|
FILE *src_stream;
|
||||||
FILE *dst_stream;
|
FILE *dst_stream;
|
||||||
@ -106,7 +106,7 @@ int patch_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
|||||||
/* Extract the filename used before the patch was generated */
|
/* Extract the filename used before the patch was generated */
|
||||||
new_filename = extract_filename(patch_line, patch_level, "--- ");
|
new_filename = extract_filename(patch_line, patch_level, "--- ");
|
||||||
// was old_filename above
|
// was old_filename above
|
||||||
patch_line = xmalloc_getline(patch_file);
|
patch_line = xmalloc_fgetline(patch_file);
|
||||||
if (!patch_line) goto quit;
|
if (!patch_line) goto quit;
|
||||||
} while (!new_filename);
|
} while (!new_filename);
|
||||||
free(new_filename); // "source" filename is irrelevant
|
free(new_filename); // "source" filename is irrelevant
|
||||||
|
@ -1028,7 +1028,7 @@ static void process_files(void)
|
|||||||
if (rfile) {
|
if (rfile) {
|
||||||
char *line;
|
char *line;
|
||||||
|
|
||||||
while ((line = xmalloc_getline(rfile))
|
while ((line = xmalloc_fgetline(rfile))
|
||||||
!= NULL)
|
!= NULL)
|
||||||
append(line);
|
append(line);
|
||||||
xprint_and_close_file(rfile);
|
xprint_and_close_file(rfile);
|
||||||
@ -1273,7 +1273,7 @@ int sed_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
|||||||
char *line;
|
char *line;
|
||||||
FILE *cmdfile;
|
FILE *cmdfile;
|
||||||
cmdfile = xfopen(opt_f->data, "r");
|
cmdfile = xfopen(opt_f->data, "r");
|
||||||
while ((line = xmalloc_getline(cmdfile)) != NULL) {
|
while ((line = xmalloc_fgetline(cmdfile)) != NULL) {
|
||||||
add_cmd(line);
|
add_cmd(line);
|
||||||
free(line);
|
free(line);
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,7 @@ static int grep_file(FILE *file)
|
|||||||
enum { print_n_lines_after = 0 };
|
enum { print_n_lines_after = 0 };
|
||||||
#endif /* ENABLE_FEATURE_GREP_CONTEXT */
|
#endif /* ENABLE_FEATURE_GREP_CONTEXT */
|
||||||
|
|
||||||
while ((line = xmalloc_getline(file)) != NULL) {
|
while ((line = xmalloc_fgetline(file)) != NULL) {
|
||||||
llist_t *pattern_ptr = pattern_head;
|
llist_t *pattern_ptr = pattern_head;
|
||||||
grep_list_data_t *gl = gl; /* for gcc */
|
grep_list_data_t *gl = gl; /* for gcc */
|
||||||
|
|
||||||
@ -364,7 +364,7 @@ static void load_regexes_from_file(llist_t *fopt)
|
|||||||
fopt = cur->link;
|
fopt = cur->link;
|
||||||
free(cur);
|
free(cur);
|
||||||
f = xfopen(ffile, "r");
|
f = xfopen(ffile, "r");
|
||||||
while ((line = xmalloc_getline(f)) != NULL) {
|
while ((line = xmalloc_fgetline(f)) != NULL) {
|
||||||
llist_add_to(&pattern_head,
|
llist_add_to(&pattern_head,
|
||||||
new_grep_list_data(line, PATTERN_MEM_A));
|
new_grep_list_data(line, PATTERN_MEM_A));
|
||||||
}
|
}
|
||||||
|
@ -524,15 +524,16 @@ extern ssize_t nonblock_safe_read(int fd, void *buf, size_t count);
|
|||||||
extern ssize_t full_read(int fd, void *buf, size_t count);
|
extern ssize_t full_read(int fd, void *buf, size_t count);
|
||||||
extern void xread(int fd, void *buf, size_t count);
|
extern void xread(int fd, void *buf, size_t count);
|
||||||
extern unsigned char xread_char(int fd);
|
extern unsigned char xread_char(int fd);
|
||||||
// Read one line a-la fgets. Uses one read(), works only on seekable streams
|
// Reads one line a-la fgets (but doesn't save terminating '\n').
|
||||||
|
// Uses single full_read() call, works only on seekable streams.
|
||||||
extern char *reads(int fd, char *buf, size_t count);
|
extern char *reads(int fd, char *buf, size_t count);
|
||||||
// Read one line a-la fgets. Reads byte-by-byte.
|
// Reads one line a-la fgets (but doesn't save terminating '\n').
|
||||||
// Useful when it is important to not read ahead.
|
// Reads byte-by-byte. Useful when it is important to not read ahead.
|
||||||
// Bytes are appended to pfx (which must be malloced, or NULL).
|
// Bytes are appended to pfx (which must be malloced, or NULL).
|
||||||
extern char *xmalloc_reads(int fd, char *pfx, size_t *maxsz_p);
|
extern char *xmalloc_reads(int fd, char *pfx, size_t *maxsz_p);
|
||||||
extern ssize_t read_close(int fd, void *buf, size_t count);
|
extern ssize_t read_close(int fd, void *buf, size_t maxsz);
|
||||||
extern ssize_t open_read_close(const char *filename, void *buf, size_t count);
|
extern ssize_t open_read_close(const char *filename, void *buf, size_t maxsz);
|
||||||
extern void *xmalloc_open_read_close(const char *filename, size_t *sizep);
|
extern void *xmalloc_open_read_close(const char *filename, size_t *maxsz_p);
|
||||||
|
|
||||||
extern ssize_t safe_write(int fd, const void *buf, size_t count);
|
extern ssize_t safe_write(int fd, const void *buf, size_t count);
|
||||||
// NB: will return short write on error, not -1,
|
// NB: will return short write on error, not -1,
|
||||||
@ -549,7 +550,7 @@ extern char *xmalloc_fgetline_str(FILE *file, const char *terminating_string);
|
|||||||
/* Reads up to (and including) "\n" or NUL byte */
|
/* Reads up to (and including) "\n" or NUL byte */
|
||||||
extern char *xmalloc_fgets(FILE *file);
|
extern char *xmalloc_fgets(FILE *file);
|
||||||
/* Chops off '\n' from the end, unlike fgets: */
|
/* Chops off '\n' from the end, unlike fgets: */
|
||||||
extern char *xmalloc_getline(FILE *file);
|
extern char *xmalloc_fgetline(FILE *file);
|
||||||
extern char *bb_get_chunk_from_file(FILE *file, int *end);
|
extern char *bb_get_chunk_from_file(FILE *file, int *end);
|
||||||
extern void die_if_ferror(FILE *file, const char *msg);
|
extern void die_if_ferror(FILE *file, const char *msg);
|
||||||
extern void die_if_ferror_stdout(void);
|
extern void die_if_ferror_stdout(void);
|
||||||
|
@ -133,6 +133,8 @@
|
|||||||
"\n -f Control pipe (else exit after drawing image)" \
|
"\n -f Control pipe (else exit after drawing image)" \
|
||||||
"\n commands: 'NN' (% for progress bar) or 'exit'" \
|
"\n commands: 'NN' (% for progress bar) or 'exit'" \
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define brctl_trivial_usage \
|
#define brctl_trivial_usage \
|
||||||
"COMMAND [BRIDGE [INTERFACE]]"
|
"COMMAND [BRIDGE [INTERFACE]]"
|
||||||
#define brctl_full_usage \
|
#define brctl_full_usage \
|
||||||
|
@ -57,7 +57,7 @@ char *xmalloc_fgets(FILE *file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Get line. Remove trailing \n */
|
/* Get line. Remove trailing \n */
|
||||||
char *xmalloc_getline(FILE *file)
|
char *xmalloc_fgetline(FILE *file)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *c = bb_get_chunk_from_file(file, &i);
|
char *c = bb_get_chunk_from_file(file, &i);
|
||||||
|
@ -969,7 +969,7 @@ static void load_history(const char *fromfile)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (hi = 0; hi < MAX_HISTORY;) {
|
for (hi = 0; hi < MAX_HISTORY;) {
|
||||||
char *hl = xmalloc_getline(fp);
|
char *hl = xmalloc_fgetline(fp);
|
||||||
int l;
|
int l;
|
||||||
|
|
||||||
if (!hl)
|
if (!hl)
|
||||||
|
11
libbb/read.c
11
libbb/read.c
@ -141,7 +141,7 @@ char *reads(int fd, char *buffer, size_t size)
|
|||||||
off_t offset;
|
off_t offset;
|
||||||
*p++ = '\0';
|
*p++ = '\0';
|
||||||
// avoid incorrect (unsigned) widening
|
// avoid incorrect (unsigned) widening
|
||||||
offset = (off_t)(p-buffer) - (off_t)size;
|
offset = (off_t)(p - buffer) - (off_t)size;
|
||||||
// set fd position right after '\n'
|
// set fd position right after '\n'
|
||||||
if (offset && lseek(fd, offset, SEEK_CUR) == (off_t)-1)
|
if (offset && lseek(fd, offset, SEEK_CUR) == (off_t)-1)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -149,8 +149,8 @@ char *reads(int fd, char *buffer, size_t size)
|
|||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read one line a-la fgets. Reads byte-by-byte.
|
// Reads one line a-la fgets (but doesn't save terminating '\n').
|
||||||
// Useful when it is important to not read ahead.
|
// Reads byte-by-byte. Useful when it is important to not read ahead.
|
||||||
// Bytes are appended to pfx (which must be malloced, or NULL).
|
// Bytes are appended to pfx (which must be malloced, or NULL).
|
||||||
char *xmalloc_reads(int fd, char *buf, size_t *maxsz_p)
|
char *xmalloc_reads(int fd, char *buf, size_t *maxsz_p)
|
||||||
{
|
{
|
||||||
@ -178,9 +178,10 @@ char *xmalloc_reads(int fd, char *buf, size_t *maxsz_p)
|
|||||||
break;
|
break;
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
*p++ = '\0';
|
*p = '\0';
|
||||||
if (maxsz_p)
|
if (maxsz_p)
|
||||||
*maxsz_p = p - buf - 1;
|
*maxsz_p = p - buf;
|
||||||
|
p++;
|
||||||
return xrealloc(buf, p - buf);
|
return xrealloc(buf, p - buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ static void add_user_to_group(char **args,
|
|||||||
|
|
||||||
if (!group_file) return;
|
if (!group_file) return;
|
||||||
|
|
||||||
while ((line = xmalloc_getline(group_file))) {
|
while ((line = xmalloc_fgetline(group_file)) != NULL) {
|
||||||
/* Find the group */
|
/* Find the group */
|
||||||
if (!strncmp(line, args[1], len)
|
if (!strncmp(line, args[1], len)
|
||||||
&& line[len] == ':'
|
&& line[len] == ':'
|
||||||
|
@ -33,7 +33,7 @@ int chpasswd_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
|||||||
USE_GETOPT_LONG(applet_long_options = chpasswd_longopts;)
|
USE_GETOPT_LONG(applet_long_options = chpasswd_longopts;)
|
||||||
opt = getopt32(argv, "em");
|
opt = getopt32(argv, "em");
|
||||||
|
|
||||||
while ((name = xmalloc_getline(stdin)) != NULL) {
|
while ((name = xmalloc_fgetline(stdin)) != NULL) {
|
||||||
pass = strchr(name, ':');
|
pass = strchr(name, ':');
|
||||||
if (!pass)
|
if (!pass)
|
||||||
bb_error_msg_and_die("missing new password");
|
bb_error_msg_and_die("missing new password");
|
||||||
|
@ -22,7 +22,7 @@ int cryptpw_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
|||||||
crypt_make_salt(salt, 1, 0); /* des */
|
crypt_make_salt(salt, 1, 0); /* des */
|
||||||
}
|
}
|
||||||
|
|
||||||
puts(pw_encrypt(argv[optind] ? argv[optind] : xmalloc_getline(stdin), salt));
|
puts(pw_encrypt(argv[optind] ? argv[optind] : xmalloc_fgetline(stdin), salt));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -204,7 +204,7 @@ int dc_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
|||||||
char *line;
|
char *line;
|
||||||
char *cursor;
|
char *cursor;
|
||||||
char *token;
|
char *token;
|
||||||
while ((line = xmalloc_getline(stdin)) != NULL) {
|
while ((line = xmalloc_fgetline(stdin)) != NULL) {
|
||||||
cursor = line;
|
cursor = line;
|
||||||
while (1) {
|
while (1) {
|
||||||
token = get_token(&cursor);
|
token = get_token(&cursor);
|
||||||
|
@ -97,7 +97,7 @@ int makedevs_main(int argc, char **argv)
|
|||||||
printf("table=<stdin>\n");
|
printf("table=<stdin>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((line = xmalloc_getline(table))) {
|
while ((line = xmalloc_fgetline(table)) != NULL) {
|
||||||
char type;
|
char type;
|
||||||
unsigned int mode = 0755;
|
unsigned int mode = 0755;
|
||||||
unsigned int major = 0;
|
unsigned int major = 0;
|
||||||
|
@ -693,13 +693,13 @@ static struct interfaces_file_t *read_interfaces(const char *filename)
|
|||||||
defn = xzalloc(sizeof(*defn));
|
defn = xzalloc(sizeof(*defn));
|
||||||
f = xfopen(filename, "r");
|
f = xfopen(filename, "r");
|
||||||
|
|
||||||
while ((buf = xmalloc_getline(f)) != NULL) {
|
while ((buf = xmalloc_fgetline(f)) != NULL) {
|
||||||
#if ENABLE_DESKTOP
|
#if ENABLE_DESKTOP
|
||||||
/* Trailing "\" concatenates lines */
|
/* Trailing "\" concatenates lines */
|
||||||
char *p;
|
char *p;
|
||||||
while ((p = last_char_is(buf, '\\')) != NULL) {
|
while ((p = last_char_is(buf, '\\')) != NULL) {
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
rest_of_line = xmalloc_getline(f);
|
rest_of_line = xmalloc_fgetline(f);
|
||||||
if (!rest_of_line)
|
if (!rest_of_line)
|
||||||
break;
|
break;
|
||||||
p = xasprintf("%s%s", buf, rest_of_line);
|
p = xasprintf("%s%s", buf, rest_of_line);
|
||||||
@ -1051,7 +1051,7 @@ static char *run_mapping(char *physical, struct mapping_defn_t *map)
|
|||||||
/* If the mapping script exited successfully, try to
|
/* If the mapping script exited successfully, try to
|
||||||
* grab a line of output and use that as the name of the
|
* grab a line of output and use that as the name of the
|
||||||
* logical interface. */
|
* logical interface. */
|
||||||
char *new_logical = xmalloc_getline(out);
|
char *new_logical = xmalloc_fgetline(out);
|
||||||
|
|
||||||
if (new_logical) {
|
if (new_logical) {
|
||||||
/* If we are able to read a line of output from the script,
|
/* If we are able to read a line of output from the script,
|
||||||
|
@ -170,7 +170,7 @@ static int smtp_checkp(const char *fmt, const char *param, int code)
|
|||||||
// if code = -1 then just return this number
|
// if code = -1 then just return this number
|
||||||
// if code != -1 then checks whether the number equals the code
|
// if code != -1 then checks whether the number equals the code
|
||||||
// if not equal -> die saying msg
|
// if not equal -> die saying msg
|
||||||
while ((answer = xmalloc_getline(stdin)) != NULL)
|
while ((answer = xmalloc_fgetline(stdin)) != NULL)
|
||||||
if (strlen(answer) <= 3 || '-' != answer[3])
|
if (strlen(answer) <= 3 || '-' != answer[3])
|
||||||
break;
|
break;
|
||||||
if (answer) {
|
if (answer) {
|
||||||
@ -211,7 +211,7 @@ static char *sane(char *str)
|
|||||||
static void pop3_checkr(const char *fmt, const char *param, char **ret)
|
static void pop3_checkr(const char *fmt, const char *param, char **ret)
|
||||||
{
|
{
|
||||||
const char *msg = command(fmt, param);
|
const char *msg = command(fmt, param);
|
||||||
char *answer = xmalloc_getline(stdin);
|
char *answer = xmalloc_fgetline(stdin);
|
||||||
if (answer && '+' == *answer) {
|
if (answer && '+' == *answer) {
|
||||||
alarm(0);
|
alarm(0);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
@ -23,7 +23,7 @@ static void bb_dump_addfile(char *name)
|
|||||||
|
|
||||||
fp = xfopen(name, "r");
|
fp = xfopen(name, "r");
|
||||||
|
|
||||||
while ((buf = xmalloc_getline(fp)) != NULL) {
|
while ((buf = xmalloc_fgetline(fp)) != NULL) {
|
||||||
p = skip_whitespace(buf);
|
p = skip_whitespace(buf);
|
||||||
|
|
||||||
if (*p && (*p != '#')) {
|
if (*p && (*p != '#')) {
|
||||||
@ -135,7 +135,7 @@ int hexdump_main(int argc, char **argv)
|
|||||||
char *buf;
|
char *buf;
|
||||||
fp = xfopen(*argv, "r");
|
fp = xfopen(*argv, "r");
|
||||||
jump_in:
|
jump_in:
|
||||||
while ((buf = xmalloc_getline(fp)) != NULL) {
|
while ((buf = xmalloc_fgetline(fp)) != NULL) {
|
||||||
p = buf;
|
p = buf;
|
||||||
while (1) {
|
while (1) {
|
||||||
/* skip address or previous byte */
|
/* skip address or previous byte */
|
||||||
|
@ -68,7 +68,7 @@ static void make_device(char *path, int delete)
|
|||||||
if (!fp)
|
if (!fp)
|
||||||
goto end_parse;
|
goto end_parse;
|
||||||
|
|
||||||
while ((vline = line = xmalloc_getline(fp)) != NULL) {
|
while ((vline = line = xmalloc_fgetline(fp)) != NULL) {
|
||||||
int field;
|
int field;
|
||||||
|
|
||||||
/* A pristine copy for command execution. */
|
/* A pristine copy for command execution. */
|
||||||
|
@ -362,7 +362,7 @@ static llist_t *get_block_backed_filesystems(void)
|
|||||||
f = fopen(filesystems[i], "r");
|
f = fopen(filesystems[i], "r");
|
||||||
if (!f) continue;
|
if (!f) continue;
|
||||||
|
|
||||||
while ((buf = xmalloc_getline(f)) != 0) {
|
while ((buf = xmalloc_fgetline(f)) != NULL) {
|
||||||
if (!strncmp(buf, "nodev", 5) && isspace(buf[5]))
|
if (!strncmp(buf, "nodev", 5) && isspace(buf[5]))
|
||||||
continue;
|
continue;
|
||||||
fs = skip_whitespace(buf);
|
fs = skip_whitespace(buf);
|
||||||
|
Loading…
Reference in New Issue
Block a user