Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=fw32.git;a=commitdiff;h=fe70a98480afc1b4f7672b45371a3dd23c1cef4d
commit fe70a98480afc1b4f7672b45371a3dd23c1cef4d Author: James Buren <r...@frugalware.org> Date: Wed Nov 2 03:38:18 2011 -0500 fw32.c: simply mkdir_parents loop diff --git a/fw32.c b/fw32.c index 0fb53fd..241e234 100644 --- a/fw32.c +++ b/fw32.c @@ -33,26 +33,20 @@ mkdir_parents(const char *s) snprintf(path,sizeof path,"%s",s); - for( p = strchr(path + 1,'/') ; p && *p ; p = strchr(p + 1,'/') ) + for( p = strchr(path + 1,'/') ; p && *p ; *p = '/', p = strchr(p + 1,'/') ) { *p = 0; if(!stat(path,&st)) { if(S_ISDIR(st.st_mode)) - { - *p = '/'; - continue; - } error("Parent directory exists and is not a directory: %s\n",path); } if(mkdir(path,0755)) error("Failed to create parent directory: %s\n",path); - - *p = '/'; } if(!stat(path,&st)) @@ -66,3 +60,5 @@ mkdir_parents(const char *s) if(mkdir(path,0755)) error("Failed to create directory: %s\n",path); } + +int main(int argc,char **argv) { mkdir_parents(argv[1]); } _______________________________________________ Frugalware-git mailing list Frugalware-git@frugalware.org http://frugalware.org/mailman/listinfo/frugalware-git