This commit is contained in:
Your Name 2023-11-02 02:51:11 +03:00
parent 4d8b780c00
commit 44f7c3a669
3 changed files with 17 additions and 13 deletions

View File

@ -1,4 +1,4 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004 Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net> Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>

View File

@ -71,7 +71,7 @@ int main(const int argc, const char **argv) {
else { else {
printf("mknod [-m=mode] [NAME] [TYPE] [MAJOR MINOR]\n"); printf("mknod [-m=mode] [NAME] [TYPE] [MAJOR MINOR]\n");
printf("Types:\n b - block deviece\n c or u - character device\n p - fifo (MAJOR MINOR must be omitted)\n s - socket\n"); printf("Types:\n b - block device\n c or u - character device\n p - fifo (MAJOR MINOR must be omitted)\n s - socket\n");
return 0; return 0;
} }

View File

@ -8,15 +8,19 @@
#define O(x) (x) #define O(x) (x)
#define A(x) (U(x) | G(x) | O(x)) #define A(x) (U(x) | G(x) | O(x))
#define FULL_PERM ((S_IRUSR | S_IRGRP | S_IROTH) | (S_IWUSR | S_IWGRP | S_IWOTH) | (S_IXUSR | S_IXGRP | S_IXOTH)) #define WR_PERM (2)
#define EX_PERM (1)
#define RD_PERM (4)
#define FULL_PERM (7)
mode_t mu_parse_mode(const char *s) { mode_t mu_parse_mode(const char *s) {
char *p = NULL; char *p = NULL;
mode_t mode = (mode_t)strtol(s, &p, 8); mode_t mode = (mode_t)strtol(s, &p, 8);
if (!*p) if (!*p && mode < 07777U)
return mode; return mode;
//TODO return -1;
return A(7);
} }
#endif #endif