=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ul/ul.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- src/usr.bin/ul/ul.c 2014/11/18 20:54:28 1.16 +++ src/usr.bin/ul/ul.c 2015/02/06 09:19:16 1.17 @@ -1,4 +1,4 @@ -/* $OpenBSD: ul.c,v 1.16 2014/11/18 20:54:28 krw Exp $ */ +/* $OpenBSD: ul.c,v 1.17 2015/02/06 09:19:16 tedu Exp $ */ /* $NetBSD: ul.c,v 1.3 1994/12/07 00:28:24 jtc Exp $ */ /* @@ -101,9 +101,8 @@ termtype = getenv("TERM"); if (termtype == NULL || (argv[0][0] == 'c' && !isatty(1))) termtype = "lpr"; - while ((c=getopt(argc, argv, "it:T:")) != -1) - switch(c) { - + while ((c = getopt(argc, argv, "it:T:")) != -1) + switch (c) { case 't': case 'T': /* for nroff compatibility */ termtype = optarg; @@ -119,15 +118,12 @@ exit(1); } - switch(tgetent(termcap, termtype)) { - + switch (tgetent(termcap, termtype)) { case 1: break; - default: warnx("trouble reading termcap"); /* FALLTHROUGH */ - case 0: /* No such terminal type - assume dumb */ (void)strlcpy(termcap, "dumb:os:col#80:cr=^M:sf=^J:am:", @@ -135,9 +131,9 @@ break; } initcap(); - if ( (tgetflag("os") && ENTER_BOLD==NULL ) || - (tgetflag("ul") && ENTER_UNDERLINE==NULL && UNDER_CHAR==NULL)) - must_overstrike = 1; + if ((tgetflag("os") && ENTER_BOLD == NULL ) || + (tgetflag("ul") && ENTER_UNDERLINE == NULL && UNDER_CHAR == NULL)) + must_overstrike = 1; initbuf(); if (optind == argc) mfilter(stdin); @@ -158,33 +154,26 @@ int c; while ((c = getc(f)) != EOF && col < MAXBUF) switch(c) { - case '\b': if (col > 0) col--; continue; - case '\t': col = (col+8) & ~07; if (col > maxcol) maxcol = col; continue; - case '\r': col = 0; continue; - case SO: mode |= ALTSET; continue; - case SI: mode &= ~ALTSET; continue; - case IESC: switch (c = getc(f)) { - case HREV: if (halfpos == 0) { mode |= SUPERSC; @@ -197,7 +186,6 @@ reverse(); } continue; - case HFWD: if (halfpos == 0) { mode |= SUBSC; @@ -210,11 +198,9 @@ fwd(); } continue; - case FREV: reverse(); continue; - default: errx(1, "0%o: unknown escape sequence", c); /* NOTREACHED */ @@ -232,16 +218,13 @@ if (col > maxcol) maxcol = col; continue; - case '\n': flushln(); continue; - case '\f': flushln(); putchar('\f'); continue; - default: if (c < ' ') /* non printing */ continue; @@ -271,7 +254,7 @@ int hadmodes = 0; lastmode = NORMAL; - for (i=0; i