Changes in uspace/app/bdsh/cmds/modules/cat/cat.c [36ab7c7:28a3e74] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/modules/cat/cat.c
r36ab7c7 r28a3e74 1 /* 2 * Copyright (c) 2008 Tim Post 1 /* Copyright (c) 2008, Tim Post <tinkertim@gmail.com> 3 2 * Copyright (c) 2011, Martin Sucha 4 3 * All rights reserved. 5 4 * 6 5 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 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. 17 * 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. 6 * modification, are permitted provided that the following conditions are met: 7 * 8 * Redistributions of source code must retain the above copyright notice, this 9 * list of conditions and the following disclaimer. 10 * 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. 28 30 */ 29 31 … … 62 64 static sysarg_t console_rows = 0; 63 65 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(console, 0, console_rows-1); 105 console_set_color(console, COLOR_BLUE, COLOR_WHITE, 0); 106 104 console_set_pos(fphone(stdout), 0, console_rows-1); 105 console_set_color(fphone(stdout), COLOR_BLUE, COLOR_WHITE, 0); 107 106 printf("ENTER/SPACE/PAGE DOWN - next page, " 108 107 "ESC/Q - quit, C - continue unpaged"); 109 108 fflush(stdout); 110 111 console_set_style(console, STYLE_NORMAL); 109 console_set_style(fphone(stdout), STYLE_NORMAL); 112 110 } 113 111 114 112 static void waitkey() 115 113 { 116 kbd_event_t ev;114 console_event_t ev; 117 115 118 116 while (true) { 119 if (!console_get_ kbd_event(console, &ev)) {117 if (!console_get_event(fphone(stdin), &ev)) { 120 118 return; 121 119 } … … 140 138 static void newpage() 141 139 { 142 console_clear( console);140 console_clear(fphone(stdout)); 143 141 chars_remaining = console_cols; 144 lines_remaining = console_rows -1;142 lines_remaining = console_rows-1; 145 143 } 146 144 … … 240 238 console_rows = 0; 241 239 should_quit = false; 242 console = console_init(stdin, stdout);243 240 244 241 argc = cli_count_args(argv); … … 283 280 284 281 if (more) { 285 rc = console_get_size( console, &cols, &rows);282 rc = console_get_size(fphone(stdout), &cols, &rows); 286 283 if (rc != EOK) { 287 284 printf("%s - cannot get console size\n", cmdname);
Note:
See TracChangeset
for help on using the changeset viewer.