Changeset 92fd52d7 in mainline for uspace/app/bdsh


Ignore:
Timestamp:
2009-04-09T21:16:50Z (17 years ago)
Author:
Jiri Svoboda <jirik.svoboda@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7afb4a5
Parents:
a2c58f6
Message:

Nuke strcpy() and strcmp().

Location:
uspace/app/bdsh
Files:
7 edited

Legend:

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

    ra2c58f6 r92fd52d7  
    5050
    5151        for (cmd = builtins; cmd->name != NULL; cmd++, i++) {
    52                 if (!strcmp(cmd->name, command))
     52                if (!str_cmp(cmd->name, command))
    5353                        return i;
    5454        }
     
    6565
    6666        for(i=0; builtin_aliases[i] != NULL; i+=2) {
    67                 if (!strcmp(builtin_aliases[i], command))
     67                if (!str_cmp(builtin_aliases[i], command))
    6868                        return 1;
    6969        }
     
    8080
    8181        for(i=0; builtin_aliases[i] != NULL; i++) {
    82                 if (!strcmp(builtin_aliases[i], command))
     82                if (!str_cmp(builtin_aliases[i], command))
    8383                        return (char *)builtin_aliases[++i];
    8484                i++;
  • uspace/app/bdsh/cmds/mod_cmds.c

    ra2c58f6 r92fd52d7  
    6565
    6666        for (mod = modules; mod->name != NULL; mod++, i++) {
    67                 if (!strcmp(mod->name, command))
     67                if (!str_cmp(mod->name, command))
    6868                        return i;
    6969        }
     
    8282
    8383        for(i=0; mod_aliases[i] != NULL; i+=2) {
    84                 if (!strcmp(mod_aliases[i], command))
     84                if (!str_cmp(mod_aliases[i], command))
    8585                        return 1;
    8686        }
     
    9898
    9999        for(i=0; mod_aliases[i] != NULL; i++) {
    100                 if (!strcmp(mod_aliases[i], command))
     100                if (!str_cmp(mod_aliases[i], command))
    101101                        return (char *)mod_aliases[++i];
    102102                i++;
  • uspace/app/bdsh/cmds/modules/help/help.c

    ra2c58f6 r92fd52d7  
    108108
    109109        if (argc == 3) {
    110                 if (!strcmp("extended", argv[2]))
     110                if (!str_cmp("extended", argv[2]))
    111111                        level = HELP_LONG;
    112112                else
  • uspace/app/bdsh/cmds/modules/mkdir/mkdir.c

    ra2c58f6 r92fd52d7  
    150150                /* Sometimes make or scripts conjoin odd paths. Account for something
    151151                 * like this: ../../foo/bar/../foo/foofoo/./bar */
    152                 if (!strcmp(dirs[i], "..") || !strcmp(dirs[i], ".")) {
     152                if (!str_cmp(dirs[i], "..") || !str_cmp(dirs[i], ".")) {
    153153                        if (0 != (chdir(dirs[i]))) {
    154154                                cli_error(CL_EFAIL, "%s: impossible path: %s",
  • uspace/app/bdsh/cmds/modules/rm/rm.c

    ra2c58f6 r92fd52d7  
    217217        i = optind;
    218218        while (NULL != argv[i]) {
    219                 len = strlen(argv[i]) + 2;
     219                len = str_size(argv[i]) + 2;
    220220                buff = (char *) realloc(buff, len);
    221221                if (buff == NULL) {
  • uspace/app/bdsh/exec.c

    ra2c58f6 r92fd52d7  
    7272        char *path[PATH_MAX];
    7373        int n = 0, i = 0;
    74         size_t x = strlen(cmd) + 2;
     74        size_t x = str_size(cmd) + 2;
    7575
    7676        found = (char *)malloc(PATH_MAX);
     
    8686        path[n] = strtok(path_tok, PATH_DELIM);
    8787        while (NULL != path[n]) {
    88                 if ((strlen(path[n]) + x ) > PATH_MAX) {
     88                if ((str_size(path[n]) + x ) > PATH_MAX) {
    8989                        cli_error(CL_ENOTSUP,
    9090                                "Segment %d of path is too large, search ends at segment %d",
  • uspace/app/bdsh/input.c

    ra2c58f6 r92fd52d7  
    147147{
    148148        char line[INPUT_MAX];
    149         size_t len = 0;
    150149
    151150        console_set_style(STYLE_EMPHASIS);
     
    154153
    155154        read_line(line, INPUT_MAX);
    156         len = strlen(line);
    157155        /* Make sure we don't have rubbish or a C/R happy user */
    158         if (len == 0 || line[0] == '\n')
     156        if (str_cmp(line, "") == 0 || str_cmp(line, "\n") == 0)
    159157                return;
    160158        usr->line = strdup(line);
Note: See TracChangeset for help on using the changeset viewer.