Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset a6480d5 in mainline


Ignore:
Timestamp:
2011-08-21T11:44:59Z (10 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master
Children:
25c1b2c, bd5f3b7, d1e196f7
Parents:
c22531fc (diff), 1877128 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Martin Sucha <> (2011-08-21 11:44:59)
git-committer:
Martin Decky <martin@…> (2011-08-21 11:44:59)
Message:

merge Martin Sucha's fixes and improvements

Location:
uspace
Files:
3 added
10 edited
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/Makefile

    rc22531fc ra6480d5  
    163163        lib/block \
    164164        lib/clui \
     165        lib/fmtutil \
    165166        lib/scsi \
    166167        lib/softint \
  • uspace/Makefile.common

    rc22531fc ra6480d5  
    108108LIBIMGMAP_PREFIX = $(LIB_PREFIX)/imgmap
    109109LIBCLUI_PREFIX = $(LIB_PREFIX)/clui
     110LIBFMTUTIL_PREFIX = $(LIB_PREFIX)/fmtutil
    110111
    111112LIBEXT2_PREFIX = $(LIB_PREFIX)/ext2
  • uspace/app/bdsh/Makefile

    rc22531fc ra6480d5  
    2929
    3030USPACE_PREFIX = ../..
    31 LIBS = $(LIBBLOCK_PREFIX)/libblock.a $(LIBCLUI_PREFIX)/libclui.a
    32 EXTRA_CFLAGS = -I$(LIBBLOCK_PREFIX) -I$(LIBCLUI_PREFIX) -I. -Icmds/ \
    33         -Icmds/builtins -Icmds/modules
     31LIBS = $(LIBBLOCK_PREFIX)/libblock.a $(LIBCLUI_PREFIX)/libclui.a \
     32        $(LIBFMTUTIL_PREFIX)/libfmtutil.a
     33EXTRA_CFLAGS = -I$(LIBBLOCK_PREFIX) -I$(LIBCLUI_PREFIX) -I$(LIBFMTUTIL_PREFIX)\
     34        -I. -Icmds/ -Icmds/builtins -Icmds/modules
    3435BINARY = bdsh
    3536
  • uspace/app/bdsh/cmds/modules/help/help.c

    rc22531fc ra6480d5  
    11/*
    22 * Copyright (c) 2008 Tim Post
     3 * Copyright (c) 2011 Martin Sucha
    34 * All rights reserved.
    45 *
     
    3031#include <stdlib.h>
    3132#include <str.h>
     33#include <fmtutil.h>
    3234
    3335#include "config.h"
     
    128130static void help_survival(void)
    129131{
    130         printf("Don't panic!\n\n");
    131 
    132         printf("This is Bdsh, the Brain dead shell, currently "
     132        print_wrapped_console(
     133            "Don't panic!\n\n"
     134
     135            "This is Bdsh, the Brain dead shell, currently "
    133136            "the primary user interface to HelenOS. Bdsh allows you to enter "
    134137            "commands and supports history (Up, Down arrow keys), "
    135138            "line editing (Left Arrow, Right Arrow, Home, End, Backspace), "
    136139            "selection (Shift + movement keys), copy and paste (Ctrl-C, "
    137             "Ctrl-V), similar to common desktop environments.\n\n");
    138 
    139         printf("The most basic filesystem commands are Bdsh builtins. Type "
     140            "Ctrl-V), similar to common desktop environments.\n\n"
     141
     142            "The most basic filesystem commands are Bdsh builtins. Type "
    140143            "'help commands' [Enter] to see the list of Bdsh builtin commands. "
    141144            "Other commands are external executables located in the /app and "
    142145            "/srv directories. Type 'ls /app' [Enter] and 'ls /srv' [Enter] "
    143146            "to see their list. You can execute an external command simply "
    144             "by entering its name (e.g. type 'tetris' [Enter]).\n\n");
    145 
    146         printf("HelenOS has virtual consoles (VCs). You can switch between "
    147             "these using the F1-F11 keys.\n\n");
    148 
    149         printf("This is but a small glimpse of what you can do with HelenOS. "
     147            "by entering its name (e.g. type 'tetris' [Enter]).\n\n"
     148
     149            "HelenOS has virtual consoles (VCs). You can switch between "
     150            "these using the F1-F11 keys.\n\n"
     151
     152            "This is but a small glimpse of what you can do with HelenOS. "
    150153            "To learn more please point your browser to the HelenOS User's "
    151             "Guide: http://trac.helenos.org/trac.fcgi/wiki/UsersGuide\n\n");
     154            "Guide: http://trac.helenos.org/trac.fcgi/wiki/UsersGuide\n\n",
     155            ALIGN_LEFT);
    152156}
    153157
  • uspace/app/bdsh/compl.c

    rc22531fc ra6480d5  
    9999        tokenizer_t tok;
    100100        token_t tokens[WORD_MAX];
    101         unsigned int current_token;
     101        int current_token;
    102102        size_t tokens_length;
    103103
     
    127127       
    128128        /* Find the current token */
    129         for (current_token = 0; current_token < tokens_length; current_token++) {
     129        for (current_token = 0; current_token < (int) tokens_length;
     130            current_token++) {
    130131                token_t *t = &tokens[current_token];
    131132                size_t end = t->char_start + t->char_length;
     
    137138                }
    138139        }
    139        
    140         if (tokens[current_token].type != TOKTYPE_SPACE) {
     140        if (tokens_length == 0) current_token = -1;
     141       
     142        if (current_token >= 0 && tokens[current_token].type != TOKTYPE_SPACE) {
    141143                *cstart = tokens[current_token].char_start;
    142144        }
     
    154156                goto error;
    155157        }
    156 
    157         str_ncpy(prefix, pref_size + 1, stext +
    158             tokens[current_token].byte_start, pref_size);
     158        prefix[pref_size] = 0;
     159
     160        if (current_token >= 0) {
     161                str_ncpy(prefix, pref_size + 1, stext +
     162                    tokens[current_token].byte_start, pref_size);
     163        }
    159164
    160165        /*
     
    166171        /* Skip any whitespace before current token */
    167172        int prev_token = current_token - 1;
    168         if (prev_token != -1 && tokens[prev_token].type == TOKTYPE_SPACE) {
     173        if (prev_token >= 0 && tokens[prev_token].type == TOKTYPE_SPACE) {
    169174                prev_token--;
    170175        }
     
    174179         * follows a pipe token.
    175180         */
    176         if (prev_token == -1 || tokens[prev_token].type == TOKTYPE_SPACE)
     181        if (prev_token < 0 || tokens[prev_token].type == TOKTYPE_SPACE)
    177182                cs->is_command = true;
    178183        else
  • uspace/app/bdsh/input.c

    rc22531fc ra6480d5  
    6868{
    6969        char *cmd[WORD_MAX];
    70         token_t tokens_space[WORD_MAX];
    71         token_t *tokens = tokens_space;
     70        token_t *tokens = calloc(WORD_MAX, sizeof(token_t));
     71        if (tokens == NULL)
     72                return ENOMEM;
    7273        int rc = 0;
    7374        tokenizer_t tok;
     
    7778        char *redir_to = NULL;
    7879
    79         if (NULL == usr->line)
     80        if (NULL == usr->line) {
     81                free(tokens);
    8082                return CL_EFAIL;
     83        }
    8184
    8285        rc = tok_init(&tok, usr->line, tokens, WORD_MAX);
     
    209212        }
    210213        tok_fini(&tok);
     214        free(tokens);
    211215
    212216        return rc;
  • uspace/app/tester/stdio/stdio1.c

    rc22531fc ra6480d5  
    3939{
    4040        FILE *file;
    41         const char *file_name = "/readme";
     41        const char *file_name = "/textdemo";
    4242       
    4343        TPRINTF("Open file \"%s\"...", file_name);
  • uspace/dist/src/sysel/demos/htxtfile.sy

    rc22531fc ra6480d5  
    3535                var out_file : TextFile;
    3636
    37                 name = "/readme";
     37                name = "/textdemo";
    3838
    3939                in_file = new TextFile();
  • uspace/lib/c/generic/str.c

    rc22531fc ra6480d5  
    22 * Copyright (c) 2005 Martin Decky
    33 * Copyright (c) 2008 Jiri Svoboda
     4 * Copyright (c) 2011 Martin Sucha
    45 * All rights reserved.
    56 *
     
    718719
    719720        dest[dlen - 1] = '\0';
     721}
     722
     723/** Convert string to wide string.
     724 *
     725 * Convert string @a src to wide string. A new wide NULL-terminated
     726 * string will be allocated on the heap.
     727 *
     728 * @param src   Source string.
     729 */
     730wchar_t *str_to_awstr(const char *str)
     731{
     732        size_t len = str_length(str);
     733        wchar_t *wstr = calloc(len+1, sizeof(wchar_t));
     734        if (wstr == NULL) {
     735                return NULL;
     736        }
     737        str_to_wstr(wstr, len+1, str);
     738        return wstr;
    720739}
    721740
  • uspace/lib/c/include/str.h

    rc22531fc ra6480d5  
    8383extern char *wstr_to_astr(const wchar_t *src);
    8484extern void str_to_wstr(wchar_t *dest, size_t dlen, const char *src);
     85extern wchar_t *str_to_awstr(const char *src);
    8586
    8687extern char *str_chr(const char *str, wchar_t ch);
Note: See TracChangeset for help on using the changeset viewer.