delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/06/22/07:57:47

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Message-ID: <19990622115503.16062.rocketmail@web115.yahoomail.com>
Date: Tue, 22 Jun 1999 04:55:03 -0700 (PDT)
From: Earnie Boyd <earnie_boyd AT yahoo DOT com>
Reply-To: earnie_boyd AT yahoo DOT com
Subject: Fwd: Re: How do I split binaries to manageable chunks
To: cygwin users <cygwin AT sourceware DOT cygnus DOT com>
MIME-Version: 1.0

--0-1714636915-930052503=:14994
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

 
 
===
Earnie Boyd <mailto:earnie_boyd AT yahoo DOT com>

Newbies, please visit
<http://www.freeyellow.com/members5/gw32/index.html>

(If you respond to the list, then please don't cc me)
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

--0-1714636915-930052503=:14994
Content-Type: message/rfc822

X-Apparently-To: earnie_boyd AT yahoo DOT com via mdd102.yahoomail.com
Received: from smtp4.erols.com (HELO smtp-hub.mail.erols.net) (207.172.3.237)
  by mta113.yahoomail.com with SMTP; 21 Jun 1999 18:12:33 -0700
Received: from smtp2.erols.com (smtp2.erols.com [207.172.3.235])
	by smtp-hub.mail.erols.net (8.8.8/smtp-v1) with ESMTP id VAA23408
	for <earnie_boyd AT yahoo DOT com>; Mon, 21 Jun 1999 21:09:32 -0400 (EDT)
Received: from erols.com (207-172-70-58.s58.tnt11.brd.va.dialup.rcn.com [207.172.70.58])
	by smtp2.erols.com (8.8.8/8.8.5) with ESMTP id VAA01994;
	Mon, 21 Jun 1999 21:13:25 -0400 (EDT)
Message-ID: <376E78DB DOT 72557579 AT erols DOT com>
Date: Mon, 21 Jun 1999 13:39:39 -0400
From: mark levedahl <mlevedahl AT erols DOT com>
X-Mailer: Mozilla 4.51 [en] (WinNT; U)
X-Accept-Language: en
MIME-Version: 1.0
To: "William S. Shu" <wshu AT essex DOT ac DOT uk>, cygwin AT sourceware DOT cygnus DOT com,
        itz AT lbin DOT com, earnie_boyd AT yahoo DOT com
Subject: Re: How do I split binaries to manageable chunks
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Length: 2942

>--- "William S. Shu" <wshu AT essex DOT ac DOT uk> wrote:
>> Hello all,
>> I tried using the cygwin-20 split command (under windows 95) to split binary
>> files into manageable chunks.  This is for them to be transmitted down noisy
>> lines, and be reconstituted (cf. your split version of full.exe).
>> Unfortunately, it seems to handle only text files.
>>
>> My question is/are:
>> 1)    Could you please indicate to split and later recombine binary file(s)?
>> 2)    Do I need to convert the file to a text equivalent before using split?
>> If so, what software can I use to do this?
>
>> Hmm.  The split program is part of the textutils package.  I just checked the
>> cygwin source and find that it does not specify any file processing mode. :-((
>> I suggest that you get the textutils package and properly port split.c by
>> specifying the processing mode for the files being open both input and
>> output.
>
> Well, this looks exactly like the situation that shows the ultimate
> futility of trying to accomodate MSDOG text files.  How is split to
> know what type of file it is handling?  Should we embed a copy of
> file(1) into split?  Stoop down to MSDOG practice and rely on file
> names?  Or what?

split operates in byte mode (equate to binary) and line mode (equate to
text). It also has a combined byte/line mode which I arbitrarily assign
to text mode - a line has no meaning in binary mode. Give that, the
following seems to fix split in textutils 1.22 quite nicely. I've been
using this for the last year with no problems.

Mark Levedahl

diff -ubr textutils-1.22-orig/src/split.c textutils-1.22/src/split.c
--- textutils-1.22-orig/src/split.c	Sat Jan 25 01:06:23 1997
+++ textutils-1.22/src/split.c	Mon Jun 21 13:30:15 1999
@@ -39,6 +39,10 @@
 # define INT_MAX ((int) (UINT_MAX >> 1))
 #endif

+#ifdef __CYGWIN__
+int     binary_mode = 0;
+#endif
+
 #include "system.h"
 #include "error.h"
 #include "xstrtol.h"
@@ -179,7 +183,13 @@
       next_file_name ();
       if (verbose)
 	fprintf (stderr, _("creating file `%s'\n"), outfile);
-      output_desc = open (outfile, O_WRONLY | O_CREAT | O_TRUNC, 0666);
+#ifdef __CYGWIN__
+      output_desc = open (outfile, O_WRONLY | O_BINARY | O_CREAT |
O_TRUNC
+		| (binary_mode ? O_BINARY : O_TEXT), 0666);
+#else	
+      output_desc = open (outfile, O_WRONLY | O_BINARY | O_CREAT |
O_TRUNC, 0666);
+#endif
+
       if (output_desc < 0)
 	error (EXIT_FAILURE, errno, "%s", outfile);
     }
@@ -508,12 +518,20 @@
       usage (EXIT_FAILURE);
     }

+#ifdef __CYGWIN__
+	binary_mode = (split_type == type_bytes);
+#endif
+
   /* Open the input file.  */
   if (!strcmp (infile, "-"))
     input_desc = 0;
   else
     {
+#ifdef __CYGWIN__
+      input_desc = open (infile, O_RDONLY | (binary_mode ? O_BINARY :
O_TEXT));
+#else
       input_desc = open (infile, O_RDONLY);
+#endif
       if (input_desc < 0)
 	error (EXIT_FAILURE, errno, "%s", infile);
     }


=========================




--0-1714636915-930052503=:14994
Content-Type: text/plain; charset=us-ascii

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
--0-1714636915-930052503=:14994--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019