* Vincent Attard ([email protected]) wrote: > Selon Mathieu Desnoyers <[email protected]>: > > > > > + /* Switch case: > > > + * all '%-' are replaced by the desired value in 'str' */ > > > + char *str_pos = str; > > > + for (i = 0; i < strlen(fmt); i++){ > > > + if (fmt[i] == '%'){ > > > + > > > + switch (fmt[++i]){ > > > + case 't': > > > + str_pos += sprintf(str_pos, > > > "%ldh%02ldm%02lds%09ldns", > > > + time.tv_sec/3600, > > > (time.tv_sec%3600)/60, time.tv_sec%60, > > > + time.tv_nsec); > > > > is it me or this changes the timestamp output format compared to the > > original textDump ? > > > > Thanks, > > > > Mathieu > > > > Yes, it changes the output format in -h--m--s---------ns but there is still > the > original textDump format. You can write %s.%n (%s for seconds and %n for > nanoseconds) and it gives you the same output format as textDump for the > timestamp. > > If you put the option -T instead of -F, it would give you exactly the same > format as textDump. I check it with kdiff and there is no difference.
Sounds good! I like the code, it's compact and easy to read. Small nit: it would be appreciated to change the "if()" into "if ()". (like the "for ()" statements). Another problem: there is a buffer overflow problem with: char str[1024] used with strcpy which should be fixed. Thanks, Mathieu > > Best regards, > > Vincent Attard > > -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com _______________________________________________ ltt-dev mailing list [email protected] http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev
