1 #! /bin/sh /usr/share/dpatch/dpatch-run
2 ## 13widechar_horrors.dpatch by <hesso@pool.math.tu-berlin.de>
4 ## DP: This patch tries to cope with the fact that widechar support
5 ## DP: in nvi is at best rudimentary.
7 ## DP: * Due to "ch = *t", this code is not wide-char aware, so
8 ## DP: cast the value to a proper type so the KEY_ macros make
9 ## DP: the right choice.
11 ## DP: * Printing of the in-/decreased number back into the screen
12 ## DP: buffer is not widechar-aware, either. Add a dirty fix.
16 --- nvi-1.81
.6.orig
/vi
/vs_msg.c
2007-11-18 17:41:42.000000000 +0100
17 +++ nvi-1.81
.6/vi
/vs_msg.c
2009-03-01 14:51:08.211414132 +0100
22 - chlen
= KEY_LEN
(sp
, ch
);
23 + chlen
= KEY_LEN
(sp
, (unsigned char
)ch
);
24 if (cbp
+ chlen
>= ecbp
)
26 - for (kp
= KEY_NAME
(sp
, ch
); chlen--
;)
27 + for (kp
= KEY_NAME
(sp
, (unsigned char
)ch
); chlen--
;)
31 --- nvi-1.81
.6.orig
/vi
/v_increment.c
2007-11-18 17:41:42.000000000 +0100
32 +++ nvi-1.81
.6/vi
/v_increment.c
2009-03-01 15:12:50.950415874 +0100
34 long change
, ltmp
, lval
;
35 size_t beg
, blen
, end
, len
, nlen
, wlen
;
36 int base
, isempty
, rval
;
37 - char
*ntype
, nbuf
[100];
38 + char
*ntype
, nbuf
[100 * sizeof
(CHAR_T
)];
41 /* Validate the operator.
*/
43 /* If we cross
0, signed numbers lose their sign.
*/
44 if (lval
== 0 && ntype
== fmt[SDEC
])
46 - nlen
= snprintf
(nbuf
, sizeof
(nbuf
), ntype
, lval
);
47 + nlen
= snprintf
(nbuf
, sizeof
(nbuf
)/sizeof
(CHAR_T
), ntype
, lval
);
49 if ((nret
= nget_uslong
(sp
, &ulval
, t
, NULL
, base
)) != NUM_OK
)
55 - nlen
= snprintf
(nbuf
, sizeof
(nbuf
), ntype
, wlen
, ulval
);
56 + nlen
= snprintf
(nbuf
, sizeof
(nbuf
)/sizeof
(CHAR_T
), ntype
, wlen
, ulval
);
59 + /* Inflate the printed char buffer to CHAR_T elements
if necessary
*/
60 + if (sizeof
(CHAR_T
) > sizeof
(char
)) {
62 + for (nlen_inflate
= nlen
; nlen_inflate
>= 0; nlen_inflate--
) {
63 + ((CHAR_T
*)nbuf
)[nlen_inflate
] = nbuf
[nlen_inflate
];
67 /* Build the new line.
*/