Changeset 4518991 in mainline


Ignore:
Timestamp:
2021-08-10T14:20:22Z (3 years ago)
Author:
Manuele Conti <manuele.conti@…>
Children:
87eba56
Parents:
3d36920e
Message:

Complete alias support

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/input.c

    r3d36920e r4518991  
    9191                *data = odict_get_instance(alias_link, alias_t, odict);
    9292                /* check if the alias already has been resolved once */
    93                 if (!find_alias_hup(*data, alias_hups)) {
     93                if (! find_alias_hup(*data, alias_hups)) {
    9494                        alias_hup_t *hup = (alias_hup_t *)calloc(1, sizeof(alias_hup_t));
    9595                        if (hup == NULL) {
     
    111111        errno_t rc = EOK;
    112112        const size_t input_length = str_size(*line) - str_size(cmd[0]) + str_size(data->value) + 1;
    113         *line = (char *)malloc(input_length);
    114         if (*line == NULL) {
     113        char *newline = (char *)malloc(input_length);
     114        if (newline == NULL) {
    115115                cli_error(CL_EFAIL, "%s: cannot allocate input structure\n", PACKAGE_NAME);
    116116                rc = ENOMEM;
     
    118118        }
    119119
    120         *line[0] = '\0';
     120        newline[0] = '\0';
    121121
    122122        unsigned int cmd_replace_index = tokens_start;
     
    130130                        }
    131131
    132                         str_append(*line, input_length, data->value);
     132                        str_append(newline, input_length, data->value);
    133133                } else {
    134                         str_append(*line, input_length, tokens[i].text);
    135                 }
    136         }
    137 
     134                        str_append(newline, input_length, tokens[i].text);
     135                }
     136        }
     137
     138        *line = newline;
    138139exit:
    139140        return rc;
Note: See TracChangeset for help on using the changeset viewer.