ray@GIBBS.PHYSICS.PURDUE.EDU (Ray Moody) (06/14/89)
Quoted quotes do not work in bash. For example echo "a \"$PS2\" b" should print: a "bash>" b but really prints: a bash> b Ray ------------------------------------------------------------------------------- RCS file: RCS/subst.c,v retrieving revision 0.99.1.1 diff -c -r0.99.1.1 subst.c *** /tmp/,RCSt1019034 Tue Jun 13 16:13:52 1989 --- subst.c Tue Jun 13 16:05:52 1989 *************** *** 1004,1012 } case '"': ! index++; ! { ! WORD_LIST *tresult = (WORD_LIST *)NULL; t_index = index; temp = string_extract_double_quoted (string, &t_index); --- 1004,1016 ----- } case '"': ! /* Fixed Tue Jun 13 16:04:05 EST 1989 by Ray Moody */ ! /* If a " is quoted, it is just an ordinary character */ ! if (!quoted) ! { ! index++; ! { ! WORD_LIST *tresult = (WORD_LIST *)NULL; t_index = index; temp = string_extract_double_quoted (string, &t_index); *************** *** 1008,1016 { WORD_LIST *tresult = (WORD_LIST *)NULL; ! t_index = index; ! temp = string_extract_double_quoted (string, &t_index); ! index = t_index; if (string[index]) index++; --- 1012,1020 ----- { WORD_LIST *tresult = (WORD_LIST *)NULL; ! t_index = index; ! temp = string_extract_double_quoted (string, &t_index); ! index = t_index; if (string[index]) index++; *************** *** 1012,1019 temp = string_extract_double_quoted (string, &t_index); index = t_index; ! if (string[index]) ! index++; tresult = expand_string (temp, 1); free (temp); --- 1016,1023 ----- temp = string_extract_double_quoted (string, &t_index); index = t_index; ! if (string[index]) ! index++; tresult = expand_string (temp, 1); free (temp); *************** *** 1015,1022 if (string[index]) index++; ! tresult = expand_string (temp, 1); ! free (temp); if (tresult) { --- 1019,1026 ----- if (string[index]) index++; ! tresult = expand_string (temp, 1); ! free (temp); if (tresult) { *************** *** 1018,1030 tresult = expand_string (temp, 1); free (temp); ! if (tresult) ! { ! temp = savestring (tresult->word->word); ! dispose_words (tresult); ! } ! else ! temp = (char *)NULL; add_quoted_string: --- 1022,1034 ----- tresult = expand_string (temp, 1); free (temp); ! if (tresult) ! { ! temp = savestring (tresult->word->word); ! dispose_words (tresult); ! } ! else ! temp = (char *)NULL; add_quoted_string: *************** *** 1026,1032 else temp = (char *)NULL; ! add_quoted_string: if (temp) { --- 1030,1036 ----- else temp = (char *)NULL; ! add_quoted_string: if (temp) { *************** *** 1028,1037 add_quoted_string: ! if (temp) ! { ! register char *tt; ! for (tt = temp; *tt && (*tt |= 0x80); tt++); } else { --- 1032,1049 ----- add_quoted_string: ! if (temp) ! { ! register char *tt; ! for (tt = temp; *tt && (*tt |= 0x80); tt++); ! } ! else ! { ! add_null_arg: ! temp = savestring (" "); ! temp[0] = (unsigned char)0x80; ! } ! goto add_string; } } else *************** *** 1033,1046 register char *tt; for (tt = temp; *tt && (*tt |= 0x80); tt++); } ! else ! { ! add_null_arg: ! temp = savestring (" "); ! temp[0] = (unsigned char)0x80; ! } ! goto add_string; ! } break; --- 1045,1053 ----- } goto add_string; } ! } ! else ! goto add_character; break;