elks-enhanced
public
Read
Owner: themaster
Branch: master
Commits: 6893
Updated: 2026-04-19 00:15
Git CLI clone URL
git clone https://www.xt-emporium.com/git/elks-enhanced.git
Fullscreen desktop URL
Code
Commits
History
Branches
Bug Reports
Discussions
Compare
Settings
elks-enhanced
/
elkscmd
/
busyelks
/
cmd
/
mkdir.c
File editor
#include <unistd.h> #include <sys/stat.h> #include <stdio.h> #include <string.h> unsigned short newmode; int make_dir(name,f) char *name; int f; { char iname[256]; char *line; strcpy(iname, name); if (((line = rindex(iname,'/')) != NULL) && f) { while ((line > iname) && (*line == '/')) --line; line[1] = 0; make_dir(iname,1); } if (mkdir(name, newmode) && !f) return(1); else return(0); } int mkdir_main (argc,argv) int argc; char **argv; { int i, parent = 0, er = 0; if ((argv[1][0] == '-') && (argv[1][1] == 'p')) parent = 1; newmode = 0777 & ~umask(0); for(i=parent+1;i<argc;i++) { if (argv[i][0] != '-') { if (argv[i][strlen(argv[i])-1] == '/') argv[i][strlen(argv[i])-1] = '\0'; if (make_dir(argv[i],parent)) { write(STDERR_FILENO,"mkdir: cannot create directory ",31); write(STDERR_FILENO,argv[i],strlen(argv[i])); write(STDERR_FILENO,"\n",1); er = 1; } } else { write(STDERR_FILENO,"mkdir: usage error.\n",20); exit(1); } } exit(er); }
Commit message
This repository is read-only for this account.
Repository snapshot
Current branch
master
Visibility
public
Your access
Read
Remote
Configured
File activity
View file history