From 6bfd550f38d0718d2fcb960879a171e163f3b9fd Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Fri, 29 May 2009 15:10:26 -0700 Subject: [PATCH] Run Nindent on com32/lib/sys/vesacon_write.c Automatically reformat com32/lib/sys/vesacon_write.c using Nindent. Do this for all files except HDT, gPXE and externally maintained libraries (zlib, tinyjpeg, libpng). Signed-off-by: H. Peter Anvin --- com32/lib/sys/vesacon_write.c | 121 +++++++++++++++++++++--------------------- 1 file changed, 60 insertions(+), 61 deletions(-) diff --git a/com32/lib/sys/vesacon_write.c b/com32/lib/sys/vesacon_write.c index 7ca25ac..f0fc845 100644 --- a/com32/lib/sys/vesacon_write.c +++ b/com32/lib/sys/vesacon_write.c @@ -52,21 +52,20 @@ static void vesacon_scroll_up(const struct term_state *); static struct term_state ts; static struct ansi_ops op = { - .erase = vesacon_erase, - .write_char = vesacon_write_char, - .showcursor = vesacon_showcursor, - .set_cursor = __vesacon_set_cursor, /* in drawtxt.c */ - .scroll_up = vesacon_scroll_up, - .beep = __ansicon_beep, + .erase = vesacon_erase, + .write_char = vesacon_write_char, + .showcursor = vesacon_showcursor, + .set_cursor = __vesacon_set_cursor, /* in drawtxt.c */ + .scroll_up = vesacon_scroll_up, + .beep = __ansicon_beep, }; -static struct term_info ti = - { - .cols = TEXT_PIXEL_COLS/FONT_WIDTH, +static struct term_info ti = { + .cols = TEXT_PIXEL_COLS / FONT_WIDTH, .disabled = 0, .ts = &ts, .op = &op - }; +}; /* Reference counter to the screen, to keep track of if we need reinitialization. */ @@ -75,97 +74,97 @@ static int vesacon_counter = 0; /* Common setup */ int __vesacon_open(struct file_info *fp) { - (void)fp; - - if (!vesacon_counter) { - /* Are we disabled? */ - if (syslinux_serial_console_info()->flowctl & 0x8000) { - ti.disabled = 1; - ti.rows = 25; - ti.cols = 80; - } else { - /* Switch mode */ - if (__vesacon_init()) { - vesacon_counter = -1; + (void)fp; + + if (!vesacon_counter) { + /* Are we disabled? */ + if (syslinux_serial_console_info()->flowctl & 0x8000) { + ti.disabled = 1; + ti.rows = 25; + ti.cols = 80; + } else { + /* Switch mode */ + if (__vesacon_init()) { + vesacon_counter = -1; + return EAGAIN; + } + + /* Initial state */ + __ansi_init(&ti); + ti.rows = __vesacon_text_rows; + } + } else if (vesacon_counter == -1) { return EAGAIN; - } - - /* Initial state */ - __ansi_init(&ti); - ti.rows = __vesacon_text_rows; } - } else if (vesacon_counter == -1) { - return EAGAIN; - } - fp->o.rows = ti.rows; - fp->o.cols = ti.cols; + fp->o.rows = ti.rows; + fp->o.cols = ti.cols; - vesacon_counter++; - return 0; + vesacon_counter++; + return 0; } int __vesacon_close(struct file_info *fp) { - (void)fp; + (void)fp; - vesacon_counter--; - return 0; + vesacon_counter--; + return 0; } /* Erase a region of the screen */ static void vesacon_erase(const struct term_state *st, int x0, int y0, int x1, int y1) { - __vesacon_erase(x0, y0, x1, y1, st->cindex); + __vesacon_erase(x0, y0, x1, y1, st->cindex); } /* Draw text on the screen */ static void vesacon_write_char(int x, int y, uint8_t ch, const struct term_state *st) { - __vesacon_write_char(x, y, ch, st->cindex); + __vesacon_write_char(x, y, ch, st->cindex); } /* Show or hide the cursor */ static void vesacon_showcursor(const struct term_state *st) { - __vesacon_set_cursor(st->xy.x, st->xy.y, st->cursor); + __vesacon_set_cursor(st->xy.x, st->xy.y, st->cursor); } static void vesacon_scroll_up(const struct term_state *st) { - __vesacon_scroll_up(1, st->cindex); + __vesacon_scroll_up(1, st->cindex); } ssize_t __vesacon_write(struct file_info *fp, const void *buf, size_t count) { - const unsigned char *bufp = buf; - size_t n = 0; + const unsigned char *bufp = buf; + size_t n = 0; - (void)fp; + (void)fp; - if ( ti.disabled ) - return count; /* Nothing to do */ + if (ti.disabled) + return count; /* Nothing to do */ - /* This only updates the shadow text buffer... */ - while ( count-- ) { - __ansi_putchar(&ti, *bufp++); - n++; - } + /* This only updates the shadow text buffer... */ + while (count--) { + __ansi_putchar(&ti, *bufp++); + n++; + } - /* This actually draws it */ - __vesacon_doit(); + /* This actually draws it */ + __vesacon_doit(); - return n; + return n; } const struct output_dev dev_vesacon_w = { - .dev_magic = __DEV_MAGIC, - .flags = __DEV_TTY | __DEV_OUTPUT, - .fileflags = O_WRONLY | O_CREAT | O_TRUNC | O_APPEND, - .write = __vesacon_write, - .close = __vesacon_close, - .open = __vesacon_open, - .fallback = &dev_ansicon_w, + .dev_magic = __DEV_MAGIC, + .flags = __DEV_TTY | __DEV_OUTPUT, + .fileflags = O_WRONLY | O_CREAT | O_TRUNC | O_APPEND, + .write = __vesacon_write, + .close = __vesacon_close, + .open = __vesacon_open, + .fallback = &dev_ansicon_w, }; -- 2.7.4