|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T m
Length: 1238 (0x4d6) Types: TextFile Names: »maketrix.c«
└─⟦87ddcff64⟧ Bits:30001253 CPHDIST85 Tape, 1985 Autumn Conference Copenhagen └─⟦this⟧ »cph85dist/stat/src/maketrix.c«
#include "unixstat.h" PGM(maketrix,Make A Matrix,5.0,2/27/85) /* Copyright (c) 1982 Gary Perlman (see Copyright file) */ main (argc, argv) char **argv; { ARGV0; initial (argc, argv); checkstdin (Argv0); maketrix (stdin); exit (0); } /* OPTIONS */ int Ncols = 2; int Silent = 0; #define OPTSTRING "s" initial (argc, argv) char **argv; { extern char *optarg; extern int optind; int errflg = 0; int C; while ((C = getopt (argc, argv, OPTSTRING)) != EOF) switch (C) { case 's': Silent = 1; break; default: errflg++; break; } if (optind < argc) { if (optind < argc-1) /* too many args; some will be ignored */ errflg++; if (!number (argv[optind])) ERRNUM (argv[optind],number of columns); Ncols = atoi (argv[optind]); if (Ncols < 1) ERRMSG0 (Number of columns must be positive) } if (errflg) USAGE ([-s] [ncols]) } maketrix (ioptr) FILE *ioptr; { char string[BUFSIZ]; int nstrings = 0; while (getword (string, ioptr)) { fputs (string, stdout); if (++nstrings == Ncols) { putchar ('\n'); nstrings = 0; } else putchar ('\t'); } if (nstrings != 0) { putchar ('\n'); if (!Silent) WARNING (last line does not have expected number of columns) } }