Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 60c332e in mainline


Ignore:
Timestamp:
2018-11-30T01:11:36Z (3 years ago)
Author:
Matthieu Riolo <matthieu.riolo@…>
Branches:
lfn, master
Children:
4bf08aa5
Parents:
c483fca
Message:

adding basic logic for cmd alias

Location:
uspace/app/bdsh
Files:
4 added
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/Makefile

    rc483fca r60c332e  
    3434
    3535SOURCES = \
     36        cmds/modules/alias/alias.c \
    3637        cmds/modules/help/help.c \
    3738        cmds/modules/mkdir/mkdir.c \
  • uspace/app/bdsh/cmds/modules/modules.h

    rc483fca r60c332e  
    6565#include "echo/entry.h"
    6666#include "cmp/entry.h"
     67#include "alias/entry.h"
    6768
    6869/*
     
    9091#include "echo/echo_def.inc"
    9192#include "cmp/cmp_def.inc"
     93#include "alias/alias_def.inc"
    9294
    9395        { NULL, NULL, NULL, NULL }
  • uspace/app/bdsh/scli.c

    rc483fca r60c332e  
    3131#include <stddef.h>
    3232#include <str.h>
     33#include <adt/odict.h>
     34
    3335#include "config.h"
    3436#include "scli.h"
     
    4244static iostate_t *iostate;
    4345static iostate_t stdiostate;
     46
     47
     48odict_t alias_dict;
    4449
    4550/*
     
    5560 */
    5661const char *progname = PACKAGE_NAME;
     62
     63static int alias_cmp(void* a, void* b) {
     64        return str_cmp((char*)a, (char*)b);
     65}
     66
    5767
    5868/* These are not exposed, even to builtins */
     
    108118        iostate = &stdiostate;
    109119
     120
     121        odict_initialize(&alias_dict, alias_key, alias_cmp);
     122
    110123        if (cli_init(&usr))
    111124                exit(EXIT_FAILURE);
  • uspace/app/bdsh/scli.h

    rc483fca r60c332e  
    3434#include <stdint.h>
    3535#include <stdio.h>
     36#include <types/adt/odict.h>
     37
     38
    3639
    3740typedef struct {
     
    5457extern void set_iostate(iostate_t *);
    5558
     59
     60extern odict_t alias_dict;
     61
     62extern void* alias_key(odlink_t *odlink);
     63
     64typedef struct {
     65        odlink_t odict;
     66        char* name;
     67        char* value;
     68} alias_t;
     69
     70
    5671#endif
Note: See TracChangeset for help on using the changeset viewer.