Mercurial > gftp.yaz
changeset 289:5f66f09e5194
2003-10-17 Brian Masney <masneyb@gftp.org>
* lib/misc.c (insert_commas) - if _GNU_SOURCE is defined, instead of
using my builtin function for formatting numbers, use glibc's %'ld
(or %'lld) format to print the numbers out. This is more portable for
other locales.
author | masneyb |
---|---|
date | Sat, 18 Oct 2003 14:54:53 +0000 |
parents | c8627e70adb5 |
children | 6e255984c0b0 |
files | ChangeLog lib/misc.c |
diffstat | 2 files changed, 38 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sat Oct 18 14:42:17 2003 +0000 +++ b/ChangeLog Sat Oct 18 14:54:53 2003 +0000 @@ -1,4 +1,9 @@ 2003-10-17 Brian Masney <masneyb@gftp.org> + * lib/misc.c (insert_commas) - if _GNU_SOURCE is defined, instead of + using my builtin function for formatting numbers, use glibc's %'ld + (or %'lld) format to print the numbers out. This is more portable for + other locales. + * lib/rfc959.c (rfc959_ipv[46]_data_connection_new) - when there is an error establishing a connection to the remote server, make sure that GFTP_ERETRYABLE is returned. @@ -1563,7 +1568,7 @@ * cvsclean - added this script - * *.[ch] - added $Id: ChangeLog,v 1.150 2003/10/18 14:42:17 masneyb Exp $ tags + * *.[ch] - added $Id: ChangeLog,v 1.151 2003/10/18 14:54:52 masneyb Exp $ tags * debian/* - updated files from Debian maintainer
--- a/lib/misc.c Sat Oct 18 14:42:17 2003 +0000 +++ b/lib/misc.c Sat Oct 18 14:54:53 2003 +0000 @@ -22,7 +22,33 @@ #include "gftp.h" #include "options.h" -/* FIXME - this isn't right for all locales. Use glib's printf instead */ +#ifdef _GNU_SOURCE + +char * +insert_commas (off_t number, char *dest_str, size_t dest_len) +{ + if (dest_str != NULL) + { +#if defined (_LARGEFILE_SOURCE) + g_snprintf (dest_str, dest_len, "%'lld", number); +#else + g_snprintf (dest_str, dest_len, "%'ld", number); +#endif + } + else + { +#if defined (_LARGEFILE_SOURCE) + dest_str = g_strdup_printf ("%'lld", number); +#else + dest_str = g_strdup_printf ("%'ld", number); +#endif + } + + return (dest_str); +} + +#else + char * insert_commas (off_t number, char *dest_str, size_t dest_len) { @@ -92,6 +118,7 @@ return (dest); } +#endif char * alltrim (char *str) @@ -356,6 +383,10 @@ printf ("%s\n", gftp_version); +#ifdef _GNU_SOURCE + printf ("#define _GNU_SOURCE\n"); +#endif + #ifdef _LARGEFILE_SOURCE printf ("#define _LARGEFILE_SOURCE\n"); #endif