version 1.23, 2015/07/19 06:14:23 |
version 1.24, 2015/07/19 17:21:21 |
|
|
*/ |
*/ |
|
|
#include <sys/types.h> |
#include <sys/types.h> |
|
#include <sys/ioctl.h> |
#include <sys/stat.h> |
#include <sys/stat.h> |
|
|
#include <ctype.h> |
#include <ctype.h> |
|
|
static void add_file(char *); |
static void add_file(char *); |
static int next_files_have_lines(void); |
static int next_files_have_lines(void); |
|
|
|
int termwidth; |
|
|
int |
int |
main(int argc, char *argv[]) |
main(int argc, char *argv[]) |
{ |
{ |
|
struct winsize win; |
int c, fflag; |
int c, fflag; |
|
char *p; |
|
|
fflag = 0; |
fflag = 0; |
inplace = NULL; |
inplace = NULL; |
|
|
} |
} |
argc -= optind; |
argc -= optind; |
argv += optind; |
argv += optind; |
|
|
|
if ((p = getenv("COLUMNS"))) |
|
termwidth = strtonum(p, 0, INT_MAX, NULL); |
|
if (termwidth == 0 && |
|
ioctl(STDOUT_FILENO, TIOCGWINSZ, &win) == 0 && |
|
win.ws_col > 0) |
|
termwidth = win.ws_col; |
|
if (termwidth == 0) |
|
termwidth = 60; |
|
|
/* First usage case; script is the first arg */ |
/* First usage case; script is the first arg */ |
if (!eflag && !fflag && *argv) { |
if (!eflag && !fflag && *argv) { |