Added src/mkdir.c, src/rm.c, some tips for commiters and close file descriptor in src/touch.c
This commit is contained in:
parent
cb17679d67
commit
62ecbded92
9
STYLE.MD
9
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/()
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
* The rest of programs.
|
||||
* Manuals
|
||||
* flags for the programs
|
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue