char *format;
const char *format;
printf(format, data)	char *format;	int data;{	int *dataptr = &data;	char c;	while (c = *format++) {		if (c != '%') {			putchar(c);			continue;		}		c = *format++;		if (c == 'd') {			int num = *dataptr++, dig;			char buf[10], *ptr = buf;			if (num < 0) {				num = -num;				putchar('-');			}			do {				dig = num % 10;				*ptr++ = '0' + dig;			} while (num /= 10);			do				putchar(*--ptr);			while (ptr != buf);		} else if (c == 'x') {			unsigned int num = (unsigned int)*dataptr++, dig;			char buf[8], *ptr = buf;			do {				dig = num & 0xf;				*ptr++ = dig > 9 ?					 'a' + dig - 10 :					 '0' + dig;			} while (num >>= 4);			do				putchar(*--ptr);			while (ptr != buf);		} else if (c == 'c') {			putchar((char)*dataptr++);		} else if (c == 's') {			char *ptr = (char *)*dataptr++;			while (c = *ptr++)				putchar(c);		}	}}