home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!olivea!charnel!rat!usc!elroy.jpl.nasa.gov!ames!haven.umd.edu!darwin.sura.net!sgiblab!munnari.oz.au!manuel.anu.edu.au!sserve!ajft_sun!ajft
- From: ajft@ajft_sun.cs.adfa.oz.au (Adrian Tritschler)
- Newsgroups: comp.sys.amiga.misc
- Subject: Re: How to transfer a file larger than a diskette from IBM to AMIGA
- Message-ID: <1992Nov5.050805.9341@sserve.cc.adfa.oz.au>
- Date: 5 Nov 92 05:08:05 GMT
- References: <espenm.15.719691133@dhhalden.no> <48m1sB2w165w@cybernet.cse.fau.edu> <DiN1sB6w165w@cybernet.cse.fau.edu> <1992Oct22.021050.29090@fcom.cc.utah.edu> <4172@sicsun.epfl.ch>
- Sender: news@sserve.cc.adfa.oz.au
- Reply-To: ajft@csadfa.cs.adfa.oz.au
- Organization: Australian Defence Force Academy
- Lines: 218
-
- This ought to be part of the FAQ (if there is a FAQ), this is the third time
- this week I have sent it to people!
- --
- OK, you have an enormous file, and a number of 720k MS-DOS disks, and an Amiga.
- The maximum available space on a 720k disk is 730112 bytes (713 * 1024)
-
- There are several ways to split data files, it all depends on where (and how)
- you wish to do it:
-
- if the large file "huge.lzh" is on a PC already, I'd recommend the utility
- bsplit
-
- c:\> bsplit -730112 huge.lzh huge.
-
- generates huge.aa huge.ab huge.ac etc, these can then be copied to the DOS
- disks.
-
- bsplit is available as bsplit.zip or bsplit.lzh on most PC archives.
-
- On a UNIX machine:
- either find and compile a copy of the utility SplitLZH, or use dd (the unix file
- dump/convert utility)
-
- down below here are the source for SplitLZH.c and a script I use to invoke dd
- and perform the same function.
-
- ---- CUT HERE ----
- #!/bin/sh
- # shar: Shell Archiver (v1.22)
- #
- # Run the following text with /bin/sh to create:
- # split
- # splitlzh.c
- #
- echo "x - extracting split (Text)"
- sed 's/^X//' << 'SHAR_EOF' > split &&
- X#!/bin/sh
- Xusage()
- X{
- X echo
- X echo "Usage (revision $revision):"
- X echo
- X echo `basename $0` [options] infile [outfile]
- X echo
- X echo Valid options are:
- X echo
- X echo " [-help] Get this help message"
- X echo " [-N size] Split file into pieces of size bytes"
- X echo
- X exit 1
- X}
- X
- X# This produces leading zeros for the part numbers. NN users are
- X# anal-retentive about the subject lines being lexicographically ordered.
- Xzeros()
- X{
- X case $1 in
- X 1 | 2 )
- X echo $part
- X ;;
- X 3 )
- X echo 0$part | sed 's/^.*\(..\)$/\1/'
- X ;;
- X 4 )
- X echo 00$part | sed 's/^.*\(...\)$/\1/'
- X ;;
- X esac
- X}
- X
- X# required usage is split_file inname outname bsize
- Xsplit_file()
- X{
- X file=$1
- X shift
- X ofile=$1
- X shift
- X fsize=`wc -c <$file`
- X echo "split() length of input = $fsize"
- X num_parts=`expr $fsize / $1 / 1024 + 1`
- X echo "split() num_parts = $num_parts"
- X part=0
- X skip=0
- X num_zeros=`echo $num_parts | wc -c`
- X while [ $part != $num_parts ]; do
- X print_part=`zeros $num_zeros $part`
- X dd if=$file of=$ofile.$print_part bs=1024 count=$bsize skip=$skip
- X part=`expr $part + 1`
- X skip=`expr $part \* $bsize`
- X done
- X}
- X#
- Xinfile=""
- Xofile=""
- X# Use a block size of 713k as default
- Xbsize=713
- X# Revision of this script
- Xrevision=`echo $Revision: 0.1 $ | sed 's%[^0-9.]%%g'`
- X#
- X#
- X# parse the command line arguments
- Xwhile [ X$1 != X ]; do
- X case $1 in
- X -h* )
- X usage
- X ;;
- X
- X -N* )
- X bsize=$2
- X shift
- X ;;
- X
- X * )
- X if [ "X$infile" = X ]; then
- X infile=$1
- X else
- X if [ "X$ofile" = X ]; then
- X ofile=$1
- X fi
- X fi
- X ;;
- X esac
- X shift
- Xdone
- X
- X# must have input file!
- Xif [ "X$infile" = X ]; then
- X echo Required argument missing!
- X echo
- X usage
- Xfi
- X
- Xif [ "X$ofile" = X ]; then
- X ofile=`basename $infile .lzh`
- Xfi
- Xecho infile = $infile, outfile = $ofile
- X
- Xsplit_file $infile $ofile $bsize
- Xexit 0
- SHAR_EOF
- chmod 0755 split || echo "restore of split fails"
- echo "x - extracting splitlzh.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > splitlzh.c &&
- X/*
- X * splitlzh - Split a LZH file into a multivolume archive suitable for
- X * processing by LhA.
- X *
- X * This is freely distributable. Do with it whatever you desire.
- X *
- X * Written by Stefan Boberg, 1992
- X *
- X */
- X
- X#include <stdio.h>
- X#include <string.h>
- X
- X#define EXIT_FAILURE 1
- X
- XFILE *open_vol(name, no)
- Xchar *name;
- Xlong no;
- X{
- X char work[1024];
- X
- X if (no)
- X sprintf(work, "%s.l%02d", name, no);
- X else
- X sprintf(work, "%s.lzh", name);
- X
- X return fopen(work, "wb");
- X}
- X
- Xint main(argc, argv)
- Xint argc;
- Xchar **argv;
- X{
- X char buffer[1024]; /* Small I/O buffer */
- X FILE *in, *out;
- X long size, i, j = 1024, vol_no = 0;
- X
- X if (argc != 4) {
- X printf("Usage: %s <arcsize in KB> <infile> <outname>\n", argv[0]);
- X exit(EXIT_FAILURE);
- X }
- X
- X size = atoi(argv[1]);
- X
- X if (in = fopen(argv[2], "rb")) {
- X while (!feof(in)) {
- X if (out = open_vol(argv[3], vol_no++)) {
- X i = size;
- X
- X while((i--) && (j == 1024)) {
- X j = fread(buffer, 1, 1024, in);
- X fwrite(buffer, 1, j, out);
- X }
- X fclose(out);
- X } else {
- X fclose(in);
- X printf("Error opening volume %d!\n\n", vol_no);
- X exit(EXIT_FAILURE);
- X }
- X }
- X } else {
- X printf("Error opening source!!\n\n");
- X exit(EXIT_FAILURE);
- X }
- X
- X return 0;
- X}
- SHAR_EOF
- chmod 0644 splitlzh.c || echo "restore of splitlzh.c fails"
- exit 0
-
- --
- // Adrian Tritschler // ajft@ajft_sun.cs.adfa.oz.au //
- ||\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\|| (06) 268 8166/\/\/\/\/\/\/\/\/\/\||
- || UAE: Uncontrollable African Elephants || Comp Sci Dept, ADFA ||
- \\ Chewing Segments, run for cover \\ Canberra, ACT, Australia \\
-