]> diplodocus.org Git - nmh/blobdiff - sbr/arglist.c
escape_addresses.c: Move interface to own file.
[nmh] / sbr / arglist.c
index 026da19e3db557163591062c5c5356457c33d47a..bf88eb2d92968bee4254b99d77b4c92a1ac5630e 100644 (file)
@@ -5,8 +5,11 @@
  * complete copyright information.
  */
 
  * complete copyright information.
  */
 
-#include <h/mh.h>
-#include <h/utils.h>
+#include "h/mh.h"
+#include "brkstring.h"
+#include "error.h"
+#include "arglist.h"
+#include "h/utils.h"
 
 /*
  * Split up a command into an appropriate array to pass to execvp()
 
 /*
  * Split up a command into an appropriate array to pass to execvp()
@@ -39,13 +42,15 @@ char **
 argsplit(char *command, char **file, int *argp)
 {
     char **argvarray, *p;
 argsplit(char *command, char **file, int *argp)
 {
     char **argvarray, *p;
-    int space = 0, metachar = 0, i;
+    int i;
 
 
+    bool space = false;
+    bool metachar = false;
     for (p = command; *p; p++) {
        if (*p == ' ' || *p == '\t') {
     for (p = command; *p; p++) {
        if (*p == ' ' || *p == '\t') {
-               space = 1;
+               space = true;
        } else if (strchr(METACHARS, *p)) {
        } else if (strchr(METACHARS, *p)) {
-               metachar = 1;
+               metachar = true;
                break;
        }
     }
                break;
        }
     }
@@ -75,12 +80,12 @@ argsplit(char *command, char **file, int *argp)
        p = mh_xstrdup(command);
        split = brkstring(p, " \t", NULL);
        if (split[0] == NULL) {
        p = mh_xstrdup(command);
        split = brkstring(p, " \t", NULL);
        if (split[0] == NULL) {
-           adios(NULL, "Invalid blank command found");
+           die("Invalid blank command found");
        }
        argvarray[0] = mh_xstrdup(r1bindex(split[0], '/'));
        for (i = 1; split[i] != NULL; i++) {
            if (i > MAXARGS) {
        }
        argvarray[0] = mh_xstrdup(r1bindex(split[0], '/'));
        for (i = 1; split[i] != NULL; i++) {
            if (i > MAXARGS) {
-               adios(NULL, "Command exceeded argument limit");
+               die("Command exceeded argument limit");
            }
            argvarray[i] = mh_xstrdup(split[i]);
        }
            }
            argvarray[i] = mh_xstrdup(split[i]);
        }