Fix -s in tr(1)
Forgot that in case there is a second argument given with -s you probably want to have your characters substituted. I changed it so that shortly before "deploying" we check if the "to be written"-Rune is equal to the last Rune, and proceed as needed.
This commit is contained in:
parent
ea0d16e928
commit
97ce9ea586
8
tr.c
8
tr.c
@ -218,12 +218,6 @@ read:
|
|||||||
else
|
else
|
||||||
goto write;
|
goto write;
|
||||||
}
|
}
|
||||||
if (sflag) {
|
|
||||||
if (r == lastrune)
|
|
||||||
goto read;
|
|
||||||
else
|
|
||||||
goto write;
|
|
||||||
}
|
|
||||||
if (cflag)
|
if (cflag)
|
||||||
goto write;
|
goto write;
|
||||||
for (m = 0; m < i; m++)
|
for (m = 0; m < i; m++)
|
||||||
@ -243,6 +237,8 @@ read:
|
|||||||
m--;
|
m--;
|
||||||
r = set2[m].start + (off1 - off2) / set2[m].quant;
|
r = set2[m].start + (off1 - off2) / set2[m].quant;
|
||||||
|
|
||||||
|
if (sflag && (r == lastrune))
|
||||||
|
goto read;
|
||||||
goto write;
|
goto write;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user