extern int xread (int sock, void *buf, size_t len)
__attribute__((__warn_unused_result__));
+extern int add_string_nodup (char ***argv, int *size, int *alloc, char *str);
extern int add_string (char ***argv, int *size, int *alloc, const char *str);
extern size_t count_strings (char *const *argv);
extern void sort_strings (char **argv, int len);
return 1;
}
+/* Helper for building up short lists of arguments. Your code has to
+ * define MAX_ARGS to a suitable value.
+ */
+#define ADD_ARG(argv,i,v) \
+ do { \
+ if ((i) >= MAX_ARGS) { \
+ fprintf (stderr, "%s: %d: internal error: exceeded MAX_ARGS (%zu) when constructing the command line\n", __FILE__, __LINE__, (size_t) MAX_ARGS); \
+ abort (); \
+ } \
+ (argv)[(i)++] = (v); \
+ } while (0)
+
/* Helper for functions that need a root filesystem mounted.
* NB. Cannot be used for FileIn functions.
*/