Via: uk.ac.aston; Fri, 5 Feb 1993 18:31:00 +0000 To: jaws AT brazos DOT cray DOT com, djgpp AT sun DOT soe DOT clarkson DOT edu, engdahl AT brutus DOT aa DOT ab DOT com From: John Fletcher Date: 5 Feb 93 16:07:51 GMT Subject: DJGPP Unix-like mkdir - (was Re: Porting GCC 2.3.3) Reply-To: J DOT P DOT Fletcher AT aston DOT ac DOT uk > Subject: Re: Porting GCC 2.3.3 > To: engdahl AT brutus DOT aa DOT ab DOT com (Jon Engdahl) > Date: Thu, 4 Feb 1993 12:19:10 -0600 (CST) > From: "J.A.Wheeler" > Cc: J DOT P DOT Fletcher AT aston DOT ac DOT uk, djgpp AT sun DOT soe DOT clarkson DOT edu > } Borland C's mkdir only has one arg; UNIX's has two. According to my > } interpretation of the UNIX man page for mkdir, you should change it to > } something like > } > } status = mkdir(filename,0755); > } ^^^^^ > > The second field in the mkdir systems call is used to determine the > access permissions to the directory. Since Ms.Dos doesn't know about > multiple users, any value you plug in should be fine. Be aware though > in U**X it will be a 3 digit octal number. I'll refrain from discussing > the various values for sake of brevity. > > } There may be a more correct way to say "0755", but I think this will > } get you by. The options I can think of are using a #define'd symbol, or > } getting a value out of the tar file. I'll let one of the UNIX experts > } elaborate. > } Thank you to the people who diagnosed the problem. I attach a diff file to patch the problem, using a #define which I have called PERMISSION. John --------------------------- Diffs for zmangle.c-------------------- *** zmangle.c Fri Feb 5 15:51:16 1993 --- zmanglen.c Fri Feb 5 15:49:34 1993 *************** *** 36,43 **** */ - #include #include #include --- 36,44 ---- */ + /* Fix for Unix-like mkdir */ + #define PERMISSION 0755 #include #include #include *************** *** 135,147 **** if(type==chFILE && (file=open(new,WACCESS,MODE))<0 ! || type==chDIR && mkdir(new)) { /* collapse ".Z" to "z" */ if(strcmp(&nm[len-2],".z")==0)strcpy(&nm[len-2],"z"); if(type==chFILE && (file=open(new,WACCESS,MODE))<0 ! || type==chDIR && mkdir(new)) { /* mangle the extension */ --- 136,148 ---- if(type==chFILE && (file=open(new,WACCESS,MODE))<0 ! || type==chDIR && mkdir(new,PERMISSION)) { /* collapse ".Z" to "z" */ if(strcmp(&nm[len-2],".z")==0)strcpy(&nm[len-2],"z"); if(type==chFILE && (file=open(new,WACCESS,MODE))<0 ! || type==chDIR && mkdir(new,PERMISSION)) { /* mangle the extension */ *************** *** 166,172 **** } } if(type==chFILE && (file=open(new,WACCESS,MODE))<0 ! || type==chDIR && mkdir(new)) { /* getting nervous, try fixing the name */ --- 167,173 ---- } } if(type==chFILE && (file=open(new,WACCESS,MODE))<0 ! || type==chDIR && mkdir(new,PERMISSION)) { /* getting nervous, try fixing the name */ *************** *** 187,193 **** i++; } if(type==chFILE && (file=open(new,WACCESS,MODE))<0 ! || type==chDIR && mkdir(new)) { /* mangle to a 7 character name */ /* and tack a random character on the end */ --- 188,194 ---- i++; } if(type==chFILE && (file=open(new,WACCESS,MODE))<0 ! || type==chDIR && mkdir(new,PERMISSION)) { /* mangle to a 7 character name */ /* and tack a random character on the end */ *************** *** 211,217 **** { pos[-1] = 'a'+i; if(type==chFILE && (file=open(new,WACCESS,MODE))<0 ! || type==chDIR && mkdir(new)) { i++; } --- 212,219 ---- { pos[-1] = 'a'+i; if(type==chFILE && (file=open(new,WACCESS,MODE))<0 ! || type==chDIR && ! mkdir(new,PERMISSION)) { i++; } *************** *** 237,243 **** if (pos && (strchr(user, '/') == 0))strcpy(pos+1,user); else strcpy(new,user); if(!(type==chFILE && (file=open(new,WACCESS,MODE))<0 ! || type==chDIR && mkdir(new)))break; } } while(new[0]=='!'); --- 239,246 ---- if (pos && (strchr(user, '/') == 0))strcpy(pos+1,user); else strcpy(new,user); if(!(type==chFILE && (file=open(new,WACCESS,MODE))<0 ! || type==chDIR && ! mkdir(new,PERMISSION)))break; } } while(new[0]=='!'); -------------------------------------end of diffs--------------------- --------------------------------------------------------------------- Dr John P. Fletcher Department of Chemical Engineering and Applied Chemistry, Aston University, Tel: (44) 21 359 3611 ext 4625 Aston Triangle, Email(Most systems): J DOT P DOT FLETCHER AT ASTON DOT AC DOT UK BIRMINGHAM B4 7ET U.K. Email(JANET only): J DOT P DOT FLETCHER AT UK DOT AC DOT ASTON ---------------------------------------------------------------------