h) ++pwch; textlen = pwch - text.wz; /* in wchar_ts */ /* textlen now contains length in wide chars */ } #else /* WPRFLAG */ if (flags & (FL_LONG|FL_WIDECHAR)) { size_t temp; char tchr[MB_LEN_MAX]; if (text.wz == NULL) /* NULL passed, use special string */ text.wz = __wnullstring; bufferiswide = 1; pwch = text.wz; for (textlen=0; textlen { if ((temp = wctomb(tchr, *pwch))<=0) break; textlen += temp; } /* textlen now contains length in bytes */ } else { if (text.sz == NULL) /* NULL passed, use special string */ text.sz = __nullstring; p = text.sz; while (i-- && *p) ++p; textlen = p - text.sz; /* length of the string */ } #endif /* WPRFLAG */ } break; case _T('n'): { /* write count of characters seen so far into */ /* short/int/long thru ptr read from args */ void *p; /* temp */ p = get_ptr_arg(&argptr); /* store chars out into short/long/int depending on flags */ #if !LONG_IS_INT if (flags & FL_LONG) *(long *)p = charsout; else #endif #if !SHORT_IS_INT if (flags & FL_SHORT) *(short *)p = (short) charsout; else #endif *(int *)p = charsout; no_output = 1; /* force no output */ } break; case _T('E'): case _T('G'): capexp = 1; /* capitalize exponent */ ch += _T('a') - _T('A'); /* convert format char to lower */ /* DROP THROUGH */ case _T('e'): case _T('f'): case _T('g'): { /* floating point conversion -- we call cfltcvt routines */ /* to do the work for us. */ flags |= FL_SIGNED; /* floating point is signed conversion */ text.sz = buffer.sz; /* put result in buffer */ /* compute the precision value */ if (precision < 0) precision = 6; /* default precision: 6 */ else if (precision == 0 && ch == _T('g')) precision = 1; /* ANSI specified */ #if !LONGDOUBLE_IS_DOUBLE /* do the conversion */ if (flags & FL_LONGDOUBLE) { LONGDOUBLE tmp; tmp=va_arg(argptr, LONGDOUBLE); /* Note: assumes ch is in ASCII range */ _cldcvt(&tmp, text.sz, (char)ch, precision, capexp); } else #endif { DOUBLE tmp; tmp=va_arg(argptr, DOUBLE); /* Note: assumes ch is in ASCII range */ _cfltcvt(&tmp,text.sz, (char)ch, precision, capexp); } /* '#' and precision == 0 means force a decimal point */ if ((flags & FL_ALTERNATE) && precision == 0) _forcdecpt(text.sz); /* 'g' format means crop zero unless '#' given */ if (ch == _T('g') && !(flags & FL_ALTERNATE)) _cropzeros(text.sz); /* check if result was negative, save '-' for later */ /* and point to positive part (this is for '0' padding) */ if (*text.sz == '-') { flags |= FL_NEGATIVE; ++text.sz; } textlen = strlen(text.sz); /* compute length of text */ } break; case _T('d'): case _T( |