It previously entered an infinite loop. Now it inserts the `to` string
between every character of `from`, including at the beginning and end.
rename -a '' _ 123.txt # renames to _1_2_3_._t_x_t_
if (where == NULL)
return 1;
count++;
- while ((all || last) && p) {
- p = strstr(p + (last ? 1 : fromlen), from);
+ while ((all || last) && p && *p) {
+ p = strstr(p + (last ? 1 : max(fromlen, (size_t) 1)), from);
if (p) {
if (all)
count++;
p = to;
while (*p)
*q++ = *p++;
- p = where + fromlen;
- where = strstr(p, from);
+ if (fromlen > 0) {
+ p = where + fromlen;
+ where = strstr(p, from);
+ } else {
+ p = where;
+ where += 1;
+ }
}
while (*p)
*q++ = *p++;
`rename_zz_last_zzz.y' -> `rename_zz_last_zAAzzBB.y'
`rename_zz_last_zzz.z' -> `rename_zz_last_zAAzzBB.z'
what is rename*last* doing here?
+`rename_all_empty' -> `_r_e_n_a_m_e___a_l_l___e_m_p_t_y_'
echo "what is $i doing here?" >> $TS_OUTPUT
done
+touch rename_all_empty
+$TS_CMD_RENAME -v -a '' _ rename_all_empty >> $TS_OUTPUT 2>> $TS_ERRLOG
+rm -f _r_e_n_a_m_e___a_l_l___e_m_p_t_y_
+
ts_finalize