Changeset 22cf42d9 in mainline


Ignore:
Timestamp:
2011-08-20T22:58:14Z (13 years ago)
Author:
Martin Sucha <sucha14@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e406736
Parents:
f41682c
Message:

Add formatting library and display help message wrapped

Location:
uspace
Files:
3 added
6 edited

Legend:

Unmodified
Added
Removed
  • uspace/Makefile

    rf41682c r22cf42d9  
    162162        lib/block \
    163163        lib/clui \
     164        lib/fmtutil \
    164165        lib/scsi \
    165166        lib/softint \
  • uspace/Makefile.common

    rf41682c r22cf42d9  
    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

    rf41682c r22cf42d9  
    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

    rf41682c r22cf42d9  
    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/lib/c/generic/str.c

    rf41682c r22cf42d9  
    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

    rf41682c r22cf42d9  
    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.