[dtrace-discuss] Subtleties of %S printf specifier

Chip Bennett cbennett at laurustech.com
Wed Dec 19 21:02:37 PST 2007


Philosophically, I guess this depends on whether you consider the null 
at the end of a string, part of the string.  I would have said no.  
IMHO, the null is not part of the data and shouldn't be displayed.

Chip

Roman Shaposhnik wrote:
> Guys,
>
> am I missing something or is that \0 at the end a bug of %S ?
> My reasoning is -- it servers no purpose; seems to be impossible
> to get rid of and makes %S not all that appealing for post processing
> of DTrace output that might contain unprintable characters.
>
> Thoughts?
>
> $ cat q.d
> #!/usr/sbin/dtrace -qs
>
> BEGIN {
>    st = "\"Roman\'";
>    printf("%S\n", st);
> }
> $ ./q.d  
> \"Roman\\'\0
> ^C
>
> Thanks,
> Roman.
>
> _______________________________________________
> dtrace-discuss mailing list
> dtrace-discuss at opensolaris.org
>   



More information about the dtrace-discuss mailing list