00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00027 #include <string.h>
00028 #include <stdio.h>
00029 #include "rr_libs/general.h"
00030
00031 void parse_comline(char *input_line,
00032 int *num_of_args,
00033 char **args) {
00034
00035 int next_space;
00036 char next_word[200];
00037
00038 *num_of_args = 0;
00039
00040 while (strlen(input_line) > 0) {
00041
00042 if (input_line[0] == ' ') {
00043 input_line = &(input_line[1]);
00044 }
00045 else {
00046 next_space = strcspn(input_line," ");
00047
00048 if (input_line[next_space]==' ') {
00049 strncpy(next_word,input_line,next_space);
00050 next_word[next_space] = '\0';
00051 input_line = &(input_line[next_space+1]);
00052 }
00053 else {
00054 strcpy(next_word,input_line);
00055 input_line[0]='\0';
00056 }
00057
00058 args[*num_of_args] = salloc(next_word);
00059
00060 (*num_of_args)++;
00061
00062 }
00063 }
00064
00065 }