commit 62ecbded9266000d9ba887ecf8075a8a61172d2f
parent cb17679d676d67fd4893dd4f07dd7e461eabdf4a
Author: qorg11 <qorg@vxempire.xyz>
Date: Tue, 2 Jun 2020 01:56:22 +0200
Added src/mkdir.c, src/rm.c, some tips for commiters and close file descriptor in src/touch.c
Diffstat:
5 files changed, 58 insertions(+), 0 deletions(-)
diff --git a/STYLE.MD b/STYLE.MD
@@ -70,3 +70,12 @@ chmod("whatever",420)
chmod("whatever",420) /* 420 is 644 in decimal
~~~
+
+## For commiters
+
+Commiters may or may not be anonymous. If you want to be
+anonymous. Set whatever you want to git name and git email.
+
+If you don't want to be anonymous, you should sign your commits using
+gpg. See
+[this]https://docs.gitlab.com/ee/user/project/repository/gpg_signed_commits/()
diff --git a/TODO b/TODO
@@ -0,0 +1,3 @@
+* The rest of programs.
+* Manuals
+* flags for the programs
diff --git a/src/mkdir.c b/src/mkdir.c
@@ -0,0 +1,22 @@
+#include <stdio.h>
+#include <sys/stat.h>
+
+int
+main(int argc, char *argv[])
+{
+ if (argc == 1)
+ {
+ fprintf(stderr,"specify path(s) to make\n");
+ return 1;
+ }
+ for(int i = 1; i<argc;i++)
+ {
+ int fd = mkdir(argv[i],420);
+ if(fd == -1)
+ {
+ fprintf(stderr,"Error creating dir %s\n",argv[i]);
+ return 1;
+ }
+ }
+ return 0;
+}
diff --git a/src/rm.c b/src/rm.c
@@ -0,0 +1,22 @@
+#include <stdio.h>
+
+int
+main(int argc, char *argv[])
+{
+ if (argc == 1)
+ {
+ printf("Specify files to remove.\n");
+ return 1;
+ }
+
+ for(int i = 1; i<argc;i++)
+ {
+ int fd = remove(argv[i]);
+ if(fd == -1)
+ {
+ fprintf(stderr,"Error removing file: %s\n",argv[i]);
+
+ }
+ }
+ return 0;
+}
diff --git a/src/touch.c b/src/touch.c
@@ -1,6 +1,7 @@
#include <fcntl.h>
#include <stdio.h>
#include <sys/stat.h>
+#include <unistd.h>
int
main(int argc, char *argv[])
@@ -19,5 +20,6 @@ main(int argc, char *argv[])
return 1;
}
chmod(argv[1],420); /* 644 in decimal */
+ close(fd);
return 0;
}