mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 05:47:34 +00:00
Finally hook up the mkdir code to a syscall.
Added a /bin/mkdir that makes directories. How very neat :^) There are various limitations because of missing functionality.
This commit is contained in:
parent
303577df16
commit
de4604ac95
26 changed files with 238 additions and 132 deletions
1
Userland/.gitignore
vendored
1
Userland/.gitignore
vendored
|
@ -20,3 +20,4 @@ ft
|
|||
ft2
|
||||
strsignal
|
||||
fgrep
|
||||
mkdir
|
||||
|
|
|
@ -18,7 +18,8 @@ OBJS = \
|
|||
ft2.o \
|
||||
strsignal.o \
|
||||
fgrep.o \
|
||||
tty.o
|
||||
tty.o \
|
||||
mkdir.o
|
||||
|
||||
APPS = \
|
||||
id \
|
||||
|
@ -40,7 +41,8 @@ APPS = \
|
|||
ft2 \
|
||||
strsignal \
|
||||
fgrep \
|
||||
tty
|
||||
tty \
|
||||
mkdir
|
||||
|
||||
ARCH_FLAGS =
|
||||
STANDARD_FLAGS = -std=c++17 -nostdinc++ -nostdlib -nostdinc
|
||||
|
@ -120,6 +122,9 @@ tty: tty.o
|
|||
strsignal: strsignal.o
|
||||
$(LD) -o $@ $(LDFLAGS) $< ../LibC/LibC.a
|
||||
|
||||
mkdir: mkdir.o
|
||||
$(LD) -o $@ $(LDFLAGS) $< ../LibC/LibC.a
|
||||
|
||||
.cpp.o:
|
||||
@echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $<
|
||||
|
||||
|
|
21
Userland/mkdir.cpp
Normal file
21
Userland/mkdir.cpp
Normal file
|
@ -0,0 +1,21 @@
|
|||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
if (argc != 2) {
|
||||
printf("usage: mkdir <path>\n");
|
||||
return 1;
|
||||
}
|
||||
int rc = mkdir(argv[1], 0755);
|
||||
if (rc < 0) {
|
||||
perror("mkdir");
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue