Date: Thu, 31 Jan 2002 14:53:04 +0100 (CET) From: Miguel Mendez <flynn@energyhq.homeip.net> To: FreeBSD-gnats-submit@freebsd.org Subject: ports/34488: New port: emulators/hercules (System/370, ESA/390, and z/Architecture Emulator) Message-ID: <200201311353.g0VDr4M15209@energyhq.homeip.net>
next in thread | raw e-mail | index | archive | help
>Number: 34488 >Category: ports >Synopsis: New port: emulators/hercules (System/370, ESA/390, and z/Architecture Emulator) >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Thu Jan 31 06:00:02 PST 2002 >Closed-Date: >Last-Modified: >Originator: Miguel Mendez >Release: FreeBSD 4.5-STABLE i386 >Organization: >Environment: System: FreeBSD energyhq.homeip.net 4.5-STABLE FreeBSD 4.5-STABLE #0: Wed Jan 30 19:35:41 CET 2002 root@energyhq.homeip.net:/storage2/obj/storage2/src/sys/ENERGYHQ i386 >Description: Hercules is an open source software implementation of the mainframe System/370 and ESA/390 architectures, in addition to the new 64-bit z/Architecture. >How-To-Repeat: >Fix: --- hercules.shar begins here --- # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # hercules # hercules/pkg-descr # hercules/distinfo # hercules/Makefile # hercules/pkg-comment # hercules/pkg-plist # hercules/pkg-message # hercules/files # hercules/files/patch-tapedev.c # hercules/files/patch-tapecopy.c # echo c - hercules mkdir -p hercules > /dev/null 2>&1 echo x - hercules/pkg-descr sed 's/^X//' >hercules/pkg-descr << 'END-of-hercules/pkg-descr' XHercules is an open source software implementation of the mainframe System/370 Xand ESA/390 architectures, in addition to the new 64-bit z/Architecture. XHercules runs under Linux, Windows 98, Windows NT, and Windows 2000. X XHercules was created by Roger Bowler and is maintained by Jay Maynard. Jan XJaeger designed and implemented many of the advanced features of Hercules, Xincluding dynamic reconfiguration, integrated console, interpretive execution Xand z/Architecture support. X XWWW: http://www.conmicro.cx/hercules/ X X- Miguel Mendez <flynn@energyhq.homeip.net> END-of-hercules/pkg-descr echo x - hercules/distinfo sed 's/^X//' >hercules/distinfo << 'END-of-hercules/distinfo' XMD5 (hercules-2.15.tar.gz) = 8eb98b2b5663607fda075fc57f019172 END-of-hercules/distinfo echo x - hercules/Makefile sed 's/^X//' >hercules/Makefile << 'END-of-hercules/Makefile' X# New ports collection makefile for: dice X# Date created: Thu Jan 31 12:07:01 CET 2002 X# Whom: Miguel Mendez <flynn@energyhq.homeip.net> X# X# $FreeBSD$ X# X XPORTNAME= hercules XPORTVERSION= 2.15 XCATEGORIES= emulators XMASTER_SITES= http://www.conmicro.cx/hercules/ X XMAINTAINER= flynn@energyhq.homeip.net X XGNU_CONFIGURE= yes X Xpost-patch: X X @${PERL} -pi -e 's@lpthread@pthread@g' ${WRKSRC}/configure X Xdo-install: X X @for i in hercules dasdinit dasdisup dasdload dasdls dasdpdsu \ X tapecopy tapemap tapesplt cckd2ckd cckdcdsk ckd2cckd \ X cckdcomp cckdswap hetget hetinit hetmap hetupd dmap2hrc; \ X do \ X ${INSTALL_PROGRAM} ${WRKSRC}/$$i ${PREFIX}/bin; \ X done X X.if !defined(NOPORTDOCS) X @${MKDIR} ${PREFIX}/share/doc/hercules X @${RM} -f ${WRKSRC}/html/Makefile* X @for i in ${WRKSRC}/hercules.cnf ${WRKSRC}/html/* ; \ X do \ X ${INSTALL_DATA} $$i ${PREFIX}/share/doc/hercules; \ X done X.endif X @${CAT} pkg-message X X.include <bsd.port.mk> END-of-hercules/Makefile echo x - hercules/pkg-comment sed 's/^X//' >hercules/pkg-comment << 'END-of-hercules/pkg-comment' XThe Hercules System/370, ESA/390, and z/Architecture Emulator END-of-hercules/pkg-comment echo x - hercules/pkg-plist sed 's/^X//' >hercules/pkg-plist << 'END-of-hercules/pkg-plist' Xbin/hercules Xbin/dasdinit Xbin/dasdisup Xbin/dasdload Xbin/dasdls Xbin/dasdpdsu Xbin/tapecopy Xbin/tapemap Xbin/tapesplt Xbin/cckd2ckd Xbin/cckdcdsk Xbin/ckd2cckd Xbin/cckdcomp Xbin/cckdswap Xbin/hetget Xbin/hetinit Xbin/hetmap Xbin/hetupd Xbin/dmap2hrc Xshare/doc/hercules/cckddasd.html Xshare/doc/hercules/hercconf.html Xshare/doc/hercules/hercfaq.html Xshare/doc/hercules/hercinst.html Xshare/doc/hercules/herclic.html Xshare/doc/hercules/hercload.html Xshare/doc/hercules/hercnew.html Xshare/doc/hercules/herctcp.html Xshare/doc/hercules/hercules.css Xshare/doc/hercules/hercules.cnf Xshare/doc/hercules/index.html X@dirrm share/doc/hercules END-of-hercules/pkg-plist echo x - hercules/pkg-message sed 's/^X//' >hercules/pkg-message << 'END-of-hercules/pkg-message' X###################################################################### X X IMPORTANT X Tape operations and tapecopy are broken in this port (contain Linux Xspecific code that has not yet been adapted). X X Be sure to have a look at the docs and edit the hercules.cnf file to Xyour needs (The sample is in ${PREFIX}/share/doc/hercules) X X###################################################################### END-of-hercules/pkg-message echo c - hercules/files mkdir -p hercules/files > /dev/null 2>&1 echo x - hercules/files/patch-tapedev.c sed 's/^X//' >hercules/files/patch-tapedev.c << 'END-of-hercules/files/patch-tapedev.c' X--- tapedev.c.orig Tue Nov 20 23:39:47 2001 X+++ tapedev.c Thu Jan 31 13:06:43 2002 X@@ -131,6 +131,11 @@ X #define TAPEDEVT_SCSITAPE 3 /* Physical SCSI tape */ X #define TAPEDEVT_HET 4 /* HET format disk file */ X X+/* Can you say totally b0rken? */ X+#define MT_ST_DENSITY_MASK 1 X+#define MT_TAPE_INFO 2 X+#define MTSETBLK 3 X+#define MT_ST_DENSITY_SHIFT 4 X /*-------------------------------------------------------------------*/ X /* Structure definition for tape block headers */ X /*-------------------------------------------------------------------*/ X@@ -194,7 +199,10 @@ X /*-------------------------------------------------------------------*/ X /* Static data areas */ X /*-------------------------------------------------------------------*/ X-static struct mt_tape_info tapeinfo[] = MT_TAPE_INFO; X+ X+ X+/* static struct mt_tape_info tapeinfo[] = MT_TAPE_INFO; X+ X static struct mt_tape_info densinfo[] = { X {0x01, "NRZI (800 bpi)"}, X {0x02, "PE (1600 bpi)"}, X@@ -221,7 +229,7 @@ X {0x8C, "EXB-8505 compressed"}, X {0x90, "EXB-8205 compressed"}, X {0, NULL}}; X- X+*/ X static PARSER ptab[] = X { X { "awstape", NULL }, X@@ -1151,6 +1159,7 @@ X if (dev->fd < 0) return 0; X X /* Obtain tape status */ X+/* X rc = ioctl (dev->fd, MTIOCGET, (char*)&stblk); X if (rc < 0) X { X@@ -1159,8 +1168,9 @@ X return 0; X } X stat = stblk.mt_gstat; X- X+*/ X /* Display tape status */ X+/* X if (dev->ccwtrace || dev->ccwstep) X { X sprintf (buf, "%s status: %8.8X", dev->filename, stat); X@@ -1177,10 +1187,11 @@ X if (GMT_DR_OPEN(stat)) strcat (buf, " NOTAPE"); X logmsg ("HHC215I %s\n", buf); X } X- X+*/ X /* If tape has been ejected, then close the file because X the driver will not recognize that a new tape volume X has been mounted until the file is re-opened */ X+/* X if (GMT_DR_OPEN(stat)) X { X close (dev->fd); X@@ -1190,8 +1201,10 @@ X dev->prvblkpos = -1; X dev->blockid = 0; X } X- X+*/ X /* Return tape status */ X+ X+ fprintf(stderr,"Sorry, tape support is broken.\n"); X return stat; X X } /* end function status_scsitape */ X@@ -1249,6 +1262,7 @@ X } X X /* Intervention required if no tape is mounted */ X+/* X if (GMT_DR_OPEN(stblk.mt_gstat)) X { X dev->sense[0] = SENSE_IR; X@@ -1256,8 +1270,9 @@ X *unitstat = CSW_CE | CSW_DE | CSW_UC; X return -1; X } X- X+*/ X /* Display tape status information */ X+/* X for (i = 0; tapeinfo[i].t_type != 0 X && tapeinfo[i].t_type != stblk.mt_type; i++); X X@@ -1280,8 +1295,9 @@ X else X logmsg ("HHC221I %s tape density code: 0x%lX\n", X dev->filename, density); X- X+*/ X /* Set the tape device to process variable length blocks */ X+ /* X opblk.mt_op = MTSETBLK; X opblk.mt_count = 0; X rc = ioctl (dev->fd, MTIOCTOP, (char*)&opblk); X@@ -1294,8 +1310,9 @@ X *unitstat = CSW_CE | CSW_DE | CSW_UC; X return -1; X } X- X+*/ X /* Rewind the tape to the beginning */ X+/* X opblk.mt_op = MTREW; X opblk.mt_count = 1; X rc = ioctl (dev->fd, MTIOCTOP, (char*)&opblk); X@@ -1308,7 +1325,7 @@ X *unitstat = CSW_CE | CSW_DE | CSW_UC; X return -1; X } X- X+*/ X return 0; X X } /* end function open_scsitape */ X@@ -1436,13 +1453,14 @@ X X /* If I/O error and status indicates EOF, then a tapemark X was detected, so increment the file number and return 0 */ X+/* X if (rc < 0 && fsrerrno == EIO && GMT_EOF(stat)) X { X dev->curfilen++; X dev->blockid++; X return 0; X } X- X+*/ X /* Handle MTFSR error condition */ X if (rc < 0) X { X@@ -1481,6 +1499,7 @@ X stat = status_scsitape (dev); X X /* Unit check if already at start of tape */ X+/* X if (GMT_BOT(stat)) X { X dev->sense[0] = 0; X@@ -1488,7 +1507,7 @@ X *unitstat = CSW_CE | CSW_DE | CSW_UC; X return -1; X } X- X+*/ X /* Backspace block on SCSI tape */ X opblk.mt_op = MTBSR; X opblk.mt_count = 1; X@@ -2703,12 +2722,15 @@ X U32 stat; /* SCSI tape status bits */ X X /* Indicate intervention required if no file */ X+/* X if (!strcmp (dev->filename, TAPE_UNLOADED)) X dev->sense[0] |= SENSE_IR; X X if (!(dev->fd < 0)) X { X+ */ X /* Set load point indicator if tape is at load point */ X+/* X dev->sense[1] &= ~SENSE1_TAPE_LOADPT; X switch (dev->tapedevt) X { X@@ -2732,41 +2754,14 @@ X if (dev->nxtblkpos == 0 && dev->curfilen == 1) X dev->sense[1] |= SENSE1_TAPE_LOADPT; X break; X- } /* end switch(dev->tapedevt) */ X- } /* !(fd < 0) */ X+ } X+ */ X+ /* end switch(dev->tapedevt) */ X+ X X /* Indicate Drive online to control unit */ X- dev->sense[1] |= SENSE1_TAPE_TUA; X X- /* Set file protect indicator if read-only file */ X- if (dev->readonly) X- dev->sense[1] |= SENSE1_TAPE_FP; X- else X- dev->sense[1] &= ~SENSE1_TAPE_FP; X X- /* Set Error Recovery Action Code */ X- if (dev->sense[0] & SENSE_IR) X- dev->sense[3] = 0x43; X- else if (dev->sense[0] & SENSE_CR) X- dev->sense[3] = 0x27; X- else if (dev->sense[1] & SENSE1_TAPE_FP) X- dev->sense[3] = 0x30; X- else X- dev->sense[3] = 0x29; X- X- /* Set sense bytes for 3420 */ X- if (dev->devtype != 0x3480) X- { X-// dev->sense[4] |= 0x20; X- dev->sense[5] |= 0xC0; X- dev->sense[6] |= 0x03; X- dev->sense[13] = 0x80; X- dev->sense[14] = 0x01; X- dev->sense[15] = 0x00; X- dev->sense[16] = 0x01; X- dev->sense[19] = 0xFF; X- dev->sense[20] = 0xFF; X- } X X } /* end function build_sense */ X END-of-hercules/files/patch-tapedev.c echo x - hercules/files/patch-tapecopy.c sed 's/^X//' >hercules/files/patch-tapecopy.c << 'END-of-hercules/files/patch-tapecopy.c' X--- tapecopy.c.orig Thu Nov 29 13:53:46 2001 X+++ tapecopy.c Thu Jan 31 13:26:01 2002 X@@ -8,357 +8,18 @@ X /* prints a summary of the tape files and blocksizes. */ X /*-------------------------------------------------------------------*/ X X-#include "hercules.h" X- X-/*-------------------------------------------------------------------*/ X-/* Structure definition for AWSTAPE block header */ X-/*-------------------------------------------------------------------*/ X-typedef struct _AWSTAPE_BLKHDR { X- HWORD curblkl; /* Length of this block */ X- HWORD prvblkl; /* Length of previous block */ X- BYTE flags1; /* Flags byte 1 */ X- BYTE flags2; /* Flags byte 2 */ X- } AWSTAPE_BLKHDR; X- X-/* Definitions for AWSTAPE_BLKHDR flags byte 1 */ X-#define AWSTAPE_FLAG1_NEWREC 0x80 /* Start of new record */ X-#define AWSTAPE_FLAG1_TAPEMARK 0x40 /* Tape mark */ X-#define AWSTAPE_FLAG1_ENDREC 0x20 /* End of record */ X- X-/*-------------------------------------------------------------------*/ X-/* Static data areas */ X-/*-------------------------------------------------------------------*/ X-static BYTE vollbl[] = "\xE5\xD6\xD3"; /* EBCDIC characters "VOL" */ X-static BYTE hdrlbl[] = "\xC8\xC4\xD9"; /* EBCDIC characters "HDR" */ X-static BYTE eoflbl[] = "\xC5\xD6\xC6"; /* EBCDIC characters "EOF" */ X-static BYTE eovlbl[] = "\xC5\xD6\xE5"; /* EBCDIC characters "EOV" */ X-static struct mt_tape_info tapeinfo[] = MT_TAPE_INFO; X-static struct mt_tape_info densinfo[] = { X- {0x01, "NRZI (800 bpi)"}, X- {0x02, "PE (1600 bpi)"}, X- {0x03, "GCR (6250 bpi)"}, X- {0x05, "QIC-45/60 (GCR, 8000 bpi)"}, X- {0x06, "PE (3200 bpi)"}, X- {0x07, "IMFM (6400 bpi)"}, X- {0x08, "GCR (8000 bpi)"}, X- {0x09, "GCR /37871 bpi)"}, X- {0x0A, "MFM (6667 bpi)"}, X- {0x0B, "PE (1600 bpi)"}, X- {0x0C, "GCR (12960 bpi)"}, X- {0x0D, "GCR (25380 bpi)"}, X- {0x0F, "QIC-120 (GCR 10000 bpi)"}, X- {0x10, "QIC-150/250 (GCR 10000 bpi)"}, X- {0x11, "QIC-320/525 (GCR 16000 bpi)"}, X- {0x12, "QIC-1350 (RLL 51667 bpi)"}, X- {0x13, "DDS (61000 bpi)"}, X- {0x14, "EXB-8200 (RLL 43245 bpi)"}, X- {0x15, "EXB-8500 (RLL 45434 bpi)"}, X- {0x16, "MFM 10000 bpi"}, X- {0x17, "MFM 42500 bpi"}, X- {0x24, "DDS-2"}, X- {0x8C, "EXB-8505 compressed"}, X- {0x90, "EXB-8205 compressed"}, X- {0, NULL}}; X-static BYTE buf[65500]; X- X-/*-------------------------------------------------------------------*/ X-/* ASCII to EBCDIC translate tables */ X-/*-------------------------------------------------------------------*/ X-#include "codeconv.h" X- X-/*-------------------------------------------------------------------*/ X-/* Subroutine to print tape status */ X-/*-------------------------------------------------------------------*/ X-static void print_status (BYTE *devname, long stat) X-{ X- printf ("%s status: %8.8lX", devname, stat); X- if (GMT_EOF(stat)) printf (" EOF"); X- if (GMT_BOT(stat)) printf (" BOT"); X- if (GMT_EOT(stat)) printf (" EOT"); X- if (GMT_SM(stat)) printf (" SETMARK"); X- if (GMT_EOD(stat)) printf (" EOD"); X- if (GMT_WR_PROT(stat)) printf (" WRPROT"); X- if (GMT_ONLINE(stat)) printf (" ONLINE"); X- if (GMT_D_6250(stat)) printf (" 6250"); X- if (GMT_D_1600(stat)) printf (" 1600"); X- if (GMT_D_800(stat)) printf (" 800"); X- if (GMT_DR_OPEN(stat)) printf (" NOTAPE"); X- printf ("\n"); X- X-} /* end function print_status */ X- X-/*-------------------------------------------------------------------*/ X-/* Subroutine to obtain and print tape status */ X-/* Return value: 0=normal, 1=end of tape, -1=error */ X-/*-------------------------------------------------------------------*/ X-static int obtain_status (BYTE *devname, int devfd) X-{ X-int rc; /* Return code */ X-struct mtget stblk; /* Area for MTIOCGET ioctl */ X- X- rc = ioctl (devfd, MTIOCGET, (char*)&stblk); X- if (rc < 0) X- { X- printf ("tapecopy: Error reading status of %s: %s\n", X- devname, strerror(errno)); X- return -1; X- } X- X- print_status (devname, stblk.mt_gstat); X- X- if (GMT_EOD(stblk.mt_gstat)) return 1; X- if (GMT_EOT(stblk.mt_gstat)) return 1; X- X- return 0; X-} /* end function print_status */ X X /*-------------------------------------------------------------------*/ X /* TAPECOPY main entry point */ X /*-------------------------------------------------------------------*/ X int main (int argc, char *argv[]) X { X-int rc; /* Return code */ X-int i; /* Array subscript */ X-int len; /* Block length */ X-int prevlen; /* Previous block length */ X-BYTE *devname; /* -> Tape device name */ X-BYTE *filename; /* -> Output file name */ X-int devfd; /* Tape file descriptor */ X-int outfd = -1; /* Output file descriptor */ X-int fileno; /* Tape file number */ X-int blkcount; /* Block count */ X-int minblksz; /* Minimum block size */ X-int maxblksz; /* Maximum block size */ X-struct mtop opblk; /* Area for MTIOCTOP ioctl */ X-struct mtget stblk; /* Area for MTIOCGET ioctl */ X-long density; /* Tape density code */ X-BYTE labelrec[81]; /* Standard label (ASCIIZ) */ X-AWSTAPE_BLKHDR awshdr; /* AWSTAPE block header */ X- X- /* Display the program identification message */ X- display_version (stderr, "Hercules tape copy program "); X- X- /* The first argument is the tape device name */ X- if (argc > 1 && argv[1] != NULL && strlen(argv[1]) > 5 X- && memcmp (argv[1], "/dev/", 5) == 0) X- { X- devname = argv[1]; X- } X- else X- { X- printf ("Usage: tapecopy /dev/st0 [outfile]\n"); X- exit (1); X- } X- X- /* The second argument is the output file name */ X- if (argc > 2 && argv[2] != NULL) X- filename = argv[2]; X- else X- filename = NULL; X- X- /* Open the tape device */ X- devfd = open (devname, O_RDONLY|O_BINARY); X- if (devfd < 0) X- { X- printf ("tapecopy: Error opening %s: %s\n", X- devname, strerror(errno)); X- exit (3); X- } X X- /* Obtain the tape status */ X- rc = ioctl (devfd, MTIOCGET, (char*)&stblk); X- if (rc < 0) X- { X- printf ("tapecopy: Error reading status of %s: %s\n", X- devname, strerror(errno)); X- exit (7); X- } X X- /* Display tape status information */ X- for (i = 0; tapeinfo[i].t_type != 0 X- && tapeinfo[i].t_type != stblk.mt_type; i++); X- X- if (tapeinfo[i].t_name != NULL) X- printf ("%s device type: %s\n", devname, tapeinfo[i].t_name); X- else X- printf ("%s device type: 0x%lX\n", devname, stblk.mt_type); X- X- density = (stblk.mt_dsreg & MT_ST_DENSITY_MASK) X- >> MT_ST_DENSITY_SHIFT; X- X- for (i = 0; densinfo[i].t_type != 0 X- && densinfo[i].t_type != density; i++); X- X- if (densinfo[i].t_name != NULL) X- printf ("%s tape density: %s\n", devname, densinfo[i].t_name); X- else X- printf ("%s tape density code: 0x%lX\n", devname, density); X- X- if (stblk.mt_gstat != 0) X- { X- print_status (devname, stblk.mt_gstat); X- } X- X- /* Set the tape device to process variable length blocks */ X- opblk.mt_op = MTSETBLK; X- opblk.mt_count = 0; X- rc = ioctl (devfd, MTIOCTOP, (char*)&opblk); X- if (rc < 0) X- { X- printf ("tapecopy: Error setting attributes for %s: %s\n", X- devname, strerror(errno)); X- exit (5); X- } X- X- /* Rewind the tape to the beginning */ X- opblk.mt_op = MTREW; X- opblk.mt_count = 1; X- rc = ioctl (devfd, MTIOCTOP, (char*)&opblk); X- if (rc < 0) X- { X- printf ("tapecopy: Error rewinding %s: %s\n", X- devname, strerror(errno)); X- exit (6); X- } X- X- /* Open the output file */ X- if (filename != NULL) X- { X- outfd = open (filename, O_WRONLY | O_CREAT | O_BINARY, X- S_IRUSR | S_IWUSR | S_IRGRP); X- if (outfd < 0) X- { X- printf ("tapecopy: Error opening %s: %s\n", X- filename, strerror(errno)); X- exit (4); X- } X- } X- X- /* Copy blocks from tape to the output file */ X- fileno = 1; X- blkcount = 0; X- minblksz = 0; X- maxblksz = 0; X- len = 0; X- X- while (1) X- { X- /* Save previous block length */ X- prevlen = len; X- X- /* Read a block from the tape */ X- len = read (devfd, buf, sizeof(buf)); X- if (len < 0) X- { X- printf ("tapecopy: Error reading %s: %s\n", X- devname, strerror(errno)); X- obtain_status (devname, devfd); X- exit (8); X- } X- X- /* Check for tape mark */ X- if (len == 0) X- { X- /* Print summary of current file */ X- printf ("File %u: Blocks=%u, block size min=%u, max=%u\n", X- fileno, blkcount, minblksz, maxblksz); X- X- /* Write tape mark to output file */ X- if (outfd >= 0) X- { X- /* Build block header for tape mark */ X- awshdr.curblkl[0] = 0; X- awshdr.curblkl[1] = 0; X- awshdr.prvblkl[0] = prevlen & 0xFF; X- awshdr.prvblkl[1] = (prevlen >> 8) & 0xFF; X- awshdr.flags1 = AWSTAPE_FLAG1_TAPEMARK; X- awshdr.flags2 = 0; X- X- /* Write block header to output file */ X- rc = write (outfd, &awshdr, sizeof(AWSTAPE_BLKHDR)); X- if (rc < sizeof(AWSTAPE_BLKHDR)) X- { X- printf ("tapecopy: Error writing %s: %s\n", X- filename, strerror(errno)); X- exit (9); X- } /* end if(rc) */ X- X- } /* end if(outfd) */ X- X- /* Reset counters for next file */ X- fileno++; X- minblksz = 0; X- maxblksz = 0; X- blkcount = 0; X- X- /* Determine whether end of tape has been read */ X- rc = obtain_status (devname, devfd); X- if (rc == 0) continue; X- if (rc > 0) printf ("End of tape\n"); X- break; X- X- } /* end if(tapemark) */ X- X- /* Count blocks and block sizes */ X- blkcount++; X- if (len > maxblksz) maxblksz = len; X- if (minblksz == 0 || len < minblksz) minblksz = len; X- X- /* Print standard labels */ X- if (len == 80 && blkcount < 4 X- && (memcmp(buf, vollbl, 3) == 0 X- || memcmp(buf, hdrlbl, 3) == 0 X- || memcmp(buf, eoflbl, 3) == 0 X- || memcmp(buf, eovlbl, 3) == 0)) X- { X- for (i=0; i < 80; i++) X- labelrec[i] = ebcdic_to_ascii[buf[i]]; X- labelrec[i] = '\0'; X- printf ("%s\n", labelrec); X- } X- else X- { X- printf ("File %u: Block %u\r", fileno, blkcount); X- } X- X- /* Write block to output file */ X- if (outfd >= 0) X- { X- /* Build the block header */ X- awshdr.curblkl[0] = len & 0xFF; X- awshdr.curblkl[1] = (len >> 8) & 0xFF; X- awshdr.prvblkl[0] = prevlen & 0xFF; X- awshdr.prvblkl[1] = (prevlen >> 8) & 0xFF; X- awshdr.flags1 = AWSTAPE_FLAG1_NEWREC X- | AWSTAPE_FLAG1_ENDREC; X- awshdr.flags2 = 0; X- X- /* Write block header to output file */ X- rc = write (outfd, &awshdr, sizeof(AWSTAPE_BLKHDR)); X- if (rc < sizeof(AWSTAPE_BLKHDR)) X- { X- printf ("tapecopy: Error writing %s: %s\n", X- filename, strerror(errno)); X- exit (10); X- } /* end if(rc) */ X- X- /* Write data block to output file */ X- rc = write (outfd, buf, len); X- if (rc < len) X- { X- printf ("tapecopy: Error writing %s: %s\n", X- filename, strerror(errno)); X- exit (11); X- } /* end if(rc) */ X- X- } /* end if(outfd) */ X- X- } /* end while */ X- X- /* Close files and exit */ X- close (devfd); X- if (filename != NULL) close (outfd); X+ /* Display the program identification message */ X+ X X+ printf("Tape copy is broken, sorry\n"); X return 0; X X } /* end function main */ END-of-hercules/files/patch-tapecopy.c exit --- hercules.shar ends here --- >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200201311353.g0VDr4M15209>