version 1.19, 2015/07/17 20:38:57 |
version 1.20, 2015/07/17 21:21:02 |
|
|
static int |
static int |
next_files_have_lines() |
next_files_have_lines() |
{ |
{ |
struct s_flist *file; |
struct s_flist *file; |
FILE *file_fd; |
FILE *file_fd; |
int ch; |
int ch; |
|
|
file = files; |
file = files; |
while ((file = file->next) != NULL) { |
while ((file = file->next) != NULL) { |
if ((file_fd = fopen(file->fname, "r")) == NULL) |
if ((file_fd = fopen(file->fname, "r")) == NULL) |
continue; |
continue; |
|
|
if ((ch = getc(file_fd)) != EOF) { |
if ((ch = getc(file_fd)) != EOF) { |
/* |
/* |
* This next file has content, therefore current |
* This next file has content, therefore current |
* file doesn't contains the last line. |
* file doesn't contains the last line. |
*/ |
*/ |
ungetc(ch, file_fd); |
ungetc(ch, file_fd); |
fclose(file_fd); |
fclose(file_fd); |
return (1); |
return (1); |
} |
} |
|
fclose(file_fd); |
fclose(file_fd); |
} |
} |
return (0); |
|
|
return (0); |
|
} |
} |
|
|
int |
int |