5 #if defined(__STDC__) && !defined(__FIRST_ARG_IN_AX__)
7 #define va_strt va_start
10 #define va_strt(p,i) va_start(p)
13 #if defined(__STDC__) && !defined(__FIRST_ARG_IN_AX__)
14 int dbprintf(const char * fmt
, ...)
16 int dbprintf(fmt
, va_alist
)
24 rv
= vdbprintf(fmt
,ptr
);
29 static unsigned char * __numout (long i
, int base
);
30 static void putch(int ch
) { static char buf
[2]; *buf
= ch
; write(2,buf
,1); }
34 register __const
char *fmt
;
55 if(padch
== '-') fmt
++;
60 if( c
<'0' || c
>'9' ) break;
61 minsize
*=10; minsize
+=c
-'0';
68 if( c
<'0' || c
>'9' ) break;
69 maxsize
*=10; maxsize
+=c
-'0';
72 if( padch
== '-' ) minsize
= -minsize
;
74 if( padch
!= '0' ) padch
=' ';
90 case 'x': base
=16; type
|= 4; if(0) {
91 case 'o': base
= 8; type
|= 4; } if(0) {
92 case 'u': base
=10; type
|= 4; } if(0) {
96 case 0: /* Promoted: val=va_arg(ap, short); break; */
97 case 1: val
=va_arg(ap
, int); break;
98 case 2: val
=va_arg(ap
, long); break;
99 case 4: /* Promoted: val=va_arg(ap, unsigned short); break; */
100 case 5: val
=va_arg(ap
, unsigned int); break;
101 case 6: val
=va_arg(ap
, unsigned long); break;
102 default:val
=0; break;
104 cp
= __numout(val
,base
);
107 cp
=va_arg(ap
, char *);
111 if( !maxsize
) maxsize
= c
;
115 while(minsize
>0) { putch(padch
); count
++; minsize
--; }
118 if( minsize
< 0 ) minsize
= -minsize
-c
;
119 while(*cp
&& maxsize
-->0 )
124 while(minsize
>0) { putch(' '); count
++; minsize
--; }
127 putch(va_arg(ap
, int));
133 putch('M'); putch('-');
135 if (c
<' ' || c
== '\177') {
136 putch('^'); putch(c
^'@');
149 static char nstring
[]="0123456789ABCDEF";
154 static unsigned char *
155 __numout(long i
, int base
)
157 static unsigned char out
[NUMLTH
+1];
177 out
[n
--] = nstring
[val
% base
];
181 if(flg
) out
[n
--] = '-';
200 mov byte ptr
-8[bp
],*$
0 ! flg
= 0
201 mov si
,4[bp
] ; i
or val
.lo
202 mov di
,6[bp
] ; i
or val
.hi
204 test cx
,cx
! base
< 0 ?
206 neg cx
! base
= -base
209 mov byte ptr
-8[bp
],*1 ! flg
= 1
215 mov byte ptr
[___out
+$B
],*$
0 ! out
[11] = nul
216 mov
-6[bp
],*$A
! n
= 10
219 !!! out
[n
--] = nstring
[val
% base
];
226 xchg ax
,si
! val(new) = val
/ base
228 mov bx
,dx
! dx
= val
% base
236 or ax
,di
! while (val
)
239 cmp byte ptr
-8[bp
],*$
0 ! flg
== 0 ?
244 mov byte ptr ___out
[bx
],*$
2D
! out
[n
--] = minus