Changeset b781cc49 in mainline for uspace/app/bdsh/scli.c


Ignore:
Timestamp:
2019-07-05T18:37:31Z (5 years ago)
Author:
GitHub <noreply@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
fa603e99
Parents:
53afa639 (diff), 46288ee (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:
Jiří Zárevúcky <zarevucky.jiri@…> (2019-07-05 18:37:31)
git-committer:
GitHub <noreply@…> (2019-07-05 18:37:31)
Message:

Merge pull request #135 from matthieuriolo/bdsh_alias

Implements alias/unalias commands in bdsh.

File:
1 edited

Legend:

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

    r53afa639 rb781cc49  
    11/*
    22 * Copyright (c) 2008 Tim Post
     3 * Copyright (c) 2018 Matthieu Riolo
    34 * All rights reserved.
    45 *
     
    3132#include <stddef.h>
    3233#include <str.h>
     34#include <adt/odict.h>
    3335#include "config.h"
    3436#include "scli.h"
     
    4244static iostate_t *iostate;
    4345static iostate_t stdiostate;
     46
     47odict_t alias_dict;
    4448
    4549/*
     
    5559 */
    5660const char *progname = PACKAGE_NAME;
     61
     62static int alias_cmp(void *a, void *b)
     63{
     64        return str_cmp((char *)a, (char *)b);
     65}
     66
     67static void *alias_key(odlink_t *odlink)
     68{
     69        return (void *)odict_get_instance(odlink, alias_t, odict)->name;
     70}
    5771
    5872/* These are not exposed, even to builtins */
     
    108122        iostate = &stdiostate;
    109123
     124        odict_initialize(&alias_dict, alias_key, alias_cmp);
     125
    110126        if (cli_init(&usr))
    111127                exit(EXIT_FAILURE);
Note: See TracChangeset for help on using the changeset viewer.