|
| >From OpenBSD revision 1.23
| date: 2011/04/15 16:05:34; author: stsp; state: Exp; lines: +7 -3 e!
| Make the file_mbswidth() function cope if wcwidth() returns -1.
| ok mikeb millert
Here, ok Christos.
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: file.c,v 1.149 2013/01/07 18:20:19 christos Exp $")
+FILE_RCSID("@(#)$File: file.c,v 1.150 2013/06/04 21:51:00 ian Exp $")
#endif /* lint */
#include "magic.h"
* is always right
*/
width++;
- } else
- width += wcwidth(nextchar);
+ } else {
+ w = wcwidth(nextchar);
+ if (w > 0)
+ width += w;
+ }
s += bytesconsumed, n -= bytesconsumed;
}