diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | createspool.c | 44 |
2 files changed, 45 insertions, 0 deletions
@@ -1,3 +1,4 @@ batchd newbatch run +createspool 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; +} |