X-Spam-Check-By: sourceware.org Message-ID: X-Sender: arundelo AT hotmail DOT com From: "Aaron Brown" To: References: <000701c73029$77e383e0$0708090a AT CAM DOT ARTIMI DOT COM> Subject: Re: Compile-time detection of EOL translation mode (CLISP) Date: Thu, 4 Jan 2007 13:57:47 -0500 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook Express 6.00.2900.2869 X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Dave Korn wrote: >> From within the C preprocessor, how do I find out whether >> a Cygwin installation is set to use dos or unix EOLs? > > You don't. Whatever you're trying to do, this is the > wrong way to go about it. > What is the /end/ result you're trying to achieve here? When CLISP does text output, it opens the file in binary mode and does EOL translation itself, according to the requested line terminator mode. For instance, the following function writes a file with LF, CRLF, or CR EOLs depending on whether its argument is :unix, :dos, or :mac. ;; See http://clisp.cons.org/impnotes/encoding.html#newline (defun newlinetest (line-terminator) (with-open-file (out "eoltest.txt" :external-format (ext:make-encoding :line-terminator line-terminator) :direction :output :if-does-not-exist :create :if-exists :new-version) (format out "foo~%bar~%"))) That works exactly as intended. My problem is that if I don't specify a :line-terminator, :dos is used instead of :unix. (This is controlled by *default-file-encoding*, which itself is set by line 2571 of encoding.d when CLISP is compiled.) The reason I expect :unix to be the default rather than :dos is that when I ran the Cygwin setup.exe, I selected the "Unix / binary (RECOMMENDED)" radio button under "Default Text File Type". Is this expectation unwarranted? The one-sentence version of the problem: CLISP writes newlines as "\r\n" by default, when I want the default to be "\n". I could just specify :unix every time, but that's a hassle and is (as far as I can tell) impossible with standard output. Thanks, -- Aaron http://www.amazon.com/gp/product/0470069171/ -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/