Changeset ab936440 in mainline for uspace/app/bdsh/cmds


Ignore:
Timestamp:
2019-02-12T20:42:42Z (5 years ago)
Author:
Matthieu Riolo <matthieu.riolo@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f31ca47
Parents:
7f7817a9 (diff), 4805495 (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:
Matthieu Riolo <matthieu.riolo@…> (2019-02-12 20:26:18)
git-committer:
Matthieu Riolo <matthieu.riolo@…> (2019-02-12 20:42:42)
Message:

Merge branch 'master' into bdsh_alias

Conflicts:

uspace/app/bdsh/Makefile
uspace/app/bdsh/cmds/modules/modules.h

Ccheck correction and removing header which includes itself

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

Legend:

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

    r7f7817a9 rab936440  
     1/*
     2 * Copyright (c) 2008 Tim Post
     3 * All rights reserved.
     4 *
     5 * Redistribution and use in source and binary forms, with or without
     6 * modification, are permitted provided that the following conditions
     7 * are met:
     8 *
     9 * - Redistributions of source code must retain the above copyright
     10 *   notice, this list of conditions and the following disclaimer.
     11 * - Redistributions in binary form must reproduce the above copyright
     12 *   notice, this list of conditions and the following disclaimer in the
     13 *   documentation and/or other materials provided with the distribution.
     14 * - The name of the author may not be used to endorse or promote products
     15 *   derived from this software without specific prior written permission.
     16 *
     17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     27 */
     28
    129#ifndef BUILTIN_ALIASES_H
    230#define BUILTIN_ALIASES_H
    331
    4 /* See modules/module_aliases.h for an explanation of this file */
    5 
    6 char *builtin_aliases[] = {
    7         NULL, NULL
    8 };
     32extern char *builtin_aliases[];
    933
    1034#endif
  • uspace/app/bdsh/cmds/builtins/builtins.h

    r7f7817a9 rab936440  
     1/*
     2 * Copyright (c) 2008 Tim Post
     3 * All rights reserved.
     4 *
     5 * Redistribution and use in source and binary forms, with or without
     6 * modification, are permitted provided that the following conditions
     7 * are met:
     8 *
     9 * - Redistributions of source code must retain the above copyright
     10 *   notice, this list of conditions and the following disclaimer.
     11 * - Redistributions in binary form must reproduce the above copyright
     12 *   notice, this list of conditions and the following disclaimer in the
     13 *   documentation and/or other materials provided with the distribution.
     14 * - The name of the author may not be used to endorse or promote products
     15 *   derived from this software without specific prior written permission.
     16 *
     17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     27 */
     28
    129#ifndef BUILTINS_H
    230#define BUILTINS_H
    331
    4 #include "config.h"
     32#include "../cmds.h"
    533
    6 #include "batch/entry.h"
    7 #include "cd/entry.h"
    8 #include "exit/entry.h"
    9 
    10 builtin_t builtins[] = {
    11 #include "batch/batch_def.inc"
    12 #include "cd/cd_def.inc"
    13 #include "exit/exit_def.inc"
    14         { NULL, NULL, NULL, NULL, 0 }
    15 };
     34extern builtin_t builtins[];
    1635
    1736#endif
  • uspace/app/bdsh/cmds/mknewcmd

    r7f7817a9 rab936440  
    213213        printf " to include your new command.\n"
    214214        [ -n "$CMDALIAS" ] &&  {
    215                 printf "\nYou should also modify %ss/%s_aliases.h and " \
     215                printf "\nYou should also modify %ss/%s_aliases.c and " \
    216216                        "${CMDTYPE}" "${CMDTYPE}"
    217217                printf "add %s as an alias for %s\n" \
  • uspace/app/bdsh/cmds/modules/alias/alias.c

    r7f7817a9 rab936440  
    6060                return true;
    6161        }
    62        
     62
    6363        cli_error(CL_ENOENT, "%s: No alias with the name '%s' exists\n", cmdname, name);
    6464        return false;
     
    123123int cmd_alias(char **argv)
    124124{
    125        
     125
    126126        if (argv[1] == NULL) {
    127127                list_aliases();
     
    140140                                return CMD_FAILURE;
    141141                        }
    142                        
     142
    143143                        set_alias(name, value + 1);
    144144                } else {
     
    151151                free(name);
    152152        }
    153        
     153
    154154        return CMD_SUCCESS;
    155155}
  • uspace/app/bdsh/cmds/modules/ls/ls.c

    r7f7817a9 rab936440  
    199199
    200200        /* Populate the directory list. */
    201         if (ls.recursive) {
     201        if (ls.recursive && nbdirs > 0) {
    202202                tmp = (struct dir_elem_t *) realloc(*dir_list_ptr,
    203203                    nbdirs * sizeof(struct dir_elem_t));
  • uspace/app/bdsh/cmds/modules/module_aliases.h

    r7f7817a9 rab936440  
    3030#define MODULE_ALIASES_H
    3131
    32 /*
    33  * Modules that declare multiple names for themselves but use the
    34  * same entry functions are aliases. This array helps to determine if
    35  * a module is an alias, as such it can be invoked differently.
    36  * format is alias , real_name
    37  */
    38 
    39 /*
    40  * So far, this is only used in the help display but could be used to
    41  * handle a module differently even prior to reaching its entry code.
    42  * For instance, 'exit' could behave differently than 'quit', prior to
    43  * the entry point being reached.
    44  */
    45 
    46 const char *mod_aliases[] = {
    47         "ren", "mv",
    48         "umount", "unmount",
    49         NULL, NULL
    50 };
     32extern const char *mod_aliases[];
    5133
    5234#endif
  • uspace/app/bdsh/cmds/modules/modules.h

    r7f7817a9 rab936440  
    3030#define MODULES_H
    3131
    32 /*
    33  * Each built in function has two files, one being an entry.h file which
    34  * prototypes the run/help entry functions, the other being a .def file
    35  * which fills the modules[] array according to the cmd_t structure
    36  * defined in cmds.h.
    37  *
    38  * To add or remove a module, just make a new directory in cmds/modules
    39  * for it and copy the 'show' example for basics, then include it here.
    40  * (or reverse the process to remove one)
    41  *
    42  * NOTE: See module_ aliases.h as well, this is where aliases (commands that
    43  * share an entry point with others) are indexed
    44  */
     32#include "../cmds.h"
    4533
    46 #include "config.h"
    47 
    48 /* Prototypes for each module's entry (help/exec) points */
    49 
    50 #include "help/entry.h"
    51 #include "mkdir/entry.h"
    52 #include "mkfile/entry.h"
    53 #include "rm/entry.h"
    54 #include "cat/entry.h"
    55 #include "touch/entry.h"
    56 #include "ls/entry.h"
    57 #include "pwd/entry.h"
    58 #include "sleep/entry.h"
    59 #include "cp/entry.h"
    60 #include "mv/entry.h"
    61 #include "mount/entry.h"
    62 #include "unmount/entry.h"
    63 #include "kcon/entry.h"
    64 #include "printf/entry.h"
    65 #include "echo/entry.h"
    66 #include "cmp/entry.h"
    67 #include "alias/entry.h"
    68 #include "unalias/entry.h"
    69 
    70 /*
    71  * Each .def function fills the module_t struct with the individual name, entry
    72  * point, help entry point, etc. You can use config.h to control what modules
    73  * are loaded based on what libraries exist on the system.
    74  */
    75 
    76 module_t modules[] = {
    77 #include "help/help_def.inc"
    78 #include "mkdir/mkdir_def.inc"
    79 #include "mkfile/mkfile_def.inc"
    80 #include "rm/rm_def.inc"
    81 #include "cat/cat_def.inc"
    82 #include "touch/touch_def.inc"
    83 #include "ls/ls_def.inc"
    84 #include "pwd/pwd_def.inc"
    85 #include "sleep/sleep_def.inc"
    86 #include "cp/cp_def.inc"
    87 #include "mv/mv_def.inc"
    88 #include "mount/mount_def.inc"
    89 #include "unmount/unmount_def.inc"
    90 #include "kcon/kcon_def.inc"
    91 #include "printf/printf_def.inc"
    92 #include "echo/echo_def.inc"
    93 #include "cmp/cmp_def.inc"
    94 #include "alias/alias_def.inc"
    95 #include "unalias/unalias_def.inc"
    96 
    97         { NULL, NULL, NULL, NULL }
    98 };
     34extern module_t modules[];
    9935
    10036#endif
  • uspace/app/bdsh/cmds/modules/sleep/sleep.c

    r7f7817a9 rab936440  
    2727 */
    2828
    29 #include <async.h>
    3029#include <errno.h>
     30#include <fibril.h>
    3131#include <stdio.h>
    3232#include <stdlib.h>
  • uspace/app/bdsh/cmds/modules/unalias/unalias.c

    r7f7817a9 rab936440  
    9999                free_alias(alias_link);
    100100        }
    101        
     101
    102102        return CMD_SUCCESS;
    103103}
Note: See TracChangeset for help on using the changeset viewer.