Menu

#305 cscope not able to change strings in cygwin

open
nobody
cygwin (1)
5
2023-12-22
2023-12-22
regloh
No

cscope 15.9 in cygwin (Windows 10) is not able to change a text string. During the replacement process only question marks are displayed indicating an error in the invoked ed-script and no changes are executed. The reason for this behavior are carriage return characters in the script, which unix ed cannot cope with.

I created a test file containing only one line
int blabla = 0;
and tried to change the variable name to ballaballa. The generated ed-scipt then looked like (opened with vi -b):

ed - <<\!^M
e test.c^M
1s/blabla/ballaballa/gp^M
w^M
q^M
!^M

The ^M symbols just represent \r.

I changed the line

if ((script = myfopen(temp2, "w")) == NULL) {

in the function "static BOOL changestring(void)" of the file command.c
to

if ((script = myfopen(temp2, "wb")) == NULL) {

This small change fixed the problem (at least for cygwin).

Discussion


Log in to post a comment.