diff options
author | Sami Kerola | 2011-04-30 13:06:20 +0200 |
---|---|---|
committer | Karel Zak | 2011-05-17 15:56:22 +0200 |
commit | cdbe31fc6a378ec073268118efde30049a56f831 (patch) | |
tree | bf084870462f1c432a1b2b4ca2877efbe3b99bc2 /text-utils | |
parent | agetty: don't use xalloc.h stuff (diff) | |
download | kernel-qcow2-util-linux-cdbe31fc6a378ec073268118efde30049a56f831.tar.gz kernel-qcow2-util-linux-cdbe31fc6a378ec073268118efde30049a56f831.tar.xz kernel-qcow2-util-linux-cdbe31fc6a378ec073268118efde30049a56f831.zip |
ul.c: convert definition to function
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'text-utils')
-rw-r--r-- | text-utils/ul.c | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/text-utils/ul.c b/text-utils/ul.c index dc0550cc0..1c4bd7f0b 100644 --- a/text-utils/ul.c +++ b/text-utils/ul.c @@ -80,6 +80,7 @@ void setmode(int newmode); static void setcol(int newcol); static void needcol(int col); static void sig_handler(int signo); +static void print_out(char *line); #define IESC '\033' #define SO '\016' @@ -115,8 +116,6 @@ int halfpos; int upln; int iflag; -#define PRINT(s) if (s == NULL) /* void */; else putwp(s) - int main(int argc, char **argv) { int c, ret; @@ -327,7 +326,7 @@ void flushln(void) } if (obuf[i].c_char == '\0') { if (upln) { - PRINT(CURS_RIGHT); + print_out(CURS_RIGHT); } else outc(' ', 1); } else @@ -452,8 +451,8 @@ void reverse(void) { upln++; fwd(); - PRINT(CURS_UP); - PRINT(CURS_UP); + print_out(CURS_UP); + print_out(CURS_UP); upln++; } @@ -510,9 +509,9 @@ outc(wint_t c, int width) { putwchar(c); if (must_use_uc && (curmode&UNDERL)) { for (i=0; i<width; i++) - PRINT(CURS_LEFT); + print_out(CURS_LEFT); for (i=0; i<width; i++) - PRINT(UNDER_CHAR); + print_out(UNDER_CHAR); } } @@ -527,40 +526,40 @@ void setmode(int newmode) case NORMAL: break; case UNDERL: - PRINT(EXIT_UNDERLINE); + print_out(EXIT_UNDERLINE); break; default: /* This includes standout */ - PRINT(EXIT_ATTRIBUTES); + print_out(EXIT_ATTRIBUTES); break; } break; case ALTSET: - PRINT(ENTER_REVERSE); + print_out(ENTER_REVERSE); break; case SUPERSC: /* * This only works on a few terminals. * It should be fixed. */ - PRINT(ENTER_UNDERLINE); - PRINT(ENTER_DIM); + print_out(ENTER_UNDERLINE); + print_out(ENTER_DIM); break; case SUBSC: - PRINT(ENTER_DIM); + print_out(ENTER_DIM); break; case UNDERL: - PRINT(ENTER_UNDERLINE); + print_out(ENTER_UNDERLINE); break; case BOLD: - PRINT(ENTER_BOLD); + print_out(ENTER_BOLD); break; default: /* * We should have some provision here for multiple modes * on at once. This will have to come later. */ - PRINT(ENTER_STANDOUT); + print_out(ENTER_STANDOUT); break; } } @@ -602,3 +601,10 @@ static void sig_handler(int signo) _exit(EXIT_SUCCESS); } +static void print_out(char *line) +{ + if (line == NULL) + return; + + putwp(line); +} |