Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

What ever happened to %r in printf ?

2,231 views
Skip to first unread message

Larry Cipriani

unread,
May 29, 1986, 4:21:38 PM5/29/86
to
Does anyone know why the %r formatting option of printf was
never documented on older UNIX systems ? It doesn't exist
on the Sys 5 Rel 2 we have.

This option lets you do things like:

doprint("usage: %s: not found", argv[0]);

and for doprint we have:

doprint(fmt)
char *fmt;
{
stuff ...

printf("%r", &fmt);

other stuff ...
}

The %r tells printf to use &fmt as the address of a
printf formatting string, and to get the arguments
for it off the stack. I don't know if it would
work if fmt contained another %r. Can vprintf be
used to produce the same result ?

Thanks,
--

Larry Cipriani AT&T Network Systems
danews!lvc Mail responses to ihnp4!cbsck!lvc please - thanks
"Nothing is worse than an itch you can never scratch."

Andrew Koenig

unread,
May 30, 1986, 2:37:56 PM5/30/86
to
> The %r tells printf to use &fmt as the address of a
> printf formatting string, and to get the arguments
> for it off the stack. I don't know if it would
> work if fmt contained another %r. Can vprintf be
> used to produce the same result ?

Vprintf and varargs.h can be used to produce a very
similar result, but portably.

Henry Spencer

unread,
Jun 3, 1986, 7:38:24 PM6/3/86
to
> Does anyone know why the %r formatting option of printf was
> never documented on older UNIX systems ? It doesn't exist
> on the Sys 5 Rel 2 we have.

There is no portable way to write the corresponding argument. vprintf
(in cooperation with varargs.h) is intended as a portable way to get
the same effect.
--
Usenet(n): AT&T scheme to earn
revenue from otherwise-unused Henry Spencer @ U of Toronto Zoology
late-night phone capacity. {allegra,ihnp4,decvax,pyramid}!utzoo!henry

Patrick Amar

unread,
Jun 17, 1986, 7:04:19 AM6/17/86
to

Hello world!
I think that %r in printf was used to format a string in radix50.
This code is used to compact file names in the DEC RT11 operating
system on the PDP11. On this system only upper case letters and digits
are allowed for file names (XXXXXX.EXT).

This format was maybe used on V6 UNIX to talk to RT11 file system,
or for debug ???

[pa]

g...@sun.uucp

unread,
Jun 19, 1986, 2:49:39 PM6/19/86
to
> I think that %r in printf was used to format a string in radix50.

Nope. No version of UNIX released by AT&T has any support for RADIX50
whatsoever. The "r" stood for "remote", not "RADIX50"; "%r" told "printf"
that the next argument was a pointer to a "printf"-style argument list, and
that it should use that list instead of the one it was passed. This is very
tricky to do portably, and impossible to do on some implementations, so it
was nuked in V7.

> This format was maybe used on V6 UNIX to talk to RT11 file system,

Nope. No version of UNIX released by AT&T knows anything about RT11, except
for VAX versions which have to deal with VAX-11/780 console floppies.
--
Guy Harris
{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
g...@sun.com (or g...@sun.arpa)

0 new messages