home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / sys / amiga / misc / 16336 next >
Encoding:
Text File  |  1992-11-04  |  5.4 KB  |  231 lines

  1. 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
  2. From: ajft@ajft_sun.cs.adfa.oz.au (Adrian Tritschler)
  3. Newsgroups: comp.sys.amiga.misc
  4. Subject: Re: How to transfer a file larger than a diskette from IBM to AMIGA
  5. Message-ID: <1992Nov5.050805.9341@sserve.cc.adfa.oz.au>
  6. Date: 5 Nov 92 05:08:05 GMT
  7. 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>
  8. Sender: news@sserve.cc.adfa.oz.au
  9. Reply-To: ajft@csadfa.cs.adfa.oz.au
  10. Organization: Australian Defence Force Academy
  11. Lines: 218
  12.  
  13. This ought to be part of the FAQ (if there is a FAQ), this is the third time
  14. this week I have sent it to people!
  15. --
  16. OK, you have an enormous file, and a number of 720k MS-DOS disks, and an Amiga.
  17. The maximum available space on a 720k disk is 730112 bytes (713 * 1024)
  18.  
  19. There are several ways to split data files, it all depends on where (and how)
  20. you wish to do it:
  21.  
  22. if the large file "huge.lzh" is on a PC already, I'd recommend the utility
  23. bsplit
  24.  
  25. c:\> bsplit -730112 huge.lzh huge.
  26.  
  27. generates huge.aa huge.ab huge.ac etc, these can then be copied to the DOS
  28. disks.
  29.  
  30. bsplit is available as bsplit.zip or bsplit.lzh on most PC archives.
  31.  
  32. On a UNIX machine:
  33. either find and compile a copy of the utility SplitLZH, or use dd (the unix file
  34. dump/convert utility)
  35.  
  36. down below here are the source for SplitLZH.c and a script I use to invoke dd
  37. and perform the same function.
  38.  
  39. ---- CUT HERE ----
  40. #!/bin/sh
  41. # shar:    Shell Archiver  (v1.22)
  42. #
  43. #    Run the following text with /bin/sh to create:
  44. #      split
  45. #      splitlzh.c
  46. #
  47. echo "x - extracting split (Text)"
  48. sed 's/^X//' << 'SHAR_EOF' > split &&
  49. X#!/bin/sh
  50. Xusage()
  51. X{
  52. X    echo
  53. X    echo "Usage (revision $revision):"
  54. X    echo
  55. X    echo `basename $0` [options] infile [outfile]
  56. X    echo
  57. X    echo Valid options are:
  58. X    echo
  59. X    echo "    [-help]       Get this help message"
  60. X    echo "    [-N size]     Split file into pieces of size bytes"
  61. X    echo
  62. X    exit 1
  63. X}
  64. X
  65. X# This produces leading zeros for the part numbers.  NN users are
  66. X# anal-retentive about the subject lines being lexicographically ordered.
  67. Xzeros()
  68. X{
  69. X    case $1 in
  70. X   1 | 2 )
  71. X       echo $part
  72. X   ;;
  73. X   3 )
  74. X       echo 0$part | sed 's/^.*\(..\)$/\1/'
  75. X   ;;
  76. X   4 )
  77. X       echo 00$part | sed 's/^.*\(...\)$/\1/'
  78. X   ;;
  79. X    esac
  80. X}
  81. X
  82. X# required usage is split_file inname outname bsize
  83. Xsplit_file()
  84. X{
  85. X    file=$1
  86. X    shift
  87. X    ofile=$1
  88. X    shift
  89. X    fsize=`wc -c <$file`
  90. X    echo "split() length of input = $fsize"
  91. X    num_parts=`expr $fsize / $1 / 1024 + 1`
  92. X    echo "split() num_parts = $num_parts"
  93. X    part=0
  94. X    skip=0
  95. X    num_zeros=`echo $num_parts | wc -c`
  96. X    while [ $part != $num_parts ]; do
  97. X        print_part=`zeros $num_zeros $part`
  98. X        dd if=$file of=$ofile.$print_part bs=1024 count=$bsize skip=$skip
  99. X        part=`expr $part + 1`
  100. X        skip=`expr $part \* $bsize`
  101. X    done
  102. X}
  103. X#
  104. Xinfile=""
  105. Xofile=""
  106. X# Use a block size of 713k as default
  107. Xbsize=713
  108. X# Revision of this script
  109. Xrevision=`echo $Revision: 0.1 $ | sed 's%[^0-9.]%%g'`
  110. X#
  111. X#
  112. X# parse the command line arguments
  113. Xwhile [ X$1 != X ]; do
  114. X    case $1 in
  115. X    -h* )
  116. X        usage
  117. X    ;;
  118. X
  119. X    -N* )
  120. X         bsize=$2
  121. X        shift
  122. X    ;;
  123. X
  124. X    * )
  125. X        if [ "X$infile" = X ]; then
  126. X            infile=$1
  127. X        else
  128. X            if [ "X$ofile" = X ]; then
  129. X                ofile=$1
  130. X            fi
  131. X        fi
  132. X    ;;
  133. X    esac
  134. X    shift
  135. Xdone
  136. X
  137. X# must have input file!
  138. Xif [ "X$infile" = X ]; then
  139. X    echo Required argument missing!
  140. X    echo
  141. X    usage
  142. Xfi
  143. X
  144. Xif [ "X$ofile" = X ]; then
  145. X    ofile=`basename $infile .lzh`
  146. Xfi
  147. Xecho infile = $infile, outfile = $ofile
  148. X
  149. Xsplit_file $infile $ofile $bsize
  150. Xexit 0
  151. SHAR_EOF
  152. chmod 0755 split || echo "restore of split fails"
  153. echo "x - extracting splitlzh.c (Text)"
  154. sed 's/^X//' << 'SHAR_EOF' > splitlzh.c &&
  155. X/*
  156. X * splitlzh - Split a LZH file into a multivolume archive suitable for
  157. X *            processing by LhA.
  158. X *
  159. X * This is freely distributable. Do with it whatever you desire.
  160. X *
  161. X * Written by Stefan Boberg, 1992
  162. X *
  163. X */
  164. X
  165. X#include <stdio.h>
  166. X#include <string.h>
  167. X
  168. X#define EXIT_FAILURE 1
  169. X
  170. XFILE *open_vol(name, no)
  171. Xchar *name;
  172. Xlong no;
  173. X{
  174. X  char work[1024];
  175. X
  176. X  if (no)
  177. X    sprintf(work, "%s.l%02d", name, no);
  178. X  else
  179. X    sprintf(work, "%s.lzh", name);
  180. X
  181. X  return fopen(work, "wb");
  182. X}
  183. X
  184. Xint main(argc, argv)
  185. Xint argc;
  186. Xchar **argv;
  187. X{
  188. X  char buffer[1024];              /* Small I/O buffer */
  189. X  FILE *in, *out;
  190. X  long size, i, j = 1024, vol_no = 0;
  191. X
  192. X  if (argc != 4) {
  193. X    printf("Usage: %s <arcsize in KB> <infile> <outname>\n", argv[0]);
  194. X    exit(EXIT_FAILURE);
  195. X  }
  196. X
  197. X  size = atoi(argv[1]);
  198. X
  199. X  if (in = fopen(argv[2], "rb")) {
  200. X    while (!feof(in)) {
  201. X      if (out = open_vol(argv[3], vol_no++)) {
  202. X        i = size;
  203. X
  204. X        while((i--) && (j == 1024)) {
  205. X          j = fread(buffer, 1, 1024, in);
  206. X          fwrite(buffer, 1, j, out);
  207. X        }
  208. X        fclose(out);
  209. X      } else {
  210. X        fclose(in);
  211. X        printf("Error opening volume %d!\n\n", vol_no);
  212. X        exit(EXIT_FAILURE);
  213. X      }
  214. X    }
  215. X  } else {
  216. X    printf("Error opening source!!\n\n");
  217. X    exit(EXIT_FAILURE);
  218. X  }
  219. X
  220. X  return 0;
  221. X}
  222. SHAR_EOF
  223. chmod 0644 splitlzh.c || echo "restore of splitlzh.c fails"
  224. exit 0
  225.  
  226. --
  227. // Adrian Tritschler                     // ajft@ajft_sun.cs.adfa.oz.au      // 
  228. ||\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\|| (06) 268 8166/\/\/\/\/\/\/\/\/\/\||
  229. || UAE: Uncontrollable African Elephants || Comp Sci Dept, ADFA              ||
  230. \\ Chewing Segments, run for cover       \\ Canberra, ACT, Australia         \\
  231.