1 #include <stdio.h> 2 #include <unistd.h> 3 #include <string.h> 4 #include <errno.h> 5 usage()6static int usage() 7 { 8 fprintf(stderr,"mkdir <target>\n"); 9 return -1; 10 } 11 mkdir_main(int argc,char * argv[])12int mkdir_main(int argc, char *argv[]) 13 { 14 int symbolic = 0; 15 int ret; 16 if(argc < 2) return usage(); 17 18 while(argc > 1) { 19 argc--; 20 argv++; 21 ret = mkdir(argv[0], 0777); 22 if(ret < 0) { 23 fprintf(stderr, "mkdir failed for %s, %s\n", argv[0], strerror(errno)); 24 return ret; 25 } 26 } 27 28 return 0; 29 } 30