Changeset 925a21e in mainline for uspace/app/bdsh/cmds


Ignore:
Timestamp:
2011-09-24T14:20:29Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5bf76c1
Parents:
867e2555 (diff), 1ab4aca (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.
Message:

Merge mainline changes.

Location:
uspace/app/bdsh/cmds
Files:
4 added
6 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/cmds/builtins/builtins.h

    r867e2555 r925a21e  
    44#include "config.h"
    55
     6#include "batch/entry.h"
    67#include "cd/entry.h"
    78#include "exit/entry.h"
    89
    910builtin_t builtins[] = {
     11#include "batch/batch_def.h"
    1012#include "cd/cd_def.h"
    1113#include "exit/exit_def.h"
  • uspace/app/bdsh/cmds/modules/bdd/bdd.c

    r867e2555 r925a21e  
    3939
    4040#include <libblock.h>
    41 #include <devmap.h>
     41#include <loc.h>
    4242#include <errno.h>
    4343#include <assert.h>
     
    6969        unsigned int argc;
    7070        unsigned int i, j;
    71         devmap_handle_t handle;
     71        service_id_t service_id;
    7272        aoff64_t offset;
    7373        uint8_t *blk;
     
    9696                size = 256;
    9797
    98         rc = devmap_device_get_handle(argv[1], &handle, 0);
     98        rc = loc_service_get_id(argv[1], &service_id, 0);
    9999        if (rc != EOK) {
    100100                printf("%s: Error resolving device `%s'.\n", cmdname, argv[1]);
     
    102102        }
    103103
    104         rc = block_init(EXCHANGE_SERIALIZE, handle, 2048);
     104        rc = block_init(EXCHANGE_SERIALIZE, service_id, 2048);
    105105        if (rc != EOK)  {
    106106                printf("%s: Error initializing libblock.\n", cmdname);
     
    108108        }
    109109
    110         rc = block_get_bsize(handle, &block_size);
     110        rc = block_get_bsize(service_id, &block_size);
    111111        if (rc != EOK) {
    112112                printf("%s: Error determining device block size.\n", cmdname);
     
    117117        if (blk == NULL) {
    118118                printf("%s: Error allocating memory.\n", cmdname);
    119                 block_fini(handle);
     119                block_fini(service_id);
    120120                return CMD_FAILURE;
    121121        }
     
    124124
    125125        while (size > 0) {
    126                 rc = block_read_direct(handle, ba, 1, blk);
     126                rc = block_read_direct(service_id, ba, 1, blk);
    127127                if (rc != EOK) {
    128128                        printf("%s: Error reading block %" PRIuOFF64 "\n", cmdname, ba);
    129129                        free(blk);
    130                         block_fini(handle);
     130                        block_fini(service_id);
    131131                        return CMD_FAILURE;
    132132                }
     
    170170
    171171        free(blk);
    172         block_fini(handle);
     172        block_fini(service_id);
    173173
    174174        return CMD_SUCCESS;
  • uspace/app/bdsh/cmds/modules/cat/cat.c

    r867e2555 r925a21e  
    103103{
    104104        console_set_pos(console, 0, console_rows-1);
    105         console_set_color(console, COLOR_BLUE, COLOR_WHITE, 0);
     105        console_set_color(console, COLOR_WHITE, COLOR_BLUE, 0);
    106106       
    107107        printf("ENTER/SPACE/PAGE DOWN - next page, "
  • uspace/app/bdsh/cmds/modules/help/help.c

    r867e2555 r925a21e  
    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/wiki/UsersGuide\n\n",
     155            ALIGN_LEFT);
    152156}
    153157
  • uspace/app/bdsh/cmds/modules/mount/mount.c

    r867e2555 r925a21e  
    4343static struct option const long_options[] = {
    4444        { "help", no_argument, 0, 'h' },
     45        { "instance", required_argument, 0, 'i' },
    4546        { 0, 0, 0, 0 }
    4647};
     
    6869        const char *dev = "";
    6970        int rc, c, opt_ind;
     71        unsigned int instance = 0;
     72        bool instance_set = false;
     73        char **t_argv;
    7074
    7175        argc = cli_count_args(argv);
    7276
    7377        for (c = 0, optind = 0, opt_ind = 0; c != -1;) {
    74                 c = getopt_long(argc, argv, "h", long_options, &opt_ind);
     78                c = getopt_long(argc, argv, "i:h", long_options, &opt_ind);
    7579                switch (c) {
    7680                case 'h':
    7781                        help_cmd_mount(HELP_LONG);
    7882                        return CMD_SUCCESS;
     83                case 'i':
     84                        instance = (unsigned int) strtol(optarg, NULL, 10);
     85                        instance_set = true;
     86                        break;
    7987                }
    8088        }
     89
     90        if (instance_set) {
     91                argc -= 2;
     92                t_argv = &argv[2];
     93        } else
     94                t_argv = &argv[0];
    8195
    8296        if ((argc < 3) || (argc > 5)) {
     
    86100        }
    87101        if (argc > 3)
    88                 dev = argv[3];
     102                dev = t_argv[3];
    89103        if (argc == 5)
    90                 mopts = argv[4];
     104                mopts = t_argv[4];
    91105
    92         rc = mount(argv[1], argv[2], dev, mopts, 0);
     106        rc = mount(t_argv[1], t_argv[2], dev, mopts, 0, instance);
    93107        if (rc != EOK) {
    94108                printf("Unable to mount %s filesystem to %s on %s (rc=%d)\n",
    95                     argv[1], argv[2], argv[3], rc);
     109                    t_argv[1], t_argv[2], t_argv[3], rc);
    96110                return CMD_FAILURE;
    97111        }
  • uspace/app/bdsh/cmds/modules/rm/rm.c

    r867e2555 r925a21e  
    9595        if (NULL != rm->cwd)
    9696                free(rm->cwd);
    97 
    98         return;
    9997}
    10098
     
    129127                }
    130128        }
     129
     130        closedir(dirp);
    131131       
    132132        return ret;
Note: See TracChangeset for help on using the changeset viewer.