Changes in uspace/app/bdsh/cmds/modules/cat/cat.c [28a3e74:36ab7c7] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/modules/cat/cat.c
r28a3e74 r36ab7c7 1 /* Copyright (c) 2008, Tim Post <tinkertim@gmail.com> 1 /* 2 * Copyright (c) 2008 Tim Post 2 3 * Copyright (c) 2011, Martin Sucha 3 4 * All rights reserved. 4 5 * 5 6 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are met: 7 * modification, are permitted provided that the following conditions 8 * are met: 7 9 * 8 * Redistributions of source code must retain the above copyright notice, this 9 * list of conditions and the following disclaimer. 10 * - Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * - Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * - The name of the author may not be used to endorse or promote products 16 * derived from this software without specific prior written permission. 10 17 * 11 * Redistributions in binary form must reproduce the above copyright notice, 12 * this list of conditions and the following disclaimer in the documentation 13 * and/or other materials provided with the distribution. 14 * 15 * Neither the name of the original program's authors nor the names of its 16 * contributors may be used to endorse or promote products derived from this 17 * software without specific prior written permission. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 * POSSIBILITY OF SUCH DAMAGE. 18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 28 */ 31 29 … … 64 62 static sysarg_t console_rows = 0; 65 63 static bool should_quit = false; 64 65 static console_ctrl_t *console = NULL; 66 66 67 67 static struct option const long_options[] = { … … 102 102 static void waitprompt() 103 103 { 104 console_set_pos(fphone(stdout), 0, console_rows-1); 105 console_set_color(fphone(stdout), COLOR_BLUE, COLOR_WHITE, 0); 104 console_set_pos(console, 0, console_rows-1); 105 console_set_color(console, COLOR_BLUE, COLOR_WHITE, 0); 106 106 107 printf("ENTER/SPACE/PAGE DOWN - next page, " 107 108 "ESC/Q - quit, C - continue unpaged"); 108 109 fflush(stdout); 109 console_set_style(fphone(stdout), STYLE_NORMAL); 110 111 console_set_style(console, STYLE_NORMAL); 110 112 } 111 113 112 114 static void waitkey() 113 115 { 114 console_event_t ev;116 kbd_event_t ev; 115 117 116 118 while (true) { 117 if (!console_get_ event(fphone(stdin), &ev)) {119 if (!console_get_kbd_event(console, &ev)) { 118 120 return; 119 121 } … … 138 140 static void newpage() 139 141 { 140 console_clear( fphone(stdout));142 console_clear(console); 141 143 chars_remaining = console_cols; 142 lines_remaining = console_rows -1;144 lines_remaining = console_rows - 1; 143 145 } 144 146 … … 238 240 console_rows = 0; 239 241 should_quit = false; 242 console = console_init(stdin, stdout); 240 243 241 244 argc = cli_count_args(argv); … … 280 283 281 284 if (more) { 282 rc = console_get_size( fphone(stdout), &cols, &rows);285 rc = console_get_size(console, &cols, &rows); 283 286 if (rc != EOK) { 284 287 printf("%s - cannot get console size\n", cmdname);
Note:
See TracChangeset
for help on using the changeset viewer.