add open_read_close() and similar stuff

This commit is contained in:
Denis Vlasenko
2006-10-14 02:23:43 +00:00
parent 88ca067690
commit ea62077b85
38 changed files with 228 additions and 234 deletions

View File

@ -496,7 +496,6 @@ static void unix_do_one(int nr, const char *line)
static void do_info(const char *file, const char *name, void (*proc)(int, const char *))
{
char buffer[8192];
int lnr = 0;
FILE *procinfo;
@ -505,12 +504,15 @@ static void do_info(const char *file, const char *name, void (*proc)(int, const
if (errno != ENOENT) {
perror(file);
} else {
bb_error_msg("no support for `%s' on this system", name);
bb_error_msg("no support for '%s' on this system", name);
}
} else {
do {
if (fgets(buffer, sizeof(buffer), procinfo))
char *buffer = xmalloc_fgets(procinfo);
if (buffer) {
(proc)(lnr++, buffer);
free(buffer);
}
} while (!feof(procinfo));
fclose(procinfo);
}