Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83 (MC840302); site ecrcvax.UUCP Path: utzoo!linus!philabs!cmcl2!seismo!mcvax!unido!ecrcvax!pete From: p...@ecrcvax.UUCP (Pete Delaney) Newsgroups: net.wanted.sources,net.bugs.4bsd,net.general Subject: Need cpio.c source Message-ID: <55@ecrcvax.UUCP> Date: Fri, 26-Apr-85 15:21:27 EDT Article-I.D.: ecrcvax.55 Posted: Fri Apr 26 15:21:27 1985 Date-Received: Sun, 28-Apr-85 07:04:28 EDT Organization: ECRC, D-8000 Muenchen 81, W. Germany Lines: 19 Sigh. For some strange reason Berkely 4.2 doesn't come with SCCS or cpio. These turkeys makeing releases should get their sh*t together! Would someone out there in net land please send a copy of the new System V cpio so we can read our release tape so that we can get the source of SCCS, so that we can use the latest kernel. SUMMARY: Please send a copy oc cpio.c that supports the new ASCII headers (ie: the -c option). If any other library functions not found in System 5 are required please send them also. I would prefer a copy already running on 4.2BSD. -- Pete Delaney - Rockey Mnt UNIX Consultant Phone: (49) 89 9269-139 European Computer-Industry Research Center UUCP: mcvax!unido!ecrcvax!pete ArabellaStrasse 17 UUCP Domain: p...@ecrcvax.UUCP D-8000 Muenchen 81, West Germany X25: (262)-45890040262 CSNET:pete%ecrcvax.U...@Germany.CSNET Login: <to be provided?>
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site burl.UUCP Path: utzoo!watmath!clyde!burl!rcj From: r...@burl.UUCP (R. Curtis Jackson) Newsgroups: net.followup Subject: Re: Need cpio.c source Message-ID: <675@burl.UUCP> Date: Mon, 29-Apr-85 11:03:37 EDT Article-I.D.: burl.675 Posted: Mon Apr 29 11:03:37 1985 Date-Received: Tue, 30-Apr-85 07:15:54 EDT References: <55@ecrcvax.UUCP> Organization: AT&T Technologies, Burlington NC Lines: 25 > > Sigh. For some strange reason Berkely 4.2 doesn't come with > SCCS or cpio. These turkeys makeing releases should get their sh*t > together! Would someone out there in net land please send a copy of > the new System V cpio so we can read our release tape so that we can > get the source of SCCS, so that we can use the latest kernel. > > SUMMARY: > Please send a copy oc cpio.c that supports the > new ASCII headers (ie: the -c option). If any > other library functions not found in System 5 > are required please send them also. I would > prefer a copy already running on 4.2BSD. > -- Is it just my imagination or is this person asking System V owners to break their licensing agreements by sending him proprietary code? Perhaps I don't understand the Berkeley licensing system well enough, but it seems to me that if you don't pay for System V you don't get (any of) System V. Comments/more info? -- The MAD Programmer -- 919-228-3313 (Cornet 291) alias: Curtis Jackson ...![ ihnp4 ulysses cbosgd mgnetp ]!burl!rcj ...![ ihnp4 cbosgd akgua masscomp ]!clyde!rcj
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site x.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!cybvax0!frog! x!john From: j...@x.UUCP (John Woods) Newsgroups: net.followup Subject: Re: Need cpio.c source Message-ID: <484@x.UUCP> Date: Tue, 30-Apr-85 12:46:29 EDT Article-I.D.: x.484 Posted: Tue Apr 30 12:46:29 1985 Date-Received: Thu, 2-May-85 01:01:44 EDT References: <55@ecrcvax.UUCP> <675@burl.UUCP> Organization: Charles River Data Systems, Framingham MA Lines: 25 > > Sigh. For some strange reason Berkely 4.2 doesn't come with > > SCCS or cpio. These turkeys makeing releases should get their sh*t > > together! Would someone out there in net land please send a copy of > > the new System V cpio so we can read our release tape so that we can > > get the source of SCCS, so that we can use the latest kernel. > > > Is it just my imagination or is this person asking System V owners > to break their licensing agreements by sending him proprietary code? > Perhaps I don't understand the Berkeley licensing system well enough, > but it seems to me that if you don't pay for System V you don't get > (any of) System V. Comments/more info? > -- First, if the person has a "release tape" in CPIO format, I'd think that they have a System V release tape, and just don't know how to extract cpio from the boot block. Unless they are completely confused, and think that their tar tape is in CPIO format. On the other hand, writing a program to interpret CPIO format is not very hard. -- John Woods, Charles River Data Systems, Framingham MA, (617) 626-1101 ...!decvax!frog!john, ...!mit-eddie!jfw, jfw%mit-...@MIT-XX.ARPA The above opinions are those exclusively of superior beings. If you don't share them, I'm not surprised.
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84 SMI; site sun.uucp Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!decvax! decwrl!sun!guy From: g...@sun.uucp (Guy Harris) Newsgroups: net.wanted.sources,net.bugs.4bsd Subject: Re: Need cpio.c source Message-ID: <2148@sun.uucp> Date: Tue, 30-Apr-85 02:55:02 EDT Article-I.D.: sun.2148 Posted: Tue Apr 30 02:55:02 1985 Date-Received: Thu, 2-May-85 00:46:48 EDT References: <55@ecrcvax.UUCP> Organization: Sun Microsystems, Inc. Lines: 12 > > Sigh. For some strange reason Berkely 4.2 doesn't come with > SCCS or cpio. These turkeys makeing releases should get their sh*t > together! The "strange reason" is called "AT&T licensing requirements". SCCS and "cpio" both require System V source licenses; 4.2BSD does not require such a license. The University of California would have plenty of deep legal sh*t already gotten together for their benefit by AT&T if they offered either SCCS or "cpio" with 4.2BSD. Guy Harris
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84 SMI; site sun.uucp Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!decvax! decwrl!sun!gnu From: g...@sun.uucp (John Gilmore) Newsgroups: net.wanted.sources,net.bugs.4bsd Subject: Re: Need cpio.c source Message-ID: <2149@sun.uucp> Date: Tue, 30-Apr-85 04:29:39 EDT Article-I.D.: sun.2149 Posted: Tue Apr 30 04:29:39 1985 Date-Received: Thu, 2-May-85 00:47:51 EDT References: <55@ecrcvax.UUCP> <2148@sun.uucp> Organization: Sun Microsystems, Inc. Lines: 8 You can always dd the whole tape into a file and search for the cpio sources within the tape image. I believe SysV cpio doesn't instantly work on 4.2 but it's not hard to fix. Now wouldn't it have been nice if Sys V source tapes put cpio.c on the front? (As the first file dumped in the cpio file containing all the sources.) Of course if they'd wanted to be really nice they'd have used tar instead...
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site phri.UUCP Path: utzoo!watmath!clyde!cbosgd!ihnp4!houxm!vax135!timeinc!phri!roy From: r...@phri.UUCP (Roy Smith) Newsgroups: net.followup,net.sources Subject: Re: Need cpio.c source Message-ID: <219@phri.UUCP> Date: Thu, 2-May-85 15:22:36 EDT Article-I.D.: phri.219 Posted: Thu May 2 15:22:36 1985 Date-Received: Fri, 3-May-85 23:37:02 EDT References: <55@ecrcvax.UUCP> <675@burl.UUCP> <484@x.UUCP> Distribution: net Organization: Public Health Research Inst. (NY, NY) Lines: 43 > First, if the person has a "release tape" in CPIO format, I'd think that > they have a System V release tape, and just don't know how to extract > cpio from the boot block. Imagine the following scenario (which was indeed the case at my site). You have both 4.2 BSD and Sys 5 source licenses and distributions. You are running 4.2 on your single RA-81 drive system. You want to get some of the utilities off the Sys 5 tape. What do you do? Well, you could do a from-scratch installation of Sys 5 and copy the cpio source to a tape, but wait! This means having to dump your whole 4.2 system and then re-install it, but that won't work anyway because Sys 5 (at least the distribution I got) doesn't know about uda-50 drives (fie on Western Electric). So, again, what do you do? You sit down with the Sys 5 hardcopy manual and write a bare-bones cpio tape lister. Hey, it works, and only took a couple of hours. You're feeling good about the universe in general at this point, but it's a real drag waiting for the tape to spin every time you try a new version. No problem, you 'dd' the entire /usr file system from the tape to disk (you have a fairly new system so you still have gobs of free disk space, lucky you). You hack up the lister a bit to turn it into a bare-bones extractor, and use that to get off the cpio sources. This works too, still feeling good. Compile the real cpio, no errors. Try it out, it works just like it's supposed to. Hey, this is real cool, life is wonderful, cries of joy and exultation! Then suddenly, MASSIVE DOWNER! Shock, disbelief, dismay, emotional pain and suffering, BUMMER! The graphics stuff is missing! You read the manual over and over again and finally realize that the Administrative guide and the System Release Description differ on how many cpio files are on the tape. You decide the SRD is right and it turns out to be so. You decide that the universe is wonderful again and your karma is back in alignment. The bottom line is that I have a program which reads cpio tapes which I wrote myself working only from the documentation (that makes it public domain, yes?). If anybody wants it, it's yours for the asking. Given sufficient interest, I'll post it to the net. I'll hold off a couple of days on answering requests for it to give anybody who is knowledgeable about licensing (Mark Horton?) to tell me I'm not allowed to do this. -- allegra!phri!roy (Roy Smith) System Administrator, Public Health Research Institute
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site phri.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!ihnp4!houxm!vax135!timeinc! phri!roy From: r...@phri.UUCP (Roy Smith) Newsgroups: net.sources Subject: Public Domain cpio available Message-ID: <220@phri.UUCP> Date: Fri, 3-May-85 22:20:22 EDT Article-I.D.: phri.220 Posted: Fri May 3 22:20:22 1985 Date-Received: Sun, 5-May-85 23:40:11 EDT References: <55@ecrcvax.UUCP> <675@burl.UUCP> <484@x.UUCP> <219@phri.UUCP> Distribution: net Organization: Public Health Research Inst. (NY, NY) Lines: 340 > The bottom line is that I have a program which reads cpio tapes > which I wrote myself working only from the documentation (that makes it > public domain, yes?). If anybody wants it, it's yours for the asking. Well, folks... here it is: ------Taketh all that lies above this line, and cast it into the void----- # This is a shell archive. Remove anything before this line, # then unpack it by saving it in a file and typing "sh file". # # Wrapped by phri!roy on Fri May 3 22:09:00 EDT 1985 # Contents: READ_ME cpiolist.c cpioextract.c echo x - READ_ME sed 's/^@//' > "READ_ME" <<'@//E*O*F READ_ME//' What we have here is a stripped-down pair of programs which can, in the barest marginal sense, allow you to read cpio tapes. They were written for one particular purpose without the expectation that they would ever be used again, so no attempt was made to support any functionality beyond the dead minimum. The reason I wrote these programs was to be able to read my Sys5 distribution tapes on my 4.2 bsd system. The idea was that I would use cpiolist to get a listing of all the files on the /usr file system, and then (once I knew the names of the required files) use cpioextract to pull off the source for the 'real' cpio, compile that under 4.2, and use it to do the rest of the job correctly. Notice 3 important things. First, cpioextract only extracts a single file per invocation. Second, it expects all of the directories along the path to that file to be created already. Third, these programs only know about binary header type cpio archives (i.e. tapes made WITHOUT the -c flag). This is the way the Sys5 distribution was done (at least the distribution I got). Various caveats: These programs were written from the Sys 5 documentation describing the cpio file formats. From what I can gather, since I did not look at the Sys 5 cpio sources while I was writing this, it should qualify as public domain. The primary purpose of these programs is to bootstrap a full-fledged cpio from a Sys 5 distribution tape onto a system which doesn't have cpio already (i.e. 4.2 bsd). Having these programs will give you the technical means of doing this; it may not give you the legal right. I am far from qualified to pass judgement on the issues of what a particular Unix (tm) license allow you to do. Use these programs at your own risk. All I will say is that as a holder of both Sys 5 and 4.2 bsd source licenses, I am allowed to port the Sys 5 utilities to my 4.2 system. If you don't hold both licenses, you probably aren't. Eventually, I will get around to adding more functionality to these programs. The top of the list features are the '-c' and '-d' flags, and then pattern matching for file names. If I ever get around to doing those, I'll post the updated versions. If you find any problems with either of these programs, please feel free to contact me. I'll be happy to help if I can, but please don't expect me to have the updated versions ready on any particular schedule. allegra!phri!roy (Roy Smith) System Administrator, Public Health Research Institute @//E*O*F READ_ME// chmod u=rw,g=r,o=r READ_ME echo x - cpiolist.c sed 's/^@//' > "cpiolist.c" <<'@//E*O*F cpiolist.c//' /* * Cpiolist.c -- list a cpio tape written with binary headers * (i.e. written without the -c option). Usage is "cpiolist file" * where 'file' is the cpio archive (probably /dev/rmt12). * * Writen, produced, and directed by: * Roy Smith <allegra!phri!roy> * The Public Health Research Institute * of the City of New York, Inc. * 455 First Avenue * New York, NY 10016 */ struct hdr { short h_magic; short h_dev; unsigned short h_ino; unsigned short h_mode; unsigned short h_uid; unsigned short h_gid; short h_nlink; short h_rdev; short h_mtime[2]; short h_namesize; short h_filesize[2]; }; struct longword { short word[2]; }; main (argc, argv) int argc; char *argv []; { struct hdr header; int n, i, fd, odd, size; struct longword *lwp; char c, *ctime(), name[100]; short temp; /* * Attempt to open the cpio archive file. */ if ((fd = open (argv[1], 0)) < 0) { printf ("can't open file\n"); exit (1); } while (1) { /* Read in a header */ n = read (fd, &header, sizeof (header)); /* * The high and low order words of the time are * in the wrong order on the tape; swap them. */ temp = header.h_mtime[0]; header.h_mtime[0] = header.h_mtime[1]; header.h_mtime[1] = temp; /* likewise, swap the high and low order sizes */ lwp = (struct longword *) &size; lwp->word[0] = header.h_filesize[1]; lwp->word[1] = header.h_filesize[0]; /* check for trouble */ if (header.h_magic != 070707) { printf ("out of sync!\n"); exit (1); } /* print the header info */ printf ("%5d", header.h_ino); printf ("%9#o ", header.h_mode); printf ("%.24s", ctime (header.h_mtime)); printf ("%7d ", size); /* * read in the file name -- notice that if the name is * an odd number of bytes long, it is padded to be even. */ if ((n = header.h_namesize) % 2 != 0) odd = 1; else odd = 0; i = 0; while (n--) { read (fd, &c, 1); name [i++] = c; } printf ("%s\n", name); if (odd) read (fd, &c, 1); /* the file data is likewise padded */ if (size % 2 != 0) size++; /* * we don't actually want the file, * so just skip to the next header. */ lseek (fd, size, 1); } } @//E*O*F cpiolist.c// chmod u=rw,g=r,o=r cpiolist.c echo x - cpioextract.c sed 's/^@//' > "cpioextract.c" <<'@//E*O*F cpioextract.c//' /* * Cpioextract.c -- extract a single file from a cpio archive * written with binary headers (i.e. without the -c option) * * Usage is: cpioextract cpio_archive_file archived_file_name * * Written by: * Roy Smith <allegra!phri!roy> * The Public Health Research Institute * of the City of New York, Inc. * 455 First Avenue, New York, NY 10016 */ struct hdr { short h_magic; short h_dev; unsigned short h_ino; unsigned short h_mode; unsigned short h_uid; unsigned short h_gid; short h_nlink; short h_rdev; short h_mtime[2]; short h_namesize; short h_filesize[2]; }; struct longword { short word[2]; }; main (argc, argv) int argc; char *argv []; { struct hdr header; int n, i, fd, odd, size; struct longword *lwp; char c, *ctime(), name[100]; short temp; /* attempt to open cpio archive file */ if ((fd = open (argv[1], 0)) < 0) { printf ("can't open file\n"); exit (1); } while (1) { /* read in a header */ n = read (fd, &header, sizeof (header)); /* tape has high and low order times reversed, fix them */ temp = header.h_mtime[0]; header.h_mtime[0] = header.h_mtime[1]; header.h_mtime[1] = temp; /* likewise, the file size */ lwp = (struct longword *) &size; lwp->word[0] = header.h_filesize[1]; lwp->word[1] = header.h_filesize[0]; /* sanity check */ if (header.h_magic != 070707) { printf ("out of sync!\n"); exit (1); } /* * if the file name is an odd number of characters, it is * padded on the tape to be even; deal with this. */ if ((n = header.h_namesize) % 2 != 0) odd = 1; else odd = 0; /* read the file name from the archive */ i = 0; while (n--) { read (fd, &c, 1); name [i++] = c; } if (odd) read (fd, &c, 1); /* is this the file we want? */ if (strcmp (name, argv[2]) == 0) { copyout (fd, size); exit (0); } else { /* * this wasn't the right file; skip past it (and one * extra padding byte if the file size was odd). */ if (size % 2 != 0) size++; lseek (fd, size, 1); } } } /* * pull a file out of the archive. fd is a file descriptor for the * cpio archive, n is the size of the file we are supposed to get. * the file is output to standard output. */ copyout (fd, n) int fd, n; { int nk; char buf[1024]; /* * how many full kilobyte blocks are there, * and how many bytes left over? */ */ nk = n / 1024; n %= 1024; /* get all the whole blocks */ while (nk--) { read (fd, buf, 1024); write (1, buf, 1024); } /* and get the residual fractional kilobyte */ read (fd, buf, n); write (1, buf, n); } @//E*O*F cpioextract.c// chmod u=rw,g=r,o=r cpioextract.c echo Inspecting for damage in transit... temp=/tmp/shar$$; dtemp=/tmp/.shar$$ trap "rm -f $temp $dtemp; exit" 0 1 2 3 15 cat > $temp <<\!!! 41 448 2496 READ_ME 113 369 2210 cpiolist.c 139 462 2626 cpioextract.c 293 1279 7332 total !!! wc READ_ME cpiolist.c cpioextract.c | sed 's=[^ ]*/==' | diff -b $temp - >$dtemp if [ -s $dtemp ] then echo "Ouch [diff of wc output]:" ; cat $dtemp else echo "No problems found." fi exit 0 -- allegra!phri!roy (Roy Smith) System Administrator, Public Health Research Institute
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site bu-cs.UUCP Path: utzoo!linus!philabs!cmcl2!seismo!harvard!bu-cs!bzs From: b...@bu-cs.UUCP (Barry Shein) Newsgroups: net.wanted.sources,net.bugs.4bsd Subject: Re: Need cpio.c source Message-ID: <382@bu-cs.UUCP> Date: Sun, 5-May-85 22:52:30 EDT Article-I.D.: bu-cs.382 Posted: Sun May 5 22:52:30 1985 Date-Received: Tue, 7-May-85 21:18:43 EDT References: <55@ecrcvax.UUCP> <2148@sun.uucp>, <2149@sun.uucp> Organization: Boston Univ Comp. Sci. Lines: 180 The following is a hack I threw together to bootstrap cpio.c off of my SYSV tape. It only reads cpio tapes (hence the name, cpi). As I said, it's a hack but all the hard work is done and you can have it.... -Barry Shein, Boston University ------------ #include <stdio.h> #include <sys/types.h> #include <sys/file.h> /* * cpi.c - read a cpio tape * usage: cpi prefix * will read in and create all files (and dirs) that * match the prefix, for example 'cpi src/cmd' will * read in src/cmd/foo.c src/cmd/thing/goo.c etc. * TODO- * cmd line: add tape drive, blksize,word/byte swap * maybe more sophisticated selection of files * doesn't check for TRAILER record at end of tape, * just gives an error message and gives up * * Look, this was a hack to get cpio.c off of a SYSV tape. * It could use some cosmetics but all the hard work is done. * * (C) Barry Shein, Boston University * You have the right to distribute this to whomever you * like as long as you don't remove my name so I can become * famous for adding yet another unsupportable hack to the UNIX * environment. If you give this away, give it with source, please. */ FILE *fcreat() ; struct cpio { short h_magic, h_dev; ushort h_ino, h_mode, h_uid, h_gid; ushort h_nlink, h_rdev, h_mtime[2], h_namesize, h_filesize[2] ; } ; #define BSIZE 5120 /* oughta be settable from cmd line */ char fbuf[BSIZE], *fbufp ; int fbufk = 0 ; #define MAXNAME 256 /* actually a cpio limit */ #define DEFTAPE "/dev/rmt0" /* oughta be settable from cmd line */ main(argc,argv) int argc ; char **argv ; { struct cpio cpio ; char namebuf[MAXNAME] ; char buf[BSIZE] ; register short *sip ; int fd ; int siz ; int i,j ; int *ip ; int fsize ; char *prfx ; int prfxl ; FILE *fp ; if(argc != 2) exit(printf("usage: %s prefix\n",*argv)) ; if((fd = open(DEFTAPE,0)) < 0) exit(perror(DEFTAPE)) ; prfx = argv[1] ; prfxl = strlen(prfx) ; siz = sizeof(cpio) ; again: cread(fd,&cpio,siz) ; #ifdef notdef /* 3B5 needed byte swapping */ swabw(&cpio,siz/2) ; printf("MAGIC: %07o\tUID: %6d\n",cpio.h_magic, cpio.h_uid) ; #endif /* rebuild the long, if you re-declare as long alignment gets ya */ fsize = (cpio.h_filesize[0] << 16) | cpio.h_filesize[1] ; #ifdef notdef printf("NSIZE: %8d\tFSIZE: %8d\n",cpio.h_namesize,fsize) ; #endif /* this is also what you will hear on end-of-tape */ if((cpio.h_namesize < 0) || (cpio.h_namesize > MAXNAME)) { printf("ridiculous name, giving up\n") ; printf("(fbufk = %d)\n",fbufk) ; exit(1) ; } /* NOTE: rounded up to even, will be padded on tape */ i = (cpio.h_namesize & 01) ? cpio.h_namesize + 1 : cpio.h_namesize ; cread(fd,namebuf,i) ; /* printf("NAME: %s\n",namebuf) ;*/ j = fsize ; if((j > 0) && (strncmp(namebuf,prfx,prfxl) == 0)) { if((fp = fcreat(namebuf)) == NULL) perror(namebuf) ; else printf("%s\n",namebuf) ; /* always 'verbose' */ } else fp = NULL ; while(j > 0) { /* read in BSIZE pieces */ if((i = cread(fd,buf,(j >= BSIZE) ? BSIZE : j)) <= 0) { printf("Error reading tape? (%s)\n",namebuf) ; exit(1) ; } j -= i ; /* see, I already had fcreat() from another thing I wrote */ /* really shoulda made it not stdio but who cares */ if(fp != NULL) write(fileno(fp),buf,i) ; } if(fp != NULL) fclose(fp) ; if(fsize & 1) cread(fd,buf,1) ; /* get pad byte */ goto again ; } /* buffered read */ cread(fd,bp,n) int fd ; register char *bp ; register int n ; { int nb = 0 ; while(n--) { if(fbufk <= 0) if((fbufk = read(fd,fbufp = fbuf,BSIZE)) <= 0) return(nb) ; *bp++ = *fbufp++ ; --fbufk ; nb++ ; } return(nb) ; } wswab(i) int i ; { return(((i & 0xff00) >> 8) | ((i & 0xff) << 8)) ; } swabw(sip,l) register short int *sip ; register int l ; { while(l--) *sip++ = wswab(*sip) ; } /* * bit of craziness to create output file. Will * attempt to create all intervening path names. * you're gonna need a mkdir() routine. */ FILE * fcreat(path) char *path ; { char buf[BUFSIZ] ; register char *bp ; strcpy(buf,path) ; bp = &buf[strlen(buf) - 1] ; while((*bp != '/') && (bp >= &buf[0])) bp-- ; if(*bp != '/') return(NULL) ; *bp = '\0' ; if(access(buf,F_OK) < 0) { char c ; for(bp = buf ;; bp++) { if((c = *bp) && (*bp != '/')) continue ; *bp = '\0' ; if(access(buf,F_OK) < 0) if(mkdir(buf,0777) < 0) return(NULL) ; if(c == '\0') break ; *bp = '/' ; } } return(fopen(path,"w")) ; }