diff options
author | Marius Halden <marius.h@lden.org> | 2016-08-30 21:19:19 +0200 |
---|---|---|
committer | Marius Halden <marius.h@lden.org> | 2016-08-30 21:19:19 +0200 |
commit | 0b7fd61b6d460cc47ac639c9d6d23b8cc05d4e68 (patch) | |
tree | 1e893ece252e6b392bd17688e749463d6ae6c3bd /createspool.c | |
parent | 1c705d775092bee9504801f8b1322e53e0631d77 (diff) | |
download | runq-0b7fd61b6d460cc47ac639c9d6d23b8cc05d4e68.tar.gz runq-0b7fd61b6d460cc47ac639c9d6d23b8cc05d4e68.tar.bz2 runq-0b7fd61b6d460cc47ac639c9d6d23b8cc05d4e68.tar.xz |
Add command to create the spool directory
Diffstat (limited to 'createspool.c')
-rw-r--r-- | createspool.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/createspool.c b/createspool.c new file mode 100644 index 0000000..6650cc8 --- /dev/null +++ b/createspool.c @@ -0,0 +1,44 @@ +#include <stdio.h> +#include <stdlib.h> +#include <sys/stat.h> + +/* + * TODO: + * This needs more error-checking + * Chmod directories which have to be group writable + */ + +int +main(int argc, char **argv) +{ + char *path; + char *tmp; + + if (argc > 1) + path = argv[1]; + else + path = "."; + + asprintf(&tmp, "%s/tmp", path); + mkdir(tmp, 0770); + free(tmp); + + asprintf(&tmp, "%s/new", path); + mkdir(tmp, 0770); + free(tmp); + + asprintf(&tmp, "%s/work", path); + mkdir(tmp, 0770); + free(tmp); + + asprintf(&tmp, "%s/failed", path); + mkdir(tmp, 0770); + free(tmp); + + asprintf(&tmp, "%s/done", path); + mkdir(tmp, 0770); + free(tmp); + + + return 0; +} |