Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Message-ID: <004501c02f18$017884d0$c4acb018@home.com> From: "Erik Nolte" To: Subject: Bash patches Date: Thu, 5 Oct 2000 16:02:50 -0600 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 I realize there is currently no bash maintainer, but how do I propose patches and to whom do I send them in the interim? Below are patches to fix: (1) The backtick (command substitution) CR-LF problem I reported on 26Sep00 under the title "Has CR/LF and cat problem with textutils-2.0 been solved?" read_comsub() was modified in src/bash/subst.c to convert CR-LF into NL immediately after the text is read from the command. (2) The cd/CDPATH erroneous echoing of the path for DOS absolute pathnames. This was reported on 26Sep00 under the title "Strange cd/CDPATH behavior". absolute_pathname() was modified in src/bash/general.c to treat [A-Za-z]:[/\]* as absolute pathnames. I started with the source at ftp://sources.redhat.com/pub/cygwin/latest/bash/bash-2.04-1-src.tar.gz and ran the diff as "diff -u -p original-file new-file". - Erik ============================================================================ == --- subst.c.old Thu Oct 5 14:46:28 2000 +++ subst.c Thu Oct 5 15:25:24 2000 @@ -148,6 +148,7 @@ static char *string_list_dollar_at (), * static inline int skip_single_quoted (), skip_double_quoted (); static char *extract_delimited_string (); static char *extract_dollar_brace_string (); +static char *crlf_to_nl (); /* **************************************************************** */ /* */ @@ -3351,6 +3352,9 @@ read_comsub (fd, quoted) FREE (istring); return (char *)NULL; } +#ifdef __CYGWIN__ + crlf_to_nl(istring); +#endif /* Strip trailing newlines from the output of the command. */ if (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) @@ -3375,6 +3379,34 @@ read_comsub (fd, quoted) return istring; } + +#ifdef __CYGWIN__ +/* Convert DOS line termination (CR-LF) to UNIX line termination (NL). + This does an in-place conversion on the parameter and returns + the converted parameter. */ + +static char* +crlf_to_nl (str) + char *str; +{ + if ( str ) + { + char *rp = str; + char *wp = str; + + while (*rp != '\0') + { + if ( *rp == '\n' && rp > str && *(rp-1) == '\r' ) + --wp; + *wp++ = *rp++; + } + + *wp = '\0'; + } + + return str; +} +#endif /* Perform command substitution on STRING. This returns a string, possibly quoted. */ ============================================================================ == --- general.c.old Thu Oct 5 13:59:18 2000 +++ general.c Thu Oct 5 14:04:00 2000 @@ -592,6 +592,15 @@ absolute_pathname (string) if (*string == '/') return (1); +#if __CYGWIN__ + /* In cygwin, DOS pathnames that specify a drive and an absolute + directory relative to that drive (like c:/ and d:/x/y/z) are absolute */ + + if (isalpha(*string) && *(string+1)==':' && + (*(string+2)=='/' || *(string+2)=='\\')) + return (1); +#endif + if (*string++ == '.') { if (!*string || *string == '/' || -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com