delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/12/31/16:33:13

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <Pine.BSM.4.64L.1112311952120.14351@herc.mirbsd.org>
References: <jdmp00$dso$1 AT dough DOT gmane DOT org> <jdna2f$cqu$1 AT dough DOT gmane DOT org> <CAGHJv4cccBsX3=Mw3CykKXbyqZctONt0hUf6mUO_52RxsGXW=g AT mail DOT gmail DOT com> <CAGHJv4e2=c6Vm6Lu0W78rR1zVx7w1N_Ajs5Py+nfDnX1oRiCdg AT mail DOT gmail DOT com> <Pine DOT BSM DOT 4 DOT 64L DOT 1112311952120 DOT 14351 AT herc DOT mirbsd DOT org>
Date: Sat, 31 Dec 2011 16:32:21 -0500
Message-ID: <CAGHJv4fgtM+QCFnrGb0pD-FT5A3R0hwOV8uF+4C_xEmtr_+dzQ@mail.gmail.com>
Subject: Fwd: CRLF
From: Chris Sutcliffe <ir0nh34d AT gmail DOT com>
To: The Cygwin Mailing List <cygwin AT cygwin DOT com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id pBVLXA5P009074

Below please find the response from Thorsten (the mksh developer)
regarding CRLF.

Chris

---------- Forwarded message ----------
From: Thorsten Glaser
Date: 31 December 2011 15:00
Subject: Re: CRLF
To: miros-discuss AT mirbsd DOT org

Chris Sutcliffe dixit:

>The mksh developer's preference is that mksh behave the same
>irregardless of platform

Yes. I’m even prepared to fight POSuX on some of the things
they mandate that would require different behaviour across
platforms, and, if necessary, be not compliant. This is a
feature, and really a big one, trust me.

Implicit CR stripping WILL break existing scripts. I know
of at least one.

>> Or you could use dos2unix...
>
>I think this would be the best course of action on this particular issue.

tr -d \\r would work, too (but also strip CR in the middle).

Quick hack (needs just a POSuX shell and no local builtin):

mkshdos_re=$(printf 's/\r$//')
mkshdos() {
       if test -n "$1"; then
               mkshdos_fn=$1
               shift
       else
               mkshdos_fn=-
       fi
       mkshdos_T=$(mktemp /tmp/mkshdos.XXXXXXXXXX) || {
               echo >&2 mkshdos: Error: Could not create temporary file.
               return 255
       }
       sed "$mkshdos_re" <"$mkshdos_fn" >"$mkshdos_T"
       mksh "$mkshdos_T" "$@"
       mkshdos_rv=$?
       rm -f "$mkshdos_T"
       return $mkshdos_rv
}

Please forward this.

-- 
Chris Sutcliffe
http://emergedesktop.org
http://www.google.com/profiles/ir0nh34d

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


- Raw text -


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