Cosmetic change into tdbtool.c
Martin Pool
mbp at samba.org
Tue Apr 15 01:09:49 GMT 2003
On 14 Apr 2003, Arcady Chernyak <Arcady.Chernyak at efi.com> wrote:
> I suggest to change function print_asc() (tdbtool.c)
> from:
> static void print_asc(unsigned char *buf,int len)
> {
> int i;
>
> /* We're probably printing ASCII strings so don't try to display
> the trailing NULL character. */
> if (buf[len - 1] == 0)
> len--;
>
> for (i=0;i<len;i++)
> printf("%c",isprint(buf[i])?buf[i]:'.');
> }
> To:
> static void print_asc(unsigned char *buf,int len)
> {
> int i;
>
> /* We're probably printing ASCII strings so don't try to display
> the trailing NULL character. */
>
> for (i=0;i<len;i++){
> if((len - 1 == i) && (0 == buf[i])){
> printf("%c",' ');
> continue;
> }
> printf("%c",isprint(buf[i])?buf[i]:'.');
> }
> }
> It keeps length of printed string the same and output looks better.
Please send regular patches, generated with "diff -u" in future if
possible.
If I understand correctly this just changes the display of
null-terminated strings so that they have a trailing space. Is that
correct? If so, why is it an improvement?
--
Martin
More information about the samba-technical
mailing list