# HG changeset patch # User Mychaela Falconia # Date 1613859783 0 # Node ID d991944aa5f386574d26b520976be6d2d9175e65 # Parent 7305f2e63d66aaef629d140fc4f1d1a585855675 fc-simtool: local cd command implemented diff -r 7305f2e63d66 -r d991944aa5f3 libcommon/Makefile --- a/libcommon/Makefile Sat Feb 20 22:13:54 2021 +0000 +++ b/libcommon/Makefile Sat Feb 20 22:23:03 2021 +0000 @@ -3,8 +3,9 @@ OBJS= alpha_decode.o alpha_fromfile.o alpha_valid.o apdu.o apducmd.o atr.o \ cardconnect.o chkblank.o decimal_str.o dumpdirfunc.o exit.o \ filesearch.o globalopts.o gsm7_decode.o gsm7_encode.o \ - gsm7_encode_table.o gsm7_unpack.o hexdump.o hexread.o hexstr.o names.o \ - number_decode.o number_encode.o pinentry.o plmncodes.o revnibbles.o + gsm7_encode_table.o gsm7_unpack.o hexdump.o hexread.o hexstr.o \ + localcd.o names.o number_decode.o number_encode.o pinentry.o \ + plmncodes.o revnibbles.o LIB= libcommon.a all: ${LIB} diff -r 7305f2e63d66 -r d991944aa5f3 libcommon/localcd.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libcommon/localcd.c Sat Feb 20 22:23:03 2021 +0000 @@ -0,0 +1,18 @@ +/* + * This module implements the local cd command. + */ + +#include +#include +#include + +cmd_cd(argc, argv) + char **argv; +{ + int rc; + + rc = chdir(argv[1]); + if (rc < 0) + perror(argv[1]); + return rc; +} diff -r 7305f2e63d66 -r d991944aa5f3 simtool/dispatch.c --- a/simtool/dispatch.c Sat Feb 20 22:13:54 2021 +0000 +++ b/simtool/dispatch.c Sat Feb 20 22:23:03 2021 +0000 @@ -10,6 +10,7 @@ extern int cmd_a38(); extern int cmd_apdu(); +extern int cmd_cd(); extern int cmd_change_chv(); extern int cmd_disable_chv(); extern int cmd_enable_chv(); @@ -103,6 +104,7 @@ {"a38", 1, 1, 1, cmd_a38}, {"apdu", 1, 1, 0, cmd_apdu}, {"atr", 0, 0, 0, retrieve_atr}, + {"cd", 1, 1, 0, cmd_cd}, {"change-chv1", 2, 2, 0, cmd_change_chv}, {"change-chv2", 2, 2, 0, cmd_change_chv}, {"change-pin1", 2, 2, 0, cmd_change_chv},