rem: flags |= LONGINT;
add: if (flags & LONGINT) flags |= QUADINT; else flags |= LONGINT;
context: __find_arguments(fmt0, ap, argtable)	const char *fmt0;	va_list ap;	va_list **argtable;{	register char *fmt;	/* format string */	register int ch;	/* character from fmt */	register int n, n2;	/* handy integer (short term usage) */	register char *cp;	/* handy char pointer (short term usage) */	register int flags;	/* flags as above */	unsigned char *typetable; /* table of types */	unsigned char stattypetable[STATIC_ARG_TBL_SIZE];	int tablesize;		/* current size of type table */	int tablemax;		/* largest used index in table */	int nextarg;		/* 1-based argument index */	/*	 * Add an argument type to the table, expanding if necessary.	 */#define ADDTYPE(type) \	((nextarg >= tablesize) ? \		__grow_type_table(&typetable, &tablesize) : 0, \	typetable[nextarg++] = type, \	(nextarg > tablemax) ? tablemax = nextarg : 0)#define	ADDSARG() \	((flags&LONGINT) ? ADDTYPE(T_LONG) : \		((flags&SHORTINT) ? ADDTYPE(T_SHORT) : ADDTYPE(T_INT)))#define	ADDUARG() \	((flags&LONGINT) ? ADDTYPE(T_U_LONG) : \		((flags&SHORTINT) ? ADDTYPE(T_U_SHORT) : ADDTYPE(T_U_INT)))	/*	 * Add * arguments to the type array.	 */#define ADDASTER() \	n2 = 0; \	cp = fmt; \	while (is_digit(*cp)) { \		n2 = 10 * n2 + to_digit(*cp); \		cp++; \	} \	if (*cp == '$') { \		int hold = nextarg; \		nextarg = n2; \		ADDTYPE(T_INT); \		nextarg = hold; \		fmt = ++cp; \	} else { \		ADDTYPE(T_INT); \	}	fmt = (char *)fmt0;	typetable = stattypetable;	tablesize = STATIC_ARG_TBL_SIZE;	tablemax = 0; 	nextarg = 1;	memset(typetable, T_UNUSED, STATIC_ARG_TBL_SIZE);	/*	 * Scan the format for conversions (`%' character).	 */	for (;;) {		for (cp = fmt; (ch = *fmt) != '\0' && ch != '%'; fmt++)			/* void */;		if (ch == '\0')			goto done;		fmt++;		/* skip over '%' */		flags = 0;rflag:		ch = *fmt++;reswitch:	switch (ch) {		case ' ':		case '#':			goto rflag;		case '*':			ADDASTER();			goto rflag;		case '-':		case '+':			goto rflag;		case '.':			if ((ch = *fmt++) == '*') {				ADDASTER();				goto rflag;			}			while (is_digit(ch)) {				ch = *fmt++;			}			goto reswitch;		case '0':			goto rflag;		case '1': case '2': case '3': case '4':		case '5': case '6': case '7': case '8': case '9':			n = 0;			do {				n = 10 * n + to_digit(ch);				ch = *fmt++;			} while (is_digit(ch));			if (ch == '$') {				nextarg = n;				goto rflag;			}			goto reswitch;#ifdef FLOATING_POINT		case 'L':			flags |= LONGDBL;			goto rflag;#endif		case 'h':			flags |= SHORTINT;			goto rflag;		case 'l':			flags |= LONGINT;			goto rflag;		case 'q':			flags |= QUADINT;			goto rflag;		case 'c':			ADDTYPE(T_INT);			break;		case 'D':			flags |= LONGINT;			/*FALLTHROUGH*/		case 'd':		case 'i':			if (flags & QUADINT) {				ADDTYPE(T_QUAD);			} else {				ADDSARG();			}			break;#ifdef FLOATING_POINT		case 'e':		case 'E':		case 'f':		case 'g':		case 'G':			if (flags & LONGDBL)				ADDTYPE(T_LONG_DOUBLE);			else				ADDTYPE(T_DOUBLE);			break;#endif /* FLOATING_POINT */		case 'n':			if (flags & QUADINT)				ADDTYPE(TP_QUAD);			else if (flags & LONGINT)				ADDTYPE(TP_LONG);			else if (flags & SHORTINT)				ADDTYPE(TP_SHORT);			else				ADDTYPE(TP_INT);			continue;	/* no output */		case 'O':			flags |= LONGINT;			/*FALLTHROUGH*/		case 'o':			if (flags & QUADINT)				ADDTYPE(T_U_QUAD);			else				ADDUARG();			break;		case 'p':			ADDTYPE(TP_VOID);			break;		case 's':			ADDTYPE(TP_CHAR);			break;		case 'U':			flags |= LONGINT;			/*FALLTHROUGH*/		case 'u':			if (flags & QUADINT)				ADDTYPE(T_U_QUAD);			else				ADDUARG();			break;		case 'X':		case 'x':			if (flags & QUADINT)				ADDTYPE(T_U_QUAD);			else				ADDUARG();			break;		default:	/* "%?" prints ?, unless ? is NUL */			if (ch == '\0')				goto done;			break;		}	}done:	/*	 * Build the argument table.	 */	if (tablemax >= STATIC_ARG_TBL_SIZE) {		*argtable = (va_list *)		    malloc(sizeof (va_list) * (tablemax + 1));	}#if 0	/* XXX is this required? */	(*argtable) [0] = NULL;#endif	for (n = 1; n <= tablemax; n++) {		(*argtable)[n] = ap;		switch (typetable[n]) {		case T_UNUSED:			(void) va_arg(ap, int);			break;		case T_SHORT:			(void) va_arg(ap, int);			break;		case T_U_SHORT:			(void) va_arg(ap, int);			break;		case TP_SHORT:			(void) va_arg(ap, short *);			break;		case T_INT:			(void) va_arg(ap, int);			break;		case T_U_INT:			(void) va_arg(ap, unsigned int);			break;		case TP_INT:			(void) va_arg(ap, int *);			break;		case T_LONG:			(void) va_arg(ap, long);			break;		case T_U_LONG:			(void) va_arg(ap, unsigned long);			break;		case TP_LONG:			(void) va_arg(ap, long *);			break;		case T_QUAD:			(void) va_arg(ap, quad_t);			break;		case T_U_QUAD:			(void) va_arg(ap, u_quad_t);			break;		case TP_QUAD:			(void) va_arg(ap, quad_t *);			break;		case T_DOUBLE:			(void) va_arg(ap, double);			break;		case T_LONG_DOUBLE:			(void) va_arg(ap, long double);			break;		case TP_CHAR:			(void) va_arg(ap, char *);			break;		case TP_VOID:			(void) va_arg(ap, void *);			break;		}	}	if (typetable != NULL && typetable != stattypetable)		free(typetable);}