Subversion Repositories HelenOS

Rev

Rev 3265 | Rev 3269 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3265 Rev 3268
Line 61... Line 61...
61
int tok_input(cliuser_t *usr)
61
int tok_input(cliuser_t *usr)
62
{
62
{
63
    char *cmd[WORD_MAX];
63
    char *cmd[WORD_MAX];
64
    int n = 0, i = 0;
64
    int n = 0, i = 0;
65
    int rc = 0;
65
    int rc = 0;
66
    char *tmp = cli_strdup(usr->line);
66
    char *tmp = (char *) NULL;
67
 
67
 
68
    if (NULL == usr->line) {
68
    if (NULL == usr->line) {
69
        rc = CL_EFAIL;
69
        rc = CL_EFAIL;
70
        goto finit;
70
        goto finit;
71
    }
71
    }
72
 
72
 
-
 
73
    tmp = cli_strdup(usr->line);
-
 
74
 
73
    /* Break up what the user typed, space delimited */
75
    /* Break up what the user typed, space delimited */
74
    cmd[n] = cli_strtok(tmp, " ");
76
    cmd[n] = cli_strtok(tmp, " ");
75
    while (cmd[n] && n < WORD_MAX) {
77
    while (cmd[n] && n < WORD_MAX) {
76
        cmd[++n] = cli_strtok(NULL, " ");
78
        cmd[++n] = cli_strtok(NULL, " ");
77
    }
79
    }
Line 113... Line 115...
113
finit:
115
finit:
114
    if (NULL != usr->line) {
116
    if (NULL != usr->line) {
115
        free(usr->line);
117
        free(usr->line);
116
        usr->line = (char *) NULL;
118
        usr->line = (char *) NULL;
117
    }
119
    }
-
 
120
    if (NULL != tmp)
118
    free(tmp);
121
        free(tmp);
-
 
122
 
119
    return rc;
123
    return rc;
120
}
124
}
121
 
125
 
122
#ifdef HELENOS
126
#ifdef HELENOS
123
/* Borrowed from Jiri Svoboda's 'cli' uspace app */
127
/* Borrowed from Jiri Svoboda's 'cli' uspace app */