Skip to content
Snippets Groups Projects
Commit 3e9f32f8 authored by Matt Rich's avatar Matt Rich
Browse files

Merge branch 'master' of git.ece.iastate.edu:danc/MicroCART_17-18

parents 1b2313a4 7d01f2b1
No related branches found
No related tags found
No related merge requests found
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <err.h> #include <err.h>
#include <libgen.h>
#include "cli.h" #include "cli.h"
...@@ -11,7 +12,7 @@ int main(int argc, char **argv) ...@@ -11,7 +12,7 @@ int main(int argc, char **argv)
int i , useSymlink = 0; int i , useSymlink = 0;
struct backend_conn *conn; struct backend_conn *conn;
command = argv[0]; command = basename(argv[0]);
for(i = 0; i < MAX_COMMANDS; ++i) { for(i = 0; i < MAX_COMMANDS; ++i) {
if (strncmp(command, commandNames[i], strlen(commandNames[i])) == 0) if (strncmp(command, commandNames[i], strlen(commandNames[i])) == 0)
{ {
...@@ -42,11 +43,11 @@ int main(int argc, char **argv) ...@@ -42,11 +43,11 @@ int main(int argc, char **argv)
} }
if(useSymlink) { if(useSymlink) {
//TODO Call correct command function pointer with (argv[1] ... argc[argc]) (*cli_functions[cmdID]) (conn, argc, &argv[0]);
}else { }else {
(*cli_functions[0]) (conn, argc-1, &argv[1]); (*cli_functions[cmdID]) (conn, argc-1, &argv[1]);
} }
ucart_backendDisconnect(conn); ucart_backendDisconnect(conn);
return 0; return 0;
} }
\ No newline at end of file
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
// #include "cli_setpid.h" // #include "cli_setpid.h"
#include "cli_getpid.h" #include "cli_getpid.h"
// #include "cli_getimu.h" // #include "cli_getimu.h"
enum CommandNameIds{ enum CommandNameIds{
CMD_MONITOR, CMD_MONITOR,
CMD_SETPID, CMD_SETPID,
...@@ -31,4 +30,4 @@ static char* commandNames[MAX_COMMANDS] = { ...@@ -31,4 +30,4 @@ static char* commandNames[MAX_COMMANDS] = {
}; };
#endif #endif
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment