/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to mandos-client.c

merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
                                   close() */
52
52
#include <fcntl.h>              /* fcntl(), F_GETFD, F_SETFD,
53
53
                                   FD_CLOEXEC */
54
 
#include <string.h>             /* strsep, strlen(), strcpy(),
 
54
#include <string.h>             /* strtok, strlen(), strcpy(),
55
55
                                   strcat() */
56
56
#include <errno.h>              /* errno */
57
57
#include <argp.h>               /* struct argp_option, struct
248
248
    switch (key) {
249
249
    case 'g':
250
250
      if (arg != NULL){
251
 
        char *p;
252
 
        while((p = strsep(&arg, ",")) != NULL){
253
 
          if(strcmp(p, "") == 0){
254
 
            continue;
255
 
          }
 
251
        char *p = strtok(arg, ",");
 
252
        do{
256
253
          addargument(getplugin(NULL, plugins), p);
257
 
        }
 
254
          p = strtok(NULL, ",");
 
255
        } while (p != NULL);
258
256
      }
259
257
      break;
260
258
    case 'o':
261
259
      if (arg != NULL){
262
 
        char *name = strsep(&arg, ":");
263
 
        if(strcmp(name, "") == 0){
264
 
          break;
265
 
        }
266
 
        char *opt = strsep(&arg, ":");
267
 
        if(strcmp(opt, "") == 0){
268
 
          break;
269
 
        }
270
 
        if(opt != NULL){
271
 
          char *p;
272
 
          while((p = strsep(&opt, ",")) != NULL){
273
 
            if(strcmp(p, "") == 0){
274
 
              continue;
275
 
            }
 
260
        char *name = strtok(arg, ":");
 
261
        char *p = strtok(NULL, ":");
 
262
        if(p != NULL){
 
263
          p = strtok(p, ",");
 
264
          do{
276
265
            addargument(getplugin(name, plugins), p);
277
 
          }
 
266
            p = strtok(NULL, ",");
 
267
          } while (p != NULL);
278
268
        }
279
269
      }
280
270
      break;
338
328
    }
339
329
    plus_argv[0] = argv[0];
340
330
    plus_argv[1] = NULL;
341
 
 
342
 
    while((arg = strsep(&plus_options, delims)) != NULL){
 
331
    arg = strtok(plus_options, delims); /* Get first argument */
 
332
    while(arg != NULL){
343
333
      new_argc++;
344
334
      plus_argv = realloc(plus_argv, sizeof(char *)
345
335
                         * ((unsigned int) new_argc + 1));
350
340
      }
351
341
      plus_argv[new_argc-1] = arg;
352
342
      plus_argv[new_argc] = NULL;
 
343
      arg = strtok(NULL, delims); /* Get next argument */
353
344
    }
354
 
 
355
345
    ret = argp_parse (&argp, new_argc, plus_argv, 0, 0, &plugin_list);
356
346
    if (ret == ARGP_ERR_UNKNOWN){
357
347
      fprintf(stderr, "Unknown error while parsing arguments\n");