[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Why would MS want to make XML break on UNIX, Perl, Python


python pipe
 From: "Alan Kent" <ajk@m...>

> On Thu, Dec 20, 2001 at 03:54:02PM +1100, Rick Jelliffe wrote:
> > Sure, lets make XML unsuitable for use in UNIX pipes by allowing ^D.
> > And for Perl and Python text-processing programs that use standard in and 
> > expect EOF (^D or ^Z).
> 
> I cannot speak for all of the languages, but you certainly can send ^D
> down a UNIX pipe. I think you are mixing up the tty processing of human
> input and what is implemented in the OS/programming language. I don't
> think many people will by typing in XML documents by hand down a pipe! :-)
> Oh, and with UNIX I think you can send a ^D anyway by typing ^V^D
> (depending on your shell).

As I understand it, a file opened in text mode through stdio may have embedded ^D (UNIX) 
or ^Z (PC) converted to EOF by the standard library routines that read/write from/to
stdio and present them to the application. This is independent of terminal signals,
such as sending ^D to a shell.

See (for a C++ implementation) http://www.cplusplus.com/ref/cstdio/fopen.html
"Text mode. In text mode the end of file is assumed to be at first Ctrl-Z character. Some conversions can occur reading and writing with End Of Line / Feedback characters depending on your compiler and your Operating System."

So if you can send ^D down your UNIX pipes, it is because the specific programs in the 
pipeline happen to be reading the input stream in binary mode not text mode.  Generic 
programs (such as cat) should be written to use binary. 

For a little selection of related material (for Python, Perl, CGI, Haskel, C)
http://www.wdvl.com/Authoring/Languages/Python/Quick/python4_2.html
http://aspn.activestate.com/ASPN/Reference/Products/ActivePerl/faq/Windows/ActivePerl-Winfaq8.html  (see "readin from and writing to files mysteriously fails")
  http://cscene.org/topics/web/snibril-cgi1.xml.html
  http://www.haskell.org/ghc/docs/5.02.1/set/sec-prelstd.html
http://www.cs.mu.oz.au/~fjh/gnu-win32/bugs-list.html (see "Other Caveats at the bottom")
  http://www.cygwin.com/ml/cygwin/1997-04/msg00198.html

Cheers
Rick Jelliffe






PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.