RE: improving chprintf

Dennis <[email protected]> Mon, 12 Sep 2005 18:54:04 -0500 (CDT)
Newsgroups gmane.games.devel.mud.rom
Message-ID <[email protected]>
The field width specifier is just '*'.  I.E. printf ( "%*s\n\r", ... )

Dennis

On Mon, 12 Sep 2005, Ammaross Danan wrote:

> You can also use *c as a dynamic width setter for printf() type functions.
> IE printf( "%*cs\n\r", (desiredWidth + (countCodes(myString)*2)), myString
> );
> (or some such, but you get the idea)
>
> Ammaross Danan
>
>> -----Original Message-----
>> From: [email protected] [mailto:[email protected]] On Behalf
>> Of Michael Barton
>> Sent: Monday, September 12, 2005 1:27 AM
>> To: ROM Mailing List
>> Subject: Re: improving chprintf
>>
>> I did not know that!
>>
>> I had seen references to register_printf_function when I was
>> researching this stuff, but when I tried to look up the man
>> page, there was none.  I assumed it was something used internally.
>>
>> This will probably be better than what I was working on.
>>
>> On 9/12/05, Dennis <[email protected]> wrote:
>>> If you're using GNU libc, you can extend the printf family of
>>> functions with your own % codes.  That could save you some
>> work by not
>>> having to re-implement the existing *printf functionality.
>>>
>>>
>> http://www.gnu.org/software/libc/manual/html_node/Customizing-Printf.h
>>> tml
>>>
>>>
>>> Dennis
>>>
>>>
>>> On Mon, 12 Sep 2005, Michael Barton wrote:
>>>
>>>> I was wanting to re-implement vs(n)printf to correctly pad and
>>>> truncate strings with Lope's color codes in them, since lining
>>>> things up can be such a pain.  I thought to get the bsd
>> version and
>>>> work from that, but it's... verbose.  I'm sure it has to be.
>>>>
>>>> I started on my own and, ugly and incomplete though it
>> is, seems to
>>>> be a working start.
>>>>
>>>> I'd also like to include % codes for CHAR_DATA, OBJ_DATA,
>> etc, so I
>>>> can effectively replace act() with chprintf() entirely
>> while I'm at
>>>> it.
>>>>
>>>> Has anyone else tackled this?
>>>>
>>>> --Palrich.
>>>> --
>>>> ROM mailing list
>>>> [email protected]
>>>> Unsubscribe here ->>>
>>>> http://www.rom.org/cgi-bin/mailman/listinfo/rom
>>>>
>>>
>> --
>> ROM mailing list
>> [email protected]
>> Unsubscribe here ->>> http://www.rom.org/cgi-bin/mailman/listinfo/rom
>
>
-- 
ROM mailing list
[email protected]
Unsubscribe here ->>> http://www.rom.org/cgi-bin/mailman/listinfo/rom