Changeset a000878c in mainline for uspace/app/bdsh


Ignore:
Timestamp:
2010-02-25T19:11:25Z (16 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
958de16
Parents:
a634485
Message:

make sure that all statically allocated strings are declared as "const char *"
and are treated as read-only

Location:
uspace/app/bdsh
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/cmds/builtins/cd/cd.c

    ra634485 ra000878c  
    4141#include "cd.h"
    4242
    43 static char * cmdname = "cd";
     43static const char *cmdname = "cd";
    4444
    4545void help_cmd_cd(unsigned int level)
  • uspace/app/bdsh/cmds/cmds.h

    ra634485 ra000878c  
    3333/* Module structure */
    3434typedef struct {
    35         char *name;         /* Name of the command */
    36         char *desc;         /* Description of the command */
     35        const char *name;   /* Name of the command */
     36        const char *desc;   /* Description of the command */
    3737        mod_entry_t entry;  /* Command (exec) entry function */
    3838        mod_help_t help;    /* Command (help) entry function */
     
    4141/* Builtin structure, same as modules except different types of entry points */
    4242typedef struct {
    43         char *name;
    44         char *desc;
     43        const char *name;
     44        const char *desc;
    4545        builtin_entry_t entry;
    4646        builtin_help_t help;
     
    5757extern int is_module(const char *);
    5858extern int is_module_alias(const char *);
    59 extern char * alias_for_module(const char *);
     59extern char *alias_for_module(const char *);
    6060extern int help_module(int, unsigned int);
    6161extern int run_module(int, char *[]);
     
    6565extern int is_builtin(const char *);
    6666extern int is_builtin_alias(const char *);
    67 extern char * alias_for_builtin(const char *);
     67extern char *alias_for_builtin(const char *);
    6868extern int help_builtin(int, unsigned int);
    6969extern int run_builtin(int, char *[], cliuser_t *);
  • uspace/app/bdsh/cmds/modules/cat/cat.c

    ra634485 ra000878c  
    4343#include "cmds.h"
    4444
    45 static char *cmdname = "cat";
     45static const char *cmdname = "cat";
    4646#define CAT_VERSION "0.0.1"
    4747#define CAT_DEFAULT_BUFLEN 1024
    4848
    49 static char *cat_oops = "That option is not yet supported\n";
     49static const char *cat_oops = "That option is not yet supported\n";
    5050
    5151static struct option const long_options[] = {
  • uspace/app/bdsh/cmds/modules/help/help.c

    ra634485 ra000878c  
    4242#include "util.h"
    4343
    44 static char *cmdname = "help";
     44static const char *cmdname = "help";
    4545extern const char *progname;
    4646
  • uspace/app/bdsh/cmds/modules/kcon/kcon.c

    ra634485 ra000878c  
    4040#include "cmds.h"
    4141
    42 static char *cmdname = "kcon";
     42static const char *cmdname = "kcon";
    4343
    4444/* Dispays help for kcon in various levels */
  • uspace/app/bdsh/cmds/modules/ls/ls.c

    ra634485 ra000878c  
    4949#include "cmds.h"
    5050
    51 static char *cmdname = "ls";
     51static const char *cmdname = "ls";
    5252
    5353static void ls_scan_dir(const char *d, DIR *dirp)
  • uspace/app/bdsh/cmds/modules/mkdir/mkdir.c

    ra634485 ra000878c  
    4949#define MKDIR_VERSION "0.0.1"
    5050
    51 static char *cmdname = "mkdir";
     51static const char *cmdname = "mkdir";
    5252
    5353static struct option const long_options[] = {
  • uspace/app/bdsh/cmds/modules/mkfile/mkfile.c

    ra634485 ra000878c  
    5151#define BUFFER_SIZE 16384
    5252
    53 static char *cmdname = "mkfile";
     53static const char *cmdname = "mkfile";
    5454
    5555static struct option const long_options[] = {
  • uspace/app/bdsh/cmds/modules/module_aliases.h

    ra634485 ra000878c  
    1212 * the entry point being reached. */
    1313
    14 char *mod_aliases[] = {
     14const char *mod_aliases[] = {
    1515        "ren", "mv",
    1616        "umount", "unmount",
  • uspace/app/bdsh/cmds/modules/mount/mount.c

    ra634485 ra000878c  
    5858{
    5959        unsigned int argc;
    60         char *mopts = "";
     60        const char *mopts = "";
    6161        int rc;
    6262
  • uspace/app/bdsh/cmds/modules/pwd/pwd.c

    ra634485 ra000878c  
    3939#include "pwd.h"
    4040
    41 static char * cmdname = "pwd";
     41static const char *cmdname = "pwd";
    4242
    4343void help_cmd_pwd(unsigned int level)
  • uspace/app/bdsh/cmds/modules/rm/rm.c

    ra634485 ra000878c  
    4545#include "cmds.h"
    4646
    47 static char *cmdname = "rm";
     47static const char *cmdname = "rm";
    4848#define RM_VERSION "0.0.1"
    4949
  • uspace/app/bdsh/cmds/modules/sleep/sleep.c

    ra634485 ra000878c  
    3838#include "cmds.h"
    3939
    40 static char *cmdname = "sleep";
     40static const char *cmdname = "sleep";
    4141
    4242/* Dispays help for sleep in various levels */
  • uspace/app/bdsh/cmds/modules/touch/touch.c

    ra634485 ra000878c  
    4747#include "cmds.h"
    4848
    49 static char *cmdname = "touch";
     49static const char *cmdname = "touch";
    5050
    5151/* Dispays help for touch in various levels */
  • uspace/app/bdsh/errors.c

    ra634485 ra000878c  
    4747/* Look up errno in cl_errors and return the corresponding string.
    4848 * Return NULL if not found */
    49 static char *err2str(int err)
     49static const char *err2str(int err)
    5050{
    5151
  • uspace/app/bdsh/errstr.h

    ra634485 ra000878c  
    44/* Simple array to translate error codes to meaningful strings */
    55
    6 static char *cl_errors[] = {
     6static const char *cl_errors[] = {
    77        "Success",
    88        "Failure",
     
    1818};
    1919
    20 static char *err2str(int);
     20static const char *err2str(int);
    2121
    2222#endif
  • uspace/app/bdsh/exec.c

    ra634485 ra000878c  
    120120        free(found);
    121121
    122         tid = task_spawn((const char *)tmp, argv);
     122        tid = task_spawn(tmp, (const char **) argv);
    123123        free(tmp);
    124124
  • uspace/app/bdsh/exec.h

    ra634485 ra000878c  
    55
    66extern unsigned int try_exec(char *, char **);
     7
    78#endif
  • uspace/app/bdsh/scli.h

    ra634485 ra000878c  
    66
    77typedef struct {
    8         char *name;
     8        const char *name;
    99        char *line;
    1010        char *cwd;
Note: See TracChangeset for help on using the changeset viewer.