Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!decvax!yale-com!leichter From: leichter@yale-com.UUCP (Jerry Leichter) Newsgroups: net.lang.c,net.unix-wizards,net.wanted Subject: Re: need info: %r in printf Message-ID: <2151@yale-com.UUCP> Date: Wed, 12-Oct-83 09:45:42 EDT Article-I.D.: yale-com.2151 Posted: Wed Oct 12 09:45:42 1983 Date-Received: Thu, 13-Oct-83 10:14:29 EDT References: fortune.1587 Lines: 31 "%r" is "Remote Format" in DECUS C; I don't know whether any other C's support it. Here is the relevant documentation from the DECUS C manual: Remote Format. The next printf() argument is the format. Note that this is not a subroutine. The current format is not processed further. For example: bug(args) { error("Error at %r",&args); } This routine might be called as follows: bug("Error %d at %s\n",val,name); Note: error() in DECUS C takes a printf-like argument, prints it to stderr, then exits. The use of "&args" is a standard hack for passing on multiple arguments. There is no general equivalent for %r that I know of. You can probably get some of the effect using the variable-number-of-arguments package. In some cases, you'll have to re-organize the code, perhaps to do multiple sprintf's. BTW, the example above is rather silly, since the "bug" call shown will produce a message of the form "Error at Error xxx at yyy". However, the idea should be clear...The only examples of %r I know of, as it happens, are in error printers of this general form; in fact, I think error() itself may use %r to call fprintf. -- Jerry decvax!yale-comix!leichter leichter@yale