/* This file must be included last because the redefinition of wchar_t may
cause conflicts when system include files were included after it. */
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
# include <wchar.h>
# include <wctype.h>
-#if 0 /* for testing on platforms without built-in wide character support */
-# include <libutf8.h>
-#endif
-#if 1
-/* explicit prototypes, since sometimes <wchar.h> does not give them */
-extern int wcwidth (wchar_t c); /* old: wint_t c */
-extern int wcswidth (const wchar_t *s, size_t n);
-extern size_t wcslen (const wchar_t *s);
-extern wchar_t *wcsdup (const wchar_t *s);
-#endif
-
-#else
+#else /* !HAVE_WIDECHAR */
# include <ctype.h>
/* Fallback for types */
# define wcwidth(c) 1
-#endif
+#endif /* HAVE_WIDECHAR */
exit(0);
}
-#ifndef ENABLE_WIDECHAR
+#ifndef HAVE_WIDECHAR
static char *eos(char *s) {
while (s && *s)
s++;
void headers_init(void)
{
int i, wd;
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
wchar_t day_headings_wc[22],j_day_headings_wc[29];
wchar_t wd_wc[10];
#endif
strcpy(day_headings,"");
strcpy(j_day_headings,"");
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
wcscpy(day_headings_wc,L"");
wcscpy(j_day_headings_wc,L"");
#endif
for(i = 0 ; i < 7 ; i++ ) {
wd = (i + week1stday) % 7;
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
mbstowcs(wd_wc,weekday(wd),10);
if (wcswidth(wd_wc,10) < 3)
wcscat(j_day_headings_wc,L" ");
#endif
}
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
wcstombs(day_headings,day_headings_wc,sizeof(day_headings));
wcstombs(j_day_headings,j_day_headings_wc,sizeof(j_day_headings));
#endif
void
center_str(const char* src, char* dest, size_t dest_size, int width)
{
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
wchar_t str_wc[FMT_ST_CHARS];
#endif
char str[FMT_ST_CHARS];
len = strlen(src);
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
if (mbstowcs(str_wc, src, FMT_ST_CHARS) > 0) {
wide_char_enabled = 1;
len = wcswidth(str_wc, SIZE(str_wc));
if (len > width) {
str_to_print=str;
if (wide_char_enabled) {
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
str_wc[width]=L'\0';
wcstombs(str, str_wc, SIZE(str));
#endif
#include "widechar.h"
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
#define wcs_width(s) wcswidth(s,wcslen(s))
static wchar_t *mbs_to_wcs(const char *);
#else
}
}
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
static wchar_t *mbs_to_wcs(const char *s)
{
size_t n;
}
#endif
-#ifndef ENABLE_WIDECHAR
+#ifndef HAVE_WIDECHAR
static char *mtsafe_strtok(char *str, const char *delim, char **ptr)
{
if (str == NULL) {
int column;
static int colflg;
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
int i;
wchar_t wc;
int wc_width;
c = Getc (f);
}
while (p < &Line[LINSIZ - 1]) {
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
if (fold_opt && use_mbc_buffer_flag && MB_CUR_MAX > 1) {
use_mbc_buffer_flag = 0;
state_bak = state;
*length = p - Line;
return (column);
} else {
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
if (fold_opt && MB_CUR_MAX > 1) {
memset (mbc, '\0', MB_LEN_MAX);
mbc_pos = 0;
}
else if (((cc_t) c == otty.c_cc[VERASE]) && !slash) {
if (sp > buf) {
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
if (MB_CUR_MAX > 1)
{
wchar_t wc;
usage();
}
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
/*
* A mbstowcs()-alike function that transparently handles invalid sequences.
*/
return 0;
}
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
/*
* Return the last character that will fit on the line at col columns
* in case MB_CUR_MAX > 1.
unsigned pos = 0;
char *t = s;
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
if (MB_CUR_MAX > 1)
return endline_for_mb(col, s);
#endif
cmd.count = getcount(cmd.cmdline);
}
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
/*
* Remove backspace formatting, for searches
* in case MB_CUR_MAX > 1.
{
char *p = s, *q;
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
if (MB_CUR_MAX > 1)
return colb_for_mb(s);
#endif
return s;
}
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
/*
* Convert nonprintable characters to spaces
* in case MB_CUR_MAX > 1.
static void
makeprint(char *s, size_t l)
{
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
if (MB_CUR_MAX > 1)
return makeprint_for_mb(s, l);
#endif
#include "widechar.h"
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
static int put1wc(int c) /* Output an ASCII character as a wide character */
{
if (putwchar(c) == WEOF)