From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ac3fc59590c9d4cd,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-08-24 15:23:01 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!headwall.stanford.edu!unlnews.unl.edu!newsfeed.ksu.edu!nntp.ksu.edu!news.okstate.edu!not-for-mail From: David Starner Newsgroups: comp.lang.ada Subject: Unix text handling on stdin Date: 24 Aug 2001 21:36:19 GMT Organization: Oklahoma State University Message-ID: <9m6hcj$aai1@news.cis.okstate.edu> Reply-To: dstarner98@aasaa.ofe.org NNTP-Posting-Host: x8b4e5129.dhcp.okstate.edu User-Agent: slrn/0.9.7.2 (Linux) Xref: archiver1.google.com comp.lang.ada:12400 Date: 2001-08-24T21:36:19+00:00 List-Id: I've worked on a couple things where I've had problems with this, so I'd figure I'd ask it here. How do I read in a text file from stdin as text, do some analysis on it, and then spit it out binary identical version of stdout? That is, every form-feed (probably interpreted as a new page by Ada.Text_IO), every carriage return, every line feed in the original exists in the output in the exact same place; likewise the present or absences of a trailing LF or CRLF. The problems I had, were: (a) Ada.Text_IO will happily munch a form feed in such a way that it's hard to tell whether we had a form feed or new line. (b) From my reading, it's entirely standards-compliant to treat LF and CRLF the same way on Unix; it would certainly simplify things. This is a theoritical problem for me, as GNAT doesn't do this. (c) GNAT would always terminate the output with a new line when the program ended. (This was serious problem when I was trying to write up a submission for the latest ICFP. The output couldn't be larger than the input; but if the input was minimal and had no trailing newline, the trailing newline would cause the program to lose.) I understand that Ada.Text_IO is supposed to be portable; but I need it to work in a system correct way more than I need it to be portable. Is there any maximally standards complaint way to solve this? How about 'it should work on any reasonable compiler' way? GNAT specific way will work; restricting myself to GNAT on Linux is not much different than just restricting myself to Linux. -- David Starner - dstarner98@aasaa.ofe.org Pointless website: http://dvdeug.dhis.org "I don't care if Bill personally has my name and reads my email and laughs at me. In fact, I'd be rather honored." - Joseph_Greg