|
From: Earnie B. <ea...@us...> - 2005-05-22 10:35:38
|
Update of /cvsroot/mingw/msys/packages/bash/2.05b In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13866 Modified Files: parse.y subst.c variables.c y.tab.c Added Files: ChangeLog.MSYS Log Message: * ChangeLog: New file. * support/config.guess: Add support for MSYS. * support/config.sub: Ditto. * builtin/cd.def (pwd): Add -W switch. * builtin/fc.def (fc_readline): Handle \r. * subst.c (string_list_dollar_at): Handle win32 separators. (read_comsub): Handle \r. (command_substitute): Ditto. * variables.c (make_variable_value): Path conversion for prefix variable. (bind_variable): Handle \r. * parse.y (yy_getc): Ditto. * y.tab.c (yy_getc): Ditto. Index: parse.y =================================================================== RCS file: /cvsroot/mingw/msys/packages/bash/2.05b/parse.y,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** parse.y 22 May 2005 10:13:04 -0000 1.1 --- parse.y 22 May 2005 10:35:27 -0000 1.2 *************** *** 1040,1044 **** --- 1040,1050 ---- yy_getc () { + #ifdef __MSYS__ + int c; + while ((c = (*(bash_input.getter)) ()) == '\r'); + return c; + #else return (*(bash_input.getter)) (); + #endif } Index: y.tab.c =================================================================== RCS file: /cvsroot/mingw/msys/packages/bash/2.05b/y.tab.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** y.tab.c 22 May 2005 10:13:04 -0000 1.1 --- y.tab.c 22 May 2005 10:35:27 -0000 1.2 *************** *** 2561,2565 **** --- 2561,2571 ---- yy_getc () { + #ifdef __MSYS__ + int c; + while ((c = (*(bash_input.getter)) ()) == '\r'); + return c; + #else return (*(bash_input.getter)) (); + #endif } *************** *** 3337,3340 **** --- 3343,3350 ---- RESIZE_MALLOCED_BUFFER (shell_input_line, i, 2, shell_input_line_size, 256); + #ifdef __MSYS__ + if (c == '\r') + continue; + #endif if (c == EOF) { Index: variables.c =================================================================== RCS file: /cvsroot/mingw/msys/packages/bash/2.05b/variables.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** variables.c 22 May 2005 10:13:04 -0000 1.1 --- variables.c 22 May 2005 10:35:27 -0000 1.2 *************** *** 1601,1604 **** --- 1601,1607 ---- { char *retval; + #ifdef __MSYS__ + char *wbuffer = xmalloc(PATH_MAX); + #endif intmax_t lval; int expok; *************** *** 1625,1628 **** --- 1628,1637 ---- retval[0] = '\0'; } + #ifdef __MSYS__ + if (strncmp (var->name, "prefix", 6) == 0) { + cygwin_conv_to_win32_path (retval, wbuffer); + retval = wbuffer; + } + #endif } else *************** *** 1712,1715 **** --- 1721,1737 ---- VAR_CONTEXT *vc; + #ifdef __MSYS__ + /* Remove trailing \r from value */ + { + char *tpos; + if (value) + { + tpos = strchr (value, '\0'); + tpos--; + if (*tpos == '\r') + *tpos = '\0'; + } + } + #endif if (shell_variables == 0) { *************** *** 2753,2757 **** for (i = 0, list_index = 0; var = vars[i]; i++) { ! #if defined (__CYGWIN__) /* We don't use the exportstr stuff on Cygwin at all. */ INVALIDATE_EXPORTSTR (var); --- 2775,2779 ---- for (i = 0, list_index = 0; var = vars[i]; i++) { ! #if defined (__MSYS__) /* We don't use the exportstr stuff on Cygwin at all. */ INVALIDATE_EXPORTSTR (var); --- NEW FILE: ChangeLog.MSYS --- 2005.05.22 Earnie Boyd <ea...@us...> * ChangeLog: New file. * support/config.guess: Add support for MSYS. * support/config.sub: Ditto. * builtin/cd.def (pwd): Add -W switch. * builtin/fc.def (fc_readline): Handle \r. * subst.c (string_list_dollar_at): Handle win32 separators. (read_comsub): Handle \r. (command_substitute): Ditto. * variables.c (make_variable_value): Path conversion for prefix variable. (bind_variable): Handle \r. * parse.y (yy_getc): Ditto. * y.tab.c (yy_getc): Ditto. Index: subst.c =================================================================== RCS file: /cvsroot/mingw/msys/packages/bash/2.05b/subst.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** subst.c 22 May 2005 10:13:04 -0000 1.1 --- subst.c 22 May 2005 10:35:27 -0000 1.2 *************** *** 1639,1647 **** /* This performs word splitting and quoted null character removal on STRING. */ ! #if 0 ! #define issep(c) ((separators)[1] ? (member ((c), separators)) : (c) == (separators)[0]) ! #else ! #define issep(c) ((separators)[1] ? isifs(c) : (c) == (separators)[0]) ! #endif WORD_LIST * --- 1639,1646 ---- /* This performs word splitting and quoted null character removal on STRING. */ ! #define issep(c) \ ! (((separators)[0]) ? ((separators)[1] ? isifs(c) \ ! : (c) == (separators)[0]) \ ! : 0) WORD_LIST * *************** *** 3628,3632 **** istring_index = istring_size = bufn = 0; ! #ifdef __CYGWIN__ setmode (fd, O_TEXT); /* we don't want CR/LF, we want Unix-style */ #endif --- 3627,3631 ---- istring_index = istring_size = bufn = 0; ! #ifdef __MSYS__ setmode (fd, O_TEXT); /* we don't want CR/LF, we want Unix-style */ #endif *************** *** 3663,3667 **** #if 0 ! #if defined (__CYGWIN__) if (c == '\n' && istring_index > 1 && istring[istring_index - 2] == '\r') { --- 3662,3666 ---- #if 0 ! #if defined (__MSYS__) if (c == '\n' && istring_index > 1 && istring[istring_index - 2] == '\r') { *************** *** 3708,3711 **** --- 3707,3722 ---- } + #ifdef __MSYS__ + static inline void RemoveCR(); + static void + RemoveCR (string) + char * string; + { + char *pstr; + if (string && (pstr = strchr (string, '\0')) && *(--pstr) == '\r') + *pstr = '\0'; + } + #endif + /* Perform command substitution on STRING. This returns a string, possibly quoted. */ *************** *** 3718,3721 **** --- 3729,3733 ---- char *istring; int result, fildes[2], function_value; + int i, closeit[3]; istring = (char *)NULL; *************** *** 3744,3747 **** --- 3756,3769 ---- maybe_make_export_env (); /* XXX */ + + for (i = 0; i <= 2; i++) + if (fcntl (i, F_GETFD, &result) != -1) + closeit[i] = 0; + else + { + open ("/dev/null", O_RDONLY); + closeit[i] = 1; + } + /* Pipe the output of executing STRING into the current shell. */ if (pipe (fildes) < 0) *************** *** 3751,3754 **** --- 3773,3780 ---- } + for (i = 0; i <= 2; i++) + if (closeit[i]) + close (i); + old_pid = last_made_pid; #if defined (JOB_CONTROL) *************** *** 3760,3764 **** #endif ! pid = make_child ((char *)NULL, 0); if (pid == 0) /* Reset the signal handlers in the child, but don't free the --- 3786,3790 ---- #endif ! pid = make_child ((char *)NULL, subshell_environment & SUBSHELL_ASYNC); if (pid == 0) /* Reset the signal handlers in the child, but don't free the *************** *** 3795,3813 **** } ! /* If standard output is closed in the parent shell ! (such as after `exec >&-'), file descriptor 1 will be ! the lowest available file descriptor, and end up in ! fildes[0]. This can happen for stdin and stderr as well, ! but stdout is more important -- it will cause no output ! to be generated from this command. */ ! if ((fildes[1] != fileno (stdin)) && ! (fildes[1] != fileno (stdout)) && ! (fildes[1] != fileno (stderr))) ! close (fildes[1]); ! ! if ((fildes[0] != fileno (stdin)) && ! (fildes[0] != fileno (stdout)) && ! (fildes[0] != fileno (stderr))) ! close (fildes[0]); /* The currently executing shell is not interactive. */ --- 3821,3826 ---- } ! close (fildes[1]); ! close (fildes[0]); /* The currently executing shell is not interactive. */ *************** *** 3884,3887 **** --- 3897,3903 ---- #endif /* JOB_CONTROL */ + #ifdef __MSYS__ + RemoveCR (istring); + #endif return (istring); } |