BSD 4 release
[unix-history] / usr / src / cmd / col.c
index a26ac03..9ab0ba3 100644 (file)
@@ -1,5 +1,5 @@
+static char *sccsid = "@(#)col.c       4.1 (Berkeley) 10/1/80";
 # include <stdio.h>
 # include <stdio.h>
-
 # define PL 256
 # define ESC '\033'
 # define RLF '\013'
 # define PL 256
 # define ESC '\033'
 # define RLF '\013'
 
 char *page[PL];
 char lbuff [LINELN], *line;
 
 char *page[PL];
 char lbuff [LINELN], *line;
-int bflag, xflag, fflag;
+int bflag, hflag, fflag;
 int half;
 int cp, lp;
 int ll, llh, mustwr;
 int pcp = 0;
 char *pgmname;
 int half;
 int cp, lp;
 int ll, llh, mustwr;
 int pcp = 0;
 char *pgmname;
-char *strcpy();
+char   *strcpy();
 
 main (argc, argv)
        int argc; char **argv;
 
 main (argc, argv)
        int argc; char **argv;
@@ -42,8 +42,8 @@ main (argc, argv)
                                bflag++;
                                break;
 
                                bflag++;
                                break;
 
-                       case 'x':
-                               xflag++;
+                       case 'h':
+                               hflag++;
                                break;
 
                        case 'f':
                                break;
 
                        case 'f':
@@ -156,7 +156,7 @@ main (argc, argv)
                if (page[(mustwr+i)%PL] != 0)
                        emit (page[(mustwr+i) % PL], mustwr+i-PL);
        emit (" ", (llh + 1) & -2);
                if (page[(mustwr+i)%PL] != 0)
                        emit (page[(mustwr+i) % PL], mustwr+i-PL);
        emit (" ", (llh + 1) & -2);
-       return 0;
+       exit(0);
 }
 
 outc (c)
 }
 
 outc (c)
@@ -243,10 +243,6 @@ emit (s, lineno)
        static int gflag = 0;
 
        if (*s) {
        static int gflag = 0;
 
        if (*s) {
-               if (gflag) {
-                       putchar (SI);
-                       gflag = 0;
-               }
                while (cline < lineno - 1) {
                        putchar ('\n');
                        pcp = 0;
                while (cline < lineno - 1) {
                        putchar ('\n');
                        pcp = 0;
@@ -264,7 +260,7 @@ emit (s, lineno)
                while (*p) {
                        ncp = pcp;
                        while (*p++ == ' ') {
                while (*p) {
                        ncp = pcp;
                        while (*p++ == ' ') {
-                               if ((++ncp & 7) == 0 && !xflag) {
+                               if ((++ncp & 7) == 0 && hflag) {
                                        pcp = ncp;
                                        putchar ('\t');
                                }
                                        pcp = ncp;
                                        putchar ('\t');
                                }