gdw (08/10/82)
I have a ProLog PROM programmer that requires uppercase hex to operate it over a unix dial up. The software I have uses the "%X" conversion specification of printf (and fprintf) in Unix 3.0. Since BSD doesn't support this conversion and printf is in assembler (_doprnt.s) so I can't modify it, I need a printf that runs under BSD4.1. The non-stdio printf used for ex won't handle fprintf or sprintf. Any printf's written in C out there? Gordon Woods harpo!gdw
ks (08/11/82)
#R:harpo:-93700:pur-ee:500011:000:1114 pur-ee!ks Aug 11 00:06:00 1982 To make printf() from 4.1BSD work "right", copy /usr/src/libc/stdio/doprnt.s into a file of your own. Only a one line change is necessary to use the 3.0 standard format for %X. Around line 203, comment out the line directing it to hex, and put in the line directing it to capital. This is an assembly language switch table. This is how lines 202 through 205 should now appear. .word fmtbad-L5 # W # .word hex-L5 # X .word capital-L5 # X .word fmtbad-L5 # Y To assemble doprnt.s, you may need to do something like: % cp doprnt.s doprnt.c % cc -E doprnt.c | as -o doprnt.s % rm -f doprnt.c (The file contains several #define's that must be run through the C pre-processor.) Now that you have doprnt.o, just use it like any object file as in: "cc prog.c doprnt.o" This works just fine for me, as I had the same problem with hex files downloaded through an MDS system. Thanks to Berkeley for the fine commenting in this assembly language monster. Kirk Smith Purdue EE P.S. If someone has a similar fix for v7 PDP UNIX doprnt.s, let me know so I won't have to figure it out myself.
jerry (08/11/82)
An alternative to modifying printf is to take the lowercase output and put it through "tr". Jerry Schwarz -- eagle!jerry -- BTL Murray Hill -- (201) 582-5926