summary refs log tree commit diff
path: root/progs/mkdir/mkdir.c
blob: cbf5cdf6842b4808698883b47058c4427f4a811a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/stat.h>

int main(int argc, char *argv[]) {
    if (!argv[1]) {
        write(1, "you IDIOT, you forgot to include the file name, MORON\n", 55);
        exit(1);
    }
    struct stat st = {0};

    if (stat(argv[1], &st) == -1) {
        mkdir(argv[1], 0700);
    }
    exit(0);
}