scw%ucla-locus@cepu.UUCP (10/14/83)
From: Steve Woods <cepu!scw@ucla-locus> RE: Article-I.D.: fortune.1587 I need to port some code (from DECUS C on the RT11), which uses the "%r" format in printf. Of course, I've never heard of "%r", and I can't find it in K&R, or the documentation for V7 or Sys III. Does anyone know what it is, and (even better) how I can simulate it using standard printf formats? Thanks in advance... -- Looking in the decus c documentation I find: *NOTHING* However looking in my mind I find %r (rad50); Therefore I make the following *****WILD GUESS***** The %r format will convert a short int (16 bits) to/from 3 alpha-numeric characters in the following manner:(source PDP-11 MACRO-11 Language Reference Manual {AA-5075B-TC} (pp 6-28)) "Each character is translated into its Radix-50 equivalent, as indicated in the following table: Character Radix-50 octal Equivalent (space) 0 A-Z 1-32 $ 33 . 34 (undefined) 35 0-9 36-47 The Radix-50 equivalents for characters 1 through 3 (c1,c2,c3) are combined as follows: Radix-50 Value= ((c1*50+c2)*50+c3 For example: Radix-50 Value of ABC = ((1*50+2)*50+3 = 3223 (8)" [end of quote] DEC uses Rad50 for filenames and other things (program names [internally in their systems] and such like). I suspect that you can probably junk the %r and substitute %o unless the program you are porting does file lookups in an RT-11/Files-11 directory or some such.
minow@decvax.UUCP (Martin Minow) (10/24/83)
It was suggested that %r in the Decus C printf means "rad50". This is incorrect. %r is identical to %r in Unix V6 -- a "format goto". It wasn't documented because it wasn't documented in the V6 manuals (and hence wasn't standard). I know. I wrote the code. Now you know too. Enough? Martin Minow decvax!minow