Ignore:
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>
    32 * Copyright (c) 2011, Martin Sucha
    43 * All rights reserved.
    54 *
    65 * 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.
    2830 */
    2931
     
    6264static sysarg_t console_rows = 0;
    6365static bool should_quit = false;
    64 
    65 static console_ctrl_t *console = NULL;
    6666
    6767static struct option const long_options[] = {
     
    102102static void waitprompt()
    103103{
    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);
    107106        printf("ENTER/SPACE/PAGE DOWN - next page, "
    108107               "ESC/Q - quit, C - continue unpaged");
    109108        fflush(stdout);
    110        
    111         console_set_style(console, STYLE_NORMAL);
     109        console_set_style(fphone(stdout), STYLE_NORMAL);
    112110}
    113111
    114112static void waitkey()
    115113{
    116         kbd_event_t ev;
     114        console_event_t ev;
    117115       
    118116        while (true) {
    119                 if (!console_get_kbd_event(console, &ev)) {
     117                if (!console_get_event(fphone(stdin), &ev)) {
    120118                        return;
    121119                }
     
    140138static void newpage()
    141139{
    142         console_clear(console);
     140        console_clear(fphone(stdout));
    143141        chars_remaining = console_cols;
    144         lines_remaining = console_rows - 1;
     142        lines_remaining = console_rows-1;
    145143}
    146144
     
    240238        console_rows = 0;
    241239        should_quit = false;
    242         console = console_init(stdin, stdout);
    243240
    244241        argc = cli_count_args(argv);
     
    283280       
    284281        if (more) {
    285                 rc = console_get_size(console, &cols, &rows);
     282                rc = console_get_size(fphone(stdout), &cols, &rows);
    286283                if (rc != EOK) {
    287284                        printf("%s - cannot get console size\n", cmdname);
Note: See TracChangeset for help on using the changeset viewer.