home *** CD-ROM | disk | FTP | other *** search
- 30-Aug-86 23:01:16-PDT,4302;000000000001
- Return-Path: <standorf@CECOM-2.ARPA>
- Received: from CECOM-2 by SUMEX-AIM.ARPA with TCP; Sat 30 Aug 86 23:00:48-PDT
- Date: Sun, 31 Aug 86 1:12:13 EDT
- From: Gary P Standorf <standorf@CECOM-2.ARPA>
- To: info-mac@sumex-aim.ARPA
- cc: l-info-mac@CECOM-2.ARPA, standorf@CECOM-2.ARPA
- Subject: MacBin program for Unix systems
-
- The macbin program runs on a Unix machine to create a MacBinary format file
- from the 3 Unix files created when uploaded using macget
- (MacTerminal 1.1 emulator), or having dehexified a .hqx file using xbin.
-
- This is useful for downloading to a Macintosh running a terminal emulator
- that is using the MacBinary protocol.
-
- Note: to run this program on a System V Unix system, remove all calls to
- the bzero() procedure. It doesn't exist on System V, and isn't needed.
-
- This particular copy was downloaded from Genie.
-
- [ will be called [SUMEX-AIM.Stanford.EDU]<INFO-MAC>UNIX-MACBINARY.SHAR
- DAVEG ]
-
- Gary Standorf
- <standorf@cecom-2.arpa>
-
- ------------------------------------------
-
- From: jimb@amdcad
- Newsgroups: net.sources.mac
- Subject: xbin to macbin converter (C source)
- Date: Tue, 25-Feb-86 03:43:54 EST
- Reply-To: jimb@amdcad.UUCP (Jim Budler)
- Organization: AMD, Sunnyvale, California
- Lines: 121
-
- The following program takes the three files created by xbin (.info .data
- and .rsrc) and makes a MacBinary format file out of them. It checks for the
- protected bit and moves that if present as required by MacBinary.
-
- Easy to use:
-
- if you have the three files file.info, file.data, file.rsrc
-
- type 'macbin file'
-
- and it will create file.bin
-
- -----------------< cut here >---------------------
- #! /bin/sh
- # This is a shell archive, meaning:
- # 1. Remove everything above the #! /bin/sh line.
- # 2. Save the resulting text in a file.
- # 3. Execute the file with /bin/sh (not csh) to create the files:
- # macbin.c
- # This archive created: Tue Feb 25 00:42:49 1986
- export PATH; PATH=/bin:$PATH
- echo shar: extracting "'macbin.c'" '(1697 characters)'
- if test -f 'macbin.c'
- then
- echo shar: will not over-write existing file "'macbin.c'"
- else
- cat << \SHAR_EOF > 'macbin.c'
- #include <stdio.h>
- main(argc,argv)
- int argc;
- char **argv;
- {
- /* structure of the info file - from MacBin.C
- char zero1;
- char nlen;
- char name[63];
- char type[4]; 65 0101
- char creator[4]; 69
- char flags; 73
- char zero2; 74 0112
- char location[6]; 80
- char protected; 81 0121
- char zero3; 82 0122
- char dflen[4];
- char rflen[4];
- char cdate[4];
- char mdate[4];
- */
- FILE *fd, *ofd;
- char iname[128];
- char dname[128];
- char rname[128];
- char oname[128];
- char buf[128];
- if (argc != 2) {
- fprintf(stderr,"\nUsage: %s filename\n",argv[0]);
- exit(1);
- }
- bzero(buf,128);
- strcpy(oname,argv[1]);
- strcat(oname,".bin");
- if ((ofd = fopen( oname, "w")) == NULL){
- fprintf(stderr, "\n Cannot open %s\n",oname);
- exit(1);
- }
- strcpy(iname,argv[1]);
- strcat(iname,".info");
- if ((fd = fopen(iname,"r")) == NULL){
- fprintf(stderr,"No %s file!\n", iname);
- fclose(ofd);
- unlink(oname);
- exit(1);
- }
- if (fread(buf, sizeof(*buf), 128, fd) > 0){
- if (buf[74] & 0x40) buf[81] = '\1'; /* protected */
- buf[74] = '\0'; /* clear zero2 */
- fwrite(buf, sizeof(*buf),128, ofd);
- bzero(buf,128);
- }
- fclose(fd);
- strcpy(dname,argv[1]);
- strcat(dname,".data");
- if ((fd = fopen(dname,"r")) == NULL){
- fprintf(stderr,"No %s file!\n", dname);
- fclose(ofd);
- unlink(oname);
- exit(1);
- }
- while (fread(buf, sizeof(*buf),128, fd) > 0){
- fwrite(buf, sizeof(*buf),128, ofd);
- bzero(buf,128);
- }
- fclose(fd);
- strcpy(rname,argv[1]);
- strcat(rname,".rsrc");
- if ((fd = fopen(rname,"r")) == NULL){
- fprintf(stderr,"No %s file!\n", rname);
- fclose(ofd);
- unlink(oname);
- exit(1);
- }
- while (fread(buf, sizeof(*buf),128, fd) > 0){
- fwrite(buf, sizeof(*buf),128, ofd);
- bzero(buf,128);
- }
- fclose(fd);
- }
- SHAR_EOF
- if test 1697 -ne "`wc -c < 'macbin.c'`"
- then
- echo shar: error transmitting "'macbin.c'" '(should have been 1697 characters)
- '
- fi
- fi # end of overwriting check
- # End of shell archive
- exit 0
- --
- Jim Budler
- Advanced Micro Devices, Inc.
- (408) 749-5806
- Usenet: {ucbvax,decwrl,ihnp4,allegra,intelca}!amdcad!jimb
- Compuserve: 72415,1200
-
-