Changeset 7c3fb9b in mainline for uspace/app/bdsh


Ignore:
Timestamp:
2018-05-17T08:29:01Z (6 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6ff23ff
Parents:
fac0ac7
git-author:
Jiri Svoboda <jiri@…> (2018-05-16 17:28:17)
git-committer:
Jiri Svoboda <jiri@…> (2018-05-17 08:29:01)
Message:

Fix block comment formatting (ccheck).

Location:
uspace/app/bdsh
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/cmds/builtin_cmds.c

    rfac0ac7 r7c3fb9b  
    2727 */
    2828
    29 /* Almost identical (for now) to mod_cmds.c , however this will not be the case
    30  * soon as builtin_t is going to grow way beyond module_t */
     29/*
     30 * Almost identical (for now) to mod_cmds.c, however this will not be the case
     31 * soon as builtin_t is going to grow way beyond module_t
     32 */
    3133
    3234#include <stdio.h>
  • uspace/app/bdsh/cmds/builtins/batch/batch.c

    rfac0ac7 r7c3fb9b  
    6666}
    6767
    68 /* Main entry point for batch, accepts an array of arguments and a
    69  * pointer to the cliuser_t structure */
     68/** Main entry point for batch, accepts an array of arguments and a
     69 * pointer to the cliuser_t structure
     70 */
    7071int cmd_batch(char **argv, cliuser_t *usr)
    7172{
  • uspace/app/bdsh/cmds/builtins/cd/cd.c

    rfac0ac7 r7c3fb9b  
    4141static const char *cmdname = "cd";
    4242
    43 /* Previous directory variables.
     43/*
     44 * Previous directory variables.
    4445 *
    4546 * Declaring them static to avoid many "== NULL" checks.
     
    101102        }
    102103
    103         /* We don't yet play nice with whitespace, a getopt implementation should
     104        /*
     105         * We don't yet play nice with whitespace, a getopt implementation should
    104106         * protect "quoted\ destination" as a single argument. Its not our job to
    105107         * look for && || or redirection as the tokenizer should have done that
    106          * (currently, it does not) */
     108         * (currently, it does not)
     109         */
    107110
    108111        if (argc > 2) {
  • uspace/app/bdsh/cmds/builtins/exit/exit.c

    rfac0ac7 r7c3fb9b  
    4444}
    4545
    46 /* Quits the program and returns the status of whatever command
    47  * came before invoking 'quit' */
     46/** Quits the program and returns the status of whatever command
     47 * came before invoking 'quit'
     48 */
    4849int cmd_exit(char *argv[], cliuser_t *usr)
    4950{
  • uspace/app/bdsh/cmds/cmds.h

    rfac0ac7 r7c3fb9b  
    7676} builtin_t;
    7777
    78 /* Declared in cmds/modules/modules.h and cmds/builtins/builtins.h
    79  * respectively */
     78/*
     79 * Declared in cmds/modules/modules.h and cmds/builtins/builtins.h
     80 * respectively
     81 */
    8082extern module_t modules[];
    8183extern builtin_t builtins[];
  • uspace/app/bdsh/cmds/mod_cmds.c

    rfac0ac7 r7c3fb9b  
    2727 */
    2828
    29 /* NOTES:
     29/*
     30 * NOTES:
    3031 * module_* functions are pretty much identical to builtin_* functions at this
    3132 * point. On the surface, it would appear that making each function dual purpose
     
    3738 *
    3839 * To keep things easy to hack, everything is separated. In reality this only adds
    39  * 6 - 8 extra functions, but keeps each function very easy to read and modify. */
     40 * 6 - 8 extra functions, but keeps each function very easy to read and modify.
     41 */
    4042
    41 /* TODO:
     43/*
     44 * TODO:
    4245 * Many of these could be unsigned, provided the modules and builtins themselves
    43  * can follow suit. Long term goal. */
     46 * can follow suit. Long term goal.
     47 */
    4448
    4549#include <stdio.h>
     
    5357extern volatile unsigned int cli_interactive;
    5458
    55 /* Checks if an entry function matching command exists in modules[], if so
    56  * its position in the array is returned */
     59/** Checks if an entry function matching command exists in modules[]
     60 *
     61 * If so, its position in the array is returned
     62 */
    5763int is_module(const char *command)
    5864{
     
    7177}
    7278
    73 /* Checks if a module is an alias (sharing an entry point with another
    74  * module). Returns 1 if so */
     79/*
     80 * Checks if a module is an alias (sharing an entry point with another
     81 * module). Returns 1 if so
     82 */
    7583int is_module_alias(const char *command)
    7684{
     
    105113
    106114
    107 /* Invokes the 'help' entry function for the module at position (int) module,
    108  * which wants an unsigned int to determine brief or extended display. */
     115/** Invokes the 'help' entry function for the module at position (int) module
     116 *
     117 * which wants an unsigned int to determine brief or extended display.
     118 */
    109119int help_module(int module, unsigned int extended)
    110120{
     
    121131}
    122132
    123 /* Invokes the module entry point modules[module], passing argv[] as an argument
    124  * stack. */
     133/** Invokes the module entry point modules[module]
     134 *
     135 * passing argv[] as an argument stack.
     136 */
    125137int run_module(int module, char *argv[], iostate_t *new_iostate)
    126138{
  • uspace/app/bdsh/cmds/modules/cat/cat.c

    rfac0ac7 r7c3fb9b  
    274274                                                break;
    275275                                        } else if (c == U_SPECIAL && offset + 2 >= (size_t)bytes) {
    276                                                 /* If an extended character is cut off due to the size of the buffer,
    277                                                    we will copy it over to the next buffer so it can be read correctly. */
     276                                                /*
     277                                                 * If an extended character is cut off due to the size of the buffer,
     278                                                 * we will copy it over to the next buffer so it can be read correctly.
     279                                                 */
    278280                                                copied_bytes = bytes - offset + 1;
    279281                                                memcpy(buff, buff + offset - 1, copied_bytes);
  • uspace/app/bdsh/cmds/modules/cp/cp.c

    rfac0ac7 r7c3fb9b  
    207207                        /* e.g. cp file_name /data/ */
    208208
    209                         /* dest is a directory,
     209                        /*
     210                         * dest is a directory,
    210211                         * append the src filename to it.
    211212                         */
     
    231232                        /* e.g. cp file_name existing_file */
    232233
    233                         /* dest already exists,
     234                        /*
     235                         * dest already exists,
    234236                         * if force is set we will try to remove it.
    235237                         * if interactive is set user input is required.
     
    298300                        if (str_cmp(src_dirname, "..") &&
    299301                            str_cmp(src_dirname, ".")) {
    300                                 /* The last component of src_path is
     302                                /*
     303                                 * The last component of src_path is
    301304                                 * not '.' or '..'
    302305                                 */
     
    314317                default:
    315318                case TYPE_NONE:
    316                         /* dest does not exists, this means the user wants
     319                        /*
     320                         * dest does not exists, this means the user wants
    317321                         * to specify the name of the destination directory
    318322                         *
     
    336340                }
    337341
    338                 /* Copy every single directory entry of src into the
     342                /*
     343                 * Copy every single directory entry of src into the
    339344                 * destination directory.
    340345                 */
  • uspace/app/bdsh/cmds/modules/ls/ls.c

    rfac0ac7 r7c3fb9b  
    2727 */
    2828
    29 /* NOTE:
     29/*
     30 * NOTE:
    3031 * This is a bit of an ugly hack, working around the absence of fstat / etc.
    31  * As more stuff is completed and exposed in libc, this will improve */
     32 * As more stuff is completed and exposed in libc, this will improve
     33 */
    3234
    3335#include <errno.h>
  • uspace/app/bdsh/cmds/modules/module_aliases.h

    rfac0ac7 r7c3fb9b  
    3030#define MODULE_ALIASES_H
    3131
    32 /* Modules that declare multiple names for themselves but use the
     32/*
     33 * Modules that declare multiple names for themselves but use the
    3334 * same entry functions are aliases. This array helps to determine if
    3435 * a module is an alias, as such it can be invoked differently.
    35  * format is alias , real_name */
     36 * format is alias , real_name
     37 */
    3638
    37 /* So far, this is only used in the help display but could be used to
     39/*
     40 * So far, this is only used in the help display but could be used to
    3841 * handle a module differently even prior to reaching its entry code.
    3942 * For instance, 'exit' could behave differently than 'quit', prior to
    40  * the entry point being reached. */
     43 * the entry point being reached.
     44 */
    4145
    4246const char *mod_aliases[] = {
  • uspace/app/bdsh/cmds/modules/modules.h

    rfac0ac7 r7c3fb9b  
    3030#define MODULES_H
    3131
    32 /* Each built in function has two files, one being an entry.h file which
     32/*
     33 * Each built in function has two files, one being an entry.h file which
    3334 * prototypes the run/help entry functions, the other being a .def file
    3435 * which fills the modules[] array according to the cmd_t structure
     
    4041 *
    4142 * NOTE: See module_ aliases.h as well, this is where aliases (commands that
    42  * share an entry point with others) are indexed */
     43 * share an entry point with others) are indexed
     44 */
    4345
    4446#include "config.h"
     
    6466#include "cmp/entry.h"
    6567
    66 /* Each .def function fills the module_t struct with the individual name, entry
     68/*
     69 * Each .def function fills the module_t struct with the individual name, entry
    6770 * point, help entry point, etc. You can use config.h to control what modules
    68  * are loaded based on what libraries exist on the system. */
     71 * are loaded based on what libraries exist on the system.
     72 */
    6973
    7074module_t modules[] = {
  • uspace/app/bdsh/cmds/modules/rm/rm.c

    rfac0ac7 r7c3fb9b  
    9595        rm->safe = 0;
    9696
    97         /* Make sure we can allocate enough memory to store
    98          * what is needed in the job structure */
     97        /*
     98         * Make sure we can allocate enough memory to store
     99         * what is needed in the job structure
     100         */
    99101        if (NULL == (rm->nwd = (char *) malloc(PATH_MAX)))
    100102                return 0;
  • uspace/app/bdsh/compl.c

    rfac0ac7 r7c3fb9b  
    219219                cs->path_list[0] = dirname;
    220220                cs->path_list[1] = NULL;
    221                 /* The second const ensures that we can't assign a const
    222                  * string to the non-const array. */
     221                /*
     222                 * The second const ensures that we can't assign a const
     223                 * string to the non-const array.
     224                 */
    223225                cs->path = (const char *const *) cs->path_list;
    224226
  • uspace/app/bdsh/config.h

    rfac0ac7 r7c3fb9b  
    2727 */
    2828
    29 /* Various things that are used in many places including a few
    30  * tidbits left over from autoconf prior to the HelenOS port */
     29/*
     30 * Various things that are used in many places including a few
     31 * tidbits left over from autoconf prior to the HelenOS port
     32 */
    3133
    3234/* Specific port work-arounds : */
     
    4446#define LARGE_BUFLEN 1024
    4547
    46 /* How many words (arguments) are permitted, how big can a whole
    47  * sentence be? Similar to ARG_MAX */
     48/*
     49 * How many words (arguments) are permitted, how big can a whole
     50 * sentence be? Similar to ARG_MAX
     51 */
    4852#define WORD_MAX 1023
    4953#define INPUT_MAX 4096
  • uspace/app/bdsh/errors.c

    rfac0ac7 r7c3fb9b  
    4444
    4545
    46 /* Look up errno in cl_errors and return the corresponding string.
    47  * Return NULL if not found */
     46/** Look up errno in cl_errors and return the corresponding string.
     47 *
     48 * Return NULL if not found
     49 */
    4850static const char *err2str(int err)
    4951{
     
    5557}
    5658
    57 /* Print an error report signifying errno, which is translated to
    58  * its corresponding human readable string. If errno > 0, raise the
    59  * cli_quit int that tells the main program loop to exit immediately */
    60 
     59/** Print an error report signifying errno
     60 *
     61 * errno is translated to its corresponding human readable string.
     62 * If errno > 0, raise the cli_quit int that tells the main program loop
     63 * to exit immediately
     64 */
    6165void cli_error(int err, const char *fmt, ...)
    6266{
     
    7175                printf(" (Unknown Error %d)\n", err);
    7276
    73         /* If fatal, raise cli_quit so that we try to exit
     77        /*
     78         * If fatal, raise cli_quit so that we try to exit
    7479         * gracefully. This will break the main loop and
    75          * invoke the destructor */
     80         * invoke the destructor
     81         */
    7682        if (err == CL_EFATAL)
    7783                cli_quit = 1;
  • uspace/app/bdsh/exec.c

    rfac0ac7 r7c3fb9b  
    2727 */
    2828
    29 /* The VERY basics of execute in place support. These are buggy, leaky
     29/*
     30 * The VERY basics of execute in place support. These are buggy, leaky
    3031 * and not nearly done. Only here for beta testing!! You were warned!!
    3132 * TODO:
    3233 * Hash command lookups to save time
    33  * Create a running pointer to **path and advance/rewind it as we go */
     34 * Create a running pointer to **path and advance/rewind it as we go
     35 */
    3436
    3537#include <stdio.h>
     
    6668}
    6769
    68 /* Returns the full path of "cmd" if cmd is found, else just hand back
    69  * cmd as it was presented */
     70/** Returns the full path of "cmd" if cmd is found
     71 *
     72 * else just hand back cmd as it was presented
     73 */
    7074static char *find_command(char *cmd)
    7175{
  • uspace/app/bdsh/input.c

    rfac0ac7 r7c3fb9b  
    6262static void print_pipe_usage(void);
    6363
    64 /* Tokenizes input from console, sees if the first word is a built-in, if so
     64/*
     65 * Tokenizes input from console, sees if the first word is a built-in, if so
    6566 * invokes the built-in entry point (a[0]) passing all arguments in a[] to
    66  * the handler */
     67 * the handler
     68 */
    6769errno_t process_input(cliuser_t *usr)
    6870{
     
    105107        }
    106108
    107         /* Until full support for pipes is implemented, allow for a simple case:
     109        /*
     110         * Until full support for pipes is implemented, allow for a simple case:
    108111         * [from <file> |] command [| to <file>]
    109112         *
  • uspace/app/bdsh/scli.c

    rfac0ac7 r7c3fb9b  
    4343static iostate_t stdiostate;
    4444
    45 /* Globals that are modified during start-up that modules/builtins
    46  * should be aware of. */
     45/*
     46 * Globals that are modified during start-up that modules/builtins
     47 * should be aware of.
     48 */
    4749volatile unsigned int cli_quit = 0;
    4850volatile unsigned int cli_verbocity = 1;
    4951
    50 /* The official name of this program
    51  * (change to your liking in configure.ac and re-run autoconf) */
     52/*
     53 * The official name of this program
     54 * (change to your liking in configure.ac and re-run autoconf)
     55 */
    5256const char *progname = PACKAGE_NAME;
    5357
  • uspace/app/bdsh/tok.c

    rfac0ac7 r7c3fb9b  
    9797        while ((next_char = tok_look_char(tok)) != 0) {
    9898                if (next_char == ' ') {
    99                         /* Push the token if there is any.
     99                        /*
     100                         * Push the token if there is any.
    100101                         * There may not be any pending char for a token in case
    101102                         * there are several spaces in the input.
     
    115116
    116117                } else if (next_char == '|') {
    117                         /* Pipes are tokens that are delimiters and should be
     118                        /*
     119                         * Pipes are tokens that are delimiters and should be
    118120                         * output as a separate token
    119121                         */
     
    137139                        }
    138140                } else if (next_char == '\'') {
    139                         /* A string starts with a quote (') and ends again with a quote.
     141                        /*
     142                         * A string starts with a quote (') and ends again with a quote.
    140143                         * A literal quote is written as ''
    141144                         */
     
    151154                                tok_start_token(tok, TOKTYPE_TEXT);
    152155                        }
    153                         /* If we are handling any other character, just append it to
     156                        /*
     157                         * If we are handling any other character, just append it to
    154158                         * the current token.
    155159                         */
  • uspace/app/bdsh/util.c

    rfac0ac7 r7c3fb9b  
    5252}
    5353
    54 /* (re)allocates memory to store the current working directory, gets
     54/*
     55 * (re)allocates memory to store the current working directory, gets
    5556 * and updates the current working directory, formats the prompt
    56  * string */
     57 * string
     58 */
    5759unsigned int cli_set_prompt(cliuser_t *usr)
    5860{
Note: See TracChangeset for help on using the changeset viewer.