SCCS-vsn: usr.bin/column/column.1 5.3
SCCS-vsn: usr.bin/column/column.c 5.4
.\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
.\"
.\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
.\"
-.\" @(#)column.1 5.2 (Berkeley) %G%
+.\" @(#)column.1 5.3 (Berkeley) %G%
.\"
.UC 7
.TH COLUMN 1 ""
.\"
.UC 7
.TH COLUMN 1 ""
.SH NAME
column \- columnate lists
.SH SYNOPSIS
.SH NAME
column \- columnate lists
.SH SYNOPSIS
-\fBcolumn [ \fI-tx\fB ] [\fI-c columns\fB ] [ \fIfile ...\fB ]
+\fBcolumn [ \fI\-tx\fB ] [ \fI\-s sep\fB ] [\fI\-c columns\fB ] [ \fIfile ...\fB ]
.ft R
.SH DESCRIPTION
The
.ft R
.SH DESCRIPTION
The
+.I \-s
+Specify a set of characters to be used to delimit columns for the
-Use the whitespace in each line to determine the number of columns
-it contains and create a table.
+option.
+.TP
+.I \-t
+Determine the number of columns the input contains and create a table.
+Columns are delimited by whitespace, by default, or by the characters
+supplied using the
+.I \-s
+option.
Useful for pretty-printing displays, for example:
.sp
(printf "PERM LINKS OWNER SIZE MONTH DAY HH:MM/YEAR NAME\en";
Useful for pretty-printing displays, for example:
.sp
(printf "PERM LINKS OWNER SIZE MONTH DAY HH:MM/YEAR NAME\en";
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)column.c 5.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)column.c 5.4 (Berkeley) %G%";
#endif /* not lint */
#include <sys/types.h>
#endif /* not lint */
#include <sys/types.h>
int termwidth = 80; /* default terminal width */
int termwidth = 80; /* default terminal width */
-char **list; /* array of pointers to records */
int entries; /* number of records */
int eval; /* exit value */
int maxlength; /* longest record */
int entries; /* number of records */
int eval; /* exit value */
int maxlength; /* longest record */
+char **list; /* array of pointers to records */
+char *separator = "\t "; /* field separator for table option */
main(argc, argv)
int argc;
main(argc, argv)
int argc;
termwidth = win.ws_col;
xflag = 0;
termwidth = win.ws_col;
xflag = 0;
- while ((ch = getopt(argc, argv, "c:tx")) != EOF)
+ while ((ch = getopt(argc, argv, "c:s:tx")) != EOF)
switch(ch) {
case 'c':
termwidth = atoi(optarg);
break;
switch(ch) {
case 'c':
termwidth = atoi(optarg);
break;
+ case 's':
+ separator = optarg;
+ break;
case 't':
tflag = 1;
break;
case 't':
tflag = 1;
break;
cols = (char **)emalloc((maxcols = DEFCOLS) * sizeof(char *));
lens = (int *)emalloc(maxcols * sizeof(int));
for (cnt = 0, lp = list; cnt < entries; ++cnt, ++lp, ++t) {
cols = (char **)emalloc((maxcols = DEFCOLS) * sizeof(char *));
lens = (int *)emalloc(maxcols * sizeof(int));
for (cnt = 0, lp = list; cnt < entries; ++cnt, ++lp, ++t) {
- for (coloff = 0, p = *lp; cols[coloff] = strtok(p, "\t ");
+ for (coloff = 0, p = *lp; cols[coloff] = strtok(p, separator);
p = NULL)
if (++coloff == maxcols) {
if (!(cols = (char **)realloc((char *)cols,
p = NULL)
if (++coloff == maxcols) {
if (!(cols = (char **)realloc((char *)cols,