Skip to content

Commit

Permalink
fix the cmd stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
koraykv committed Dec 20, 2012
1 parent 814981b commit 6e046b9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions liblinear/liblinear_train.c
Expand Up @@ -121,6 +121,7 @@ int parse_command_line(lua_State *L)
{
int i, argc = 1;
char *argv[CMD_LEN/2];
char cmd[CMD_LEN];
void (*print_func)(const char *) = print_string_default; // default printing to matlab display

// default values
Expand All @@ -144,8 +145,7 @@ int parse_command_line(lua_State *L)
{
size_t slen;
const char *tcmd = lua_tolstring(L,2,&slen);
char cmd[slen];
strcpy(cmd,tcmd);
strncpy(cmd,tcmd,slen);
if((argv[argc] = strtok((char*)cmd, " ")) != NULL)
while((argv[++argc] = strtok(NULL, " ")) != NULL)
;
Expand Down
4 changes: 2 additions & 2 deletions libsvm/libsvm_train.c
Expand Up @@ -111,6 +111,7 @@ int parse_command_line(lua_State *L)
{
int i, argc = 1;
char *argv[CMD_LEN/2];
char cmd[CMD_LEN];
void (*print_func)(const char *) = print_string_default;

// default values
Expand Down Expand Up @@ -141,8 +142,7 @@ int parse_command_line(lua_State *L)
// put options in argv[]
size_t slen;
const char *tcmd = lua_tolstring(L,2,&slen);
char cmd[slen];
strcpy(cmd,tcmd);
strncpy(cmd,tcmd,slen);
if((argv[argc] = strtok((char*)cmd, " ")) != NULL)
while((argv[++argc] = strtok(NULL, " ")) != NULL)
;
Expand Down

0 comments on commit 6e046b9

Please sign in to comment.