#define DEFNUM 1000
#define MAXLINELEN (LINE_MAX + 1)
-static void c_columnate __P((void));
-static void input __P((FILE *));
-static void maketbl __P((void));
-static void print __P((void));
-static void r_columnate __P((void));
+static void c_columnate(void);
+static void input(FILE *);
+static void maketbl(void);
+static void print(void);
+static void r_columnate(void);
typedef struct _tbl {
wchar_t **list;
fprintf(out, _("\nFor more information see column(1).\n"));
exit(rc);
}
-int
-main(int argc, char **argv)
+
+int main(int argc, char **argv)
{
struct winsize win;
FILE *fp;
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- if (ioctl(1, TIOCGWINSZ, &win) == -1 || !win.ws_col) {
+ if (ioctl(STDIN_FILENO, TIOCGWINSZ, &win) == -1 || !win.ws_col) {
if ((p = getenv("COLUMNS")) != NULL)
termwidth = atoi(p);
} else
break;
default:
usage(EXIT_FAILURE);
- }
+ }
argc -= optind;
argv += optind;
if (!*argv)
input(stdin);
- else {
+ else
for (; *argv; ++argv) {
if ((fp = fopen(*argv, "r")) != NULL) {
input(fp);
eval = EXIT_FAILURE;
}
}
- }
if (!entries)
exit(eval);
exit(eval);
}
-static void
-c_columnate()
+static void c_columnate()
{
int chcnt, col, cnt, endcol, numcols;
wchar_t **lp;
putwchar('\n');
}
-static void
-r_columnate()
+static void r_columnate()
{
int base, chcnt, cnt, col, endcol, numcols, numrows, row;
}
}
-static void
-print()
+static void print()
{
int cnt;
wchar_t **lp;
}
}
-static void
-maketbl()
+static void maketbl()
{
TBL *t;
int coloff, cnt, i;
}
}
-static void
-input(fp)
- FILE *fp;
+static void input(FILE *fp)
{
static int maxentry = DEFNUM;
int len, lineno = 1, reportedline = 0;
if (!list)
list = xcalloc(maxentry, sizeof(wchar_t *));
while (fgetws(buf, MAXLINELEN, fp)) {
- for (p = buf; *p && iswspace(*p); ++p);
+ for (p = buf; *p && iswspace(*p); ++p)
+ ;
if (!*p)
continue;
if (!(p = wcschr(p, '\n')) && !feof(fp)) {