|
|
@@ -3,11 +3,10 @@
|
|
|
#include <string.h>
|
|
|
#include "sandbox.h"
|
|
|
|
|
|
-// TODO man 2 getopt
|
|
|
-
|
|
|
void print_help(const char *progname, int exit_status)
|
|
|
{
|
|
|
fprintf(stderr, "Usage: %s [options] [--] command\n", progname);
|
|
|
+ fprintf(stderr, "Options:\t--tmp-dir directory - path to temporary dir (default: /tmp)\n");
|
|
|
exit(exit_status);
|
|
|
}
|
|
|
|
|
|
@@ -15,10 +14,9 @@ static int parse_param(t_param *result, const char **av)
|
|
|
{
|
|
|
printf("Parsing -%s-\n", *av);
|
|
|
if (!strcmp(*av, "--"))
|
|
|
- {
|
|
|
- av++;
|
|
|
- result->cmd = av;
|
|
|
- }
|
|
|
+ result->cmd = ++av;
|
|
|
+ else if (!strcmp(*av, "-tmp-dir"))
|
|
|
+ result->tmpdir = *(++av);
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
@@ -31,6 +29,7 @@ t_param *parse_argv(const char **av)
|
|
|
if (result == NULL)
|
|
|
return NULL;
|
|
|
bzero(result, sizeof(*result));
|
|
|
+ result->tmpdir = "/tmp";
|
|
|
for (progname = *(av++); *av && !result->cmd; ++av)
|
|
|
{
|
|
|
if (**av == '-')
|