printf() with vector arguments.

Paul Reger paulr at sequent.UUCP
Thu Oct 12 04:02:59 AEST 1989


I was wondering if there exists such a beast as:

void vec_printf(char *fmt,void *args[]);

(as opposed to what we're all familiar with: void printf(char *fmt, ...);)

Such a thing would be useful for a tool that can be used with any
shell - call it shell_printf.  This would have the synopsis:

shell_printf fmt [arg1 [arg2 [arg3 ... [argn]]]]

and its purpose would be to format and print out its arguments to
stdout in the exact same manner as printf() does.  Such a tool would
be useful for output in shell scripts. For example:

shell_printf "There are %9d dogs, weighing %9g pounds, and my son's name is '%s'.\n\n\n" 100 12.23 Eric

which would print out to stdout:

``
There are       100 dogs, weighing     12.23 punds, and my son's name is 'Eric'.


''

Without the vec_printf() routine, such a tool would be hard to do.


			paulr    (Paul Reger)
	      Sequent Computer Systems, Beaverton Oregon
	     {uunet,ucbvax!rutgers!ogccse}!sequent!paulr
-- 
			paulr    (Paul Reger)
	      Sequent Computer Systems, Beaverton Oregon
	     {uunet,ucbvax!rutgers!ogccse}!sequent!paulr



More information about the Comp.unix.questions mailing list