o multibyte character */ textlen = wctomb(buffer.sz, wchar); /* check that conversion was successful */ if (textlen < 0) no_output = 1; } else { /* format multibyte character */ /* this is an extension of ANSI */ unsigned short temp; temp = (unsigned short) get_int_arg(&argptr); #ifdef _OUT if (isleadbyte(temp >> 8)) { buffer.sz[0] = temp >> 8; buffer.sz[1] = temp & 0x00ff; textlen = 2; } else #endif /* _OUT */ { buffer.sz[0] = (char) temp; textlen = 1; } } text.sz = buffer.sz; #endif /* WPRFLAG */ } break; #if defined(_WIN32_) && !defined(_DOSX32_) /* UNDONE: NT hack */ case _T('Z'): { /* print a Counted String int i; char *p; /* temps */ struct string { short Length; short MaximumLength; char *Buffer; } *pstr; pstr = get_ptr_arg(&argptr); if (pstr == NULL || pstr->Buffer == NULL) { /* null ptr passed, use special string */ text.sz = __nullstring; textlen = strlen(text.sz); } else { if (flags & FL_WIDECHAR) { text.wz = (wchar_t *)pstr->Buffer; textlen = pstr->Length / sizeof(wchar_t); bufferiswide = 1; } else { bufferiswide = 0; text.sz = pstr->Buffer; textlen = pstr->Length; } } } break; #endif case _T('S'): /* ISO wide character string */ #ifndef WPRFLAG if (!(flags & (FL_SHORT|FL_LONG|FL_WIDECHAR))) flags |= FL_WIDECHAR; #else if (!(flags & (FL_SHORT|FL_LONG|FL_WIDECHAR))) flags |= FL_SHORT; #endif case _T('s'): { /* print a string -- */ /* ANSI rules on how much of string to print: */ /* all if precision is default, */ /* min(precision, length) if precision given. */ /* prints '(null)' if a null string is passed */ int i; char *p; /* temps */ wchar_t *pwch; /* At this point it is tempting to use strlen(), but */ /* if a precision is specified, we're not allowed to */ /* scan past there, because there might be no null */ /* at all. Thus, we must do our own scan. */ i = (precision == -1) INT_MAX : precision; text.sz = get_ptr_arg(&argptr); /* UNDONE: handle '#' case properly */ /* scan for null upto i characters */ #ifdef WPRFLAG if (flags & FL_SHORT) { if (text.sz == NULL) /* NULL passed, use special string */ text.sz = __nullstring; p = text.sz; for (textlen=0; textlen { if (isleadbyte((int)*p)) ++p; ++p; } /* textlen now contains length in multibyte chars */ } else { if (text.wz == NULL) /* NULL passed, use special string */ text.wz = __wnullstring; bufferiswide = 1; pwch = text.wz; while (i-- && *pwc |