aboutsummaryrefslogblamecommitdiff
path: root/tst/cut.c
blob: 4567a8756a0faf85e2533782640b2e0a1b26feba (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16















                                                       
char**  separate_commandline (char *msg, char sep)
{
        unsigned int    len;
        char**          two_words;

        /* Yes, do nothing, just get len ! */
        for (len = 0; msg[len] != sep; len++);
                two_words = malloc (sizeof(char*) * 2);

        msg[len]        = '\0';
        two_words[0]    = msg;
        two_words[1]    = msg + len + 1;

        return (two_words);
}