+ }
+ }
+}
+
+
+/* This function recursively converts a given integer value to a character
+ stream. The conversion is done under the control of a given status struct
+ and written either to a character string or a stream, depending on that
+ same status struct. The status struct also keeps the function from exceeding
+ snprintf() limits, and enables any necessary padding / prefixing of the
+ output once the number of characters to be printed is known, which happens
+ at the lowermost recursion level.
+*/
+#define INT2BASE() \
+do \
+{ \
+ /* Special case: zero value, zero precision -- no output (but padding) */ \
+ if ( status->current == 0 && value == 0 && status->prec == 0 ) \
+ { \
+ intformat( value, status ); \
+ } \
+ else \
+ { \
+ /* Registering the character being printed at the end of the function here \
+ already so it will be taken into account when the deepestmost recursion \
+ does the prefix / padding stuff. \
+ */ \
+ ++(status->current); \
+ if ( ( value / status->base ) != 0 ) \
+ { \
+ /* More digits to be done - recurse deeper */ \
+ int2base( value / status->base, status ); \
+ } \
+ else \
+ { \
+ /* We reached the last digit, the deepest point of our recursion, and \
+ only now know how long the number to be printed actually is. Now we \
+ have to do the sign, prefix, width, and precision padding stuff \
+ before printing the numbers while we resurface from the recursion. \
+ */ \
+ intformat( value, status ); \
+ } \
+ /* Recursion tail - print the current digit. */ \
+ { \
+ int digit = value % status->base; \
+ if ( digit < 0 ) \
+ { \
+ digit *= -1; \
+ } \
+ if ( status->flags & E_lower ) \
+ { \
+ /* Lowercase letters. Same array used for strto...(). */ \
+ PUT( _PDCLIB_digits[ digit ] ); \
+ } \
+ else \
+ { \
+ /* Uppercase letters. Array only used here, only 0-F. */ \
+ PUT( _PDCLIB_Xdigits[ digit ] ); \
+ } \
+ } \
+ } \
+} while ( 0 )
+
+
+static void int2base( intmax_t value, struct _PDCLIB_status_t * status )
+{
+ INT2BASE();
+}
+
+
+static void stringformat( const char * s, struct _PDCLIB_status_t * status )
+{
+ if ( status->flags & E_char )
+ {
+ status->prec = 1;
+ }
+ else
+ {
+ if ( status->prec < 0 )