1 /* GLIB - Library of useful routines for C programming
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
21 * Modified by the GLib Team and others 1997-2000. See the AUTHORS
22 * file for a list of people on the GLib Team. See the ChangeLog
23 * files for a list of changes. These files are distributed with
24 * GLib at ftp://ftp.gtk.org/pub/gtk/.
40 #include <ctype.h> /* For tolower() */
41 #if !defined (HAVE_STRSIGNAL) || !defined(NO_SYS_SIGLIST_DECL)
50 /* do not include <unistd.h> in this place since it
51 * inteferes with g_strsignal() on some OSes
55 g_strdup (const gchar *str)
61 new_str = g_new (char, strlen (str) + 1);
62 strcpy (new_str, str);
71 g_memdup (gconstpointer mem,
78 new_mem = g_malloc (byte_size);
79 memcpy (new_mem, mem, byte_size);
88 g_strndup (const gchar *str,
95 new_str = g_new (gchar, n + 1);
96 strncpy (new_str, str, n);
106 g_strnfill (guint length,
109 register gchar *str, *s, *end;
111 str = g_new (gchar, length + 1);
123 * @dest: destination buffer
124 * @src: source string
126 * Copies a nul-terminated string into the dest buffer, include the
127 * trailing nul, and return a pointer to the trailing nul byte.
128 * This is useful for concatenating multiple strings together
129 * without having to repeatedly scan for the end.
131 * Return value: a pointer to trailing nul byte.
134 g_stpcpy (gchar *dest,
138 g_return_val_if_fail (dest != NULL, NULL);
139 g_return_val_if_fail (src != NULL, NULL);
140 return stpcpy (dest, src);
142 register gchar *d = dest;
143 register const gchar *s = src;
145 g_return_val_if_fail (dest != NULL, NULL);
146 g_return_val_if_fail (src != NULL, NULL);
149 while (*s++ != '\0');
156 g_strdup_vprintf (const gchar *format,
162 G_VA_COPY (args2, args1);
164 buffer = g_new (gchar, g_printf_string_upper_bound (format, args1));
166 vsprintf (buffer, format, args2);
173 g_strdup_printf (const gchar *format,
179 va_start (args, format);
180 buffer = g_strdup_vprintf (format, args);
187 g_strconcat (const gchar *string1, ...)
195 g_return_val_if_fail (string1 != NULL, NULL);
197 l = 1 + strlen (string1);
198 va_start (args, string1);
199 s = va_arg (args, gchar*);
203 s = va_arg (args, gchar*);
207 concat = g_new (gchar, l);
210 ptr = g_stpcpy (ptr, string1);
211 va_start (args, string1);
212 s = va_arg (args, gchar*);
216 s = va_arg (args, gchar*);
224 g_strtod (const gchar *nptr,
232 g_return_val_if_fail (nptr != NULL, 0);
237 val_1 = strtod (nptr, &fail_pos_1);
239 if (fail_pos_1 && fail_pos_1[0] != 0)
243 old_locale = g_strdup (setlocale (LC_NUMERIC, NULL));
244 setlocale (LC_NUMERIC, "C");
245 val_2 = strtod (nptr, &fail_pos_2);
246 setlocale (LC_NUMERIC, old_locale);
250 if (!fail_pos_1 || fail_pos_1[0] == 0 || fail_pos_1 >= fail_pos_2)
253 *endptr = fail_pos_1;
259 *endptr = fail_pos_2;
264 G_CONST_RETURN gchar*
265 g_strerror (gint errnum)
267 static GStaticPrivate msg_private = G_STATIC_PRIVATE_INIT;
271 return strerror (errnum);
276 case E2BIG: return "argument list too long";
279 case EACCES: return "permission denied";
282 case EADDRINUSE: return "address already in use";
285 case EADDRNOTAVAIL: return "can't assign requested address";
288 case EADV: return "advertise error";
291 case EAFNOSUPPORT: return "address family not supported by protocol family";
294 case EAGAIN: return "try again";
297 case EALIGN: return "EALIGN";
300 case EALREADY: return "operation already in progress";
303 case EBADE: return "bad exchange descriptor";
306 case EBADF: return "bad file number";
309 case EBADFD: return "file descriptor in bad state";
312 case EBADMSG: return "not a data message";
315 case EBADR: return "bad request descriptor";
318 case EBADRPC: return "RPC structure is bad";
321 case EBADRQC: return "bad request code";
324 case EBADSLT: return "invalid slot";
327 case EBFONT: return "bad font file format";
330 case EBUSY: return "mount device busy";
333 case ECHILD: return "no children";
336 case ECHRNG: return "channel number out of range";
339 case ECOMM: return "communication error on send";
342 case ECONNABORTED: return "software caused connection abort";
345 case ECONNREFUSED: return "connection refused";
348 case ECONNRESET: return "connection reset by peer";
350 #if defined(EDEADLK) && (!defined(EWOULDBLOCK) || (EDEADLK != EWOULDBLOCK))
351 case EDEADLK: return "resource deadlock avoided";
354 case EDEADLOCK: return "resource deadlock avoided";
357 case EDESTADDRREQ: return "destination address required";
360 case EDIRTY: return "mounting a dirty fs w/o force";
363 case EDOM: return "math argument out of range";
366 case EDOTDOT: return "cross mount point";
369 case EDQUOT: return "disk quota exceeded";
372 case EDUPPKG: return "duplicate package name";
375 case EEXIST: return "file already exists";
378 case EFAULT: return "bad address in system call argument";
381 case EFBIG: return "file too large";
384 case EHOSTDOWN: return "host is down";
387 case EHOSTUNREACH: return "host is unreachable";
390 case EIDRM: return "identifier removed";
393 case EINIT: return "initialization error";
396 case EINPROGRESS: return "operation now in progress";
399 case EINTR: return "interrupted system call";
402 case EINVAL: return "invalid argument";
405 case EIO: return "I/O error";
408 case EISCONN: return "socket is already connected";
411 case EISDIR: return "illegal operation on a directory";
414 case EISNAM: return "is a name file";
417 case ELBIN: return "ELBIN";
420 case EL2HLT: return "level 2 halted";
423 case EL2NSYNC: return "level 2 not synchronized";
426 case EL3HLT: return "level 3 halted";
429 case EL3RST: return "level 3 reset";
432 case ELIBACC: return "can not access a needed shared library";
435 case ELIBBAD: return "accessing a corrupted shared library";
438 case ELIBEXEC: return "can not exec a shared library directly";
441 case ELIBMAX: return "attempting to link in more shared libraries than system limit";
444 case ELIBSCN: return ".lib section in a.out corrupted";
447 case ELNRNG: return "link number out of range";
450 case ELOOP: return "too many levels of symbolic links";
453 case EMFILE: return "too many open files";
456 case EMLINK: return "too many links";
459 case EMSGSIZE: return "message too long";
462 case EMULTIHOP: return "multihop attempted";
465 case ENAMETOOLONG: return "file name too long";
468 case ENAVAIL: return "not available";
471 case ENET: return "ENET";
474 case ENETDOWN: return "network is down";
477 case ENETRESET: return "network dropped connection on reset";
480 case ENETUNREACH: return "network is unreachable";
483 case ENFILE: return "file table overflow";
486 case ENOANO: return "anode table overflow";
488 #if defined(ENOBUFS) && (!defined(ENOSR) || (ENOBUFS != ENOSR))
489 case ENOBUFS: return "no buffer space available";
492 case ENOCSI: return "no CSI structure available";
495 case ENODATA: return "no data available";
498 case ENODEV: return "no such device";
501 case ENOENT: return "no such file or directory";
504 case ENOEXEC: return "exec format error";
507 case ENOLCK: return "no locks available";
510 case ENOLINK: return "link has be severed";
513 case ENOMEM: return "not enough memory";
516 case ENOMSG: return "no message of desired type";
519 case ENONET: return "machine is not on the network";
522 case ENOPKG: return "package not installed";
525 case ENOPROTOOPT: return "bad proocol option";
528 case ENOSPC: return "no space left on device";
531 case ENOSR: return "out of stream resources";
534 case ENOSTR: return "not a stream device";
537 case ENOSYM: return "unresolved symbol name";
540 case ENOSYS: return "function not implemented";
543 case ENOTBLK: return "block device required";
546 case ENOTCONN: return "socket is not connected";
549 case ENOTDIR: return "not a directory";
552 case ENOTEMPTY: return "directory not empty";
555 case ENOTNAM: return "not a name file";
558 case ENOTSOCK: return "socket operation on non-socket";
561 case ENOTTY: return "inappropriate device for ioctl";
564 case ENOTUNIQ: return "name not unique on network";
567 case ENXIO: return "no such device or address";
570 case EOPNOTSUPP: return "operation not supported on socket";
573 case EPERM: return "not owner";
576 case EPFNOSUPPORT: return "protocol family not supported";
579 case EPIPE: return "broken pipe";
582 case EPROCLIM: return "too many processes";
585 case EPROCUNAVAIL: return "bad procedure for program";
588 case EPROGMISMATCH: return "program version wrong";
591 case EPROGUNAVAIL: return "RPC program not available";
594 case EPROTO: return "protocol error";
596 #ifdef EPROTONOSUPPORT
597 case EPROTONOSUPPORT: return "protocol not suppored";
600 case EPROTOTYPE: return "protocol wrong type for socket";
603 case ERANGE: return "math result unrepresentable";
605 #if defined(EREFUSED) && (!defined(ECONNREFUSED) || (EREFUSED != ECONNREFUSED))
606 case EREFUSED: return "EREFUSED";
609 case EREMCHG: return "remote address changed";
612 case EREMDEV: return "remote device";
615 case EREMOTE: return "pathname hit remote file system";
618 case EREMOTEIO: return "remote i/o error";
620 #ifdef EREMOTERELEASE
621 case EREMOTERELEASE: return "EREMOTERELEASE";
624 case EROFS: return "read-only file system";
627 case ERPCMISMATCH: return "RPC version is wrong";
630 case ERREMOTE: return "object is remote";
633 case ESHUTDOWN: return "can't send afer socket shutdown";
635 #ifdef ESOCKTNOSUPPORT
636 case ESOCKTNOSUPPORT: return "socket type not supported";
639 case ESPIPE: return "invalid seek";
642 case ESRCH: return "no such process";
645 case ESRMNT: return "srmount error";
648 case ESTALE: return "stale remote file handle";
651 case ESUCCESS: return "Error 0";
654 case ETIME: return "timer expired";
657 case ETIMEDOUT: return "connection timed out";
660 case ETOOMANYREFS: return "too many references: can't splice";
663 case ETXTBSY: return "text file or pseudo-device busy";
666 case EUCLEAN: return "structure needs cleaning";
669 case EUNATCH: return "protocol driver not attached";
672 case EUSERS: return "too many users";
675 case EVERSION: return "version mismatch";
677 #if defined(EWOULDBLOCK) && (!defined(EAGAIN) || (EWOULDBLOCK != EAGAIN))
678 case EWOULDBLOCK: return "operation would block";
681 case EXDEV: return "cross-domain link";
684 case EXFULL: return "message tables full";
687 #else /* NO_SYS_ERRLIST */
689 extern char *sys_errlist[];
691 if ((errnum > 0) && (errnum <= sys_nerr))
692 return sys_errlist [errnum];
693 #endif /* NO_SYS_ERRLIST */
695 msg = g_static_private_get (&msg_private);
698 msg = g_new (gchar, 64);
699 g_static_private_set (&msg_private, msg, g_free);
702 sprintf (msg, "unknown error (%d)", errnum);
707 G_CONST_RETURN gchar*
708 g_strsignal (gint signum)
710 static GStaticPrivate msg_private = G_STATIC_PRIVATE_INIT;
713 #ifdef HAVE_STRSIGNAL
714 #if defined(G_OS_BEOS) || defined(G_WITH_CYGWIN)
715 extern const char *strsignal(int);
717 /* this is declared differently (const) in string.h on BeOS */
718 extern char *strsignal (int sig);
719 #endif /* !G_OS_BEOS && !G_WITH_CYGWIN */
720 return strsignal (signum);
725 case SIGHUP: return "Hangup";
728 case SIGINT: return "Interrupt";
731 case SIGQUIT: return "Quit";
734 case SIGILL: return "Illegal instruction";
737 case SIGTRAP: return "Trace/breakpoint trap";
740 case SIGABRT: return "IOT trap/Abort";
743 case SIGBUS: return "Bus error";
746 case SIGFPE: return "Floating point exception";
749 case SIGKILL: return "Killed";
752 case SIGUSR1: return "User defined signal 1";
755 case SIGSEGV: return "Segmentation fault";
758 case SIGUSR2: return "User defined signal 2";
761 case SIGPIPE: return "Broken pipe";
764 case SIGALRM: return "Alarm clock";
767 case SIGTERM: return "Terminated";
770 case SIGSTKFLT: return "Stack fault";
773 case SIGCHLD: return "Child exited";
776 case SIGCONT: return "Continued";
779 case SIGSTOP: return "Stopped (signal)";
782 case SIGTSTP: return "Stopped";
785 case SIGTTIN: return "Stopped (tty input)";
788 case SIGTTOU: return "Stopped (tty output)";
791 case SIGURG: return "Urgent condition";
794 case SIGXCPU: return "CPU time limit exceeded";
797 case SIGXFSZ: return "File size limit exceeded";
800 case SIGVTALRM: return "Virtual time alarm";
803 case SIGPROF: return "Profile signal";
806 case SIGWINCH: return "Window size changed";
809 case SIGIO: return "Possible I/O";
812 case SIGPWR: return "Power failure";
815 case SIGUNUSED: return "Unused signal";
818 #else /* NO_SYS_SIGLIST */
820 #ifdef NO_SYS_SIGLIST_DECL
821 extern char *sys_siglist[]; /*(see Tue Jan 19 00:44:24 1999 in changelog)*/
824 return (char*) /* this function should return const --josh */ sys_siglist [signum];
825 #endif /* NO_SYS_SIGLIST */
827 msg = g_static_private_get (&msg_private);
830 msg = g_new (gchar, 64);
831 g_static_private_set (&msg_private, msg, g_free);
834 sprintf (msg, "unknown signal (%d)", signum);
839 /* Functions g_strlcpy and g_strlcat were originally developed by
840 * Todd C. Miller <Todd.Miller@courtesan.com> to simplify writing secure code.
841 * See ftp://ftp.openbsd.org/pub/OpenBSD/src/lib/libc/string/strlcpy.3
842 * for more information.
846 /* Use the native ones, if available; they might be implemented in assembly */
848 g_strlcpy (gchar *dest,
852 g_return_val_if_fail (dest != NULL, 0);
853 g_return_val_if_fail (src != NULL, 0);
855 return strlcpy (dest, src, dest_size);
859 g_strlcat (gchar *dest,
863 g_return_val_if_fail (dest != NULL, 0);
864 g_return_val_if_fail (src != NULL, 0);
866 return strlcat (dest, src, dest_size);
869 #else /* ! HAVE_STRLCPY */
872 * Copy string src to buffer dest (of buffer size dest_size). At most
873 * dest_size-1 characters will be copied. Always NUL terminates
874 * (unless dest_size == 0). This function does NOT allocate memory.
875 * Unlike strncpy, this function doesn't pad dest (so it's often faster).
876 * Returns size of attempted result, strlen(src),
877 * so if retval >= dest_size, truncation occurred.
880 g_strlcpy (gchar *dest,
884 register gchar *d = dest;
885 register const gchar *s = src;
886 register gsize n = dest_size;
888 g_return_val_if_fail (dest != NULL, 0);
889 g_return_val_if_fail (src != NULL, 0);
891 /* Copy as many bytes as will fit */
892 if (n != 0 && --n != 0)
895 register gchar c = *s++;
903 /* If not enough room in dest, add NUL and traverse rest of src */
912 return s - src - 1; /* count does not include NUL */
917 * Appends string src to buffer dest (of buffer size dest_size).
918 * At most dest_size-1 characters will be copied.
919 * Unlike strncat, dest_size is the full size of dest, not the space left over.
920 * This function does NOT allocate memory.
921 * This always NUL terminates (unless siz == 0 or there were no NUL characters
922 * in the dest_size characters of dest to start with).
923 * Returns size of attempted result, which is
924 * MIN (dest_size, strlen (original dest)) + strlen (src),
925 * so if retval >= dest_size, truncation occurred.
928 g_strlcat (gchar *dest,
932 register gchar *d = dest;
933 register const gchar *s = src;
934 register gsize bytes_left = dest_size;
935 gsize dlength; /* Logically, MIN (strlen (d), dest_size) */
937 g_return_val_if_fail (dest != NULL, 0);
938 g_return_val_if_fail (src != NULL, 0);
940 /* Find the end of dst and adjust bytes left but don't go past end */
941 while (*d != 0 && bytes_left-- != 0)
944 bytes_left = dest_size - dlength;
947 return dlength + strlen (s);
960 return dlength + (s - src); /* count does not include NUL */
962 #endif /* ! HAVE_STRLCPY */
965 g_strdown (gchar *string)
969 g_return_val_if_fail (string != NULL, NULL);
971 s = (guchar *) string;
979 return (gchar *) string;
983 g_strup (gchar *string)
987 g_return_val_if_fail (string != NULL, NULL);
989 s = (guchar *) string;
997 return (gchar *) string;
1001 g_strreverse (gchar *string)
1003 g_return_val_if_fail (string != NULL, NULL);
1007 register gchar *h, *t;
1010 t = string + strlen (string) - 1;
1028 g_strcasecmp (const gchar *s1,
1031 #ifdef HAVE_STRCASECMP
1032 g_return_val_if_fail (s1 != NULL, 0);
1033 g_return_val_if_fail (s2 != NULL, 0);
1035 return strcasecmp (s1, s2);
1039 g_return_val_if_fail (s1 != NULL, 0);
1040 g_return_val_if_fail (s2 != NULL, 0);
1044 /* According to A. Cox, some platforms have islower's that
1045 * don't work right on non-uppercase
1047 c1 = isupper ((guchar)*s1) ? tolower ((guchar)*s1) : *s1;
1048 c2 = isupper ((guchar)*s2) ? tolower ((guchar)*s2) : *s2;
1054 return (((gint)(guchar) *s1) - ((gint)(guchar) *s2));
1059 g_strncasecmp (const gchar *s1,
1063 #ifdef HAVE_STRNCASECMP
1064 return strncasecmp (s1, s2, n);
1068 g_return_val_if_fail (s1 != NULL, 0);
1069 g_return_val_if_fail (s2 != NULL, 0);
1071 while (n && *s1 && *s2)
1074 /* According to A. Cox, some platforms have islower's that
1075 * don't work right on non-uppercase
1077 c1 = isupper ((guchar)*s1) ? tolower ((guchar)*s1) : *s1;
1078 c2 = isupper ((guchar)*s2) ? tolower ((guchar)*s2) : *s2;
1085 return (((gint) (guchar) *s1) - ((gint) (guchar) *s2));
1092 g_strdelimit (gchar *string,
1093 const gchar *delimiters,
1098 g_return_val_if_fail (string != NULL, NULL);
1101 delimiters = G_STR_DELIMITERS;
1103 for (c = string; *c; c++)
1105 if (strchr (delimiters, *c))
1113 g_strcanon (gchar *string,
1114 const gchar *valid_chars,
1119 g_return_val_if_fail (string != NULL, NULL);
1120 g_return_val_if_fail (valid_chars != NULL, NULL);
1122 for (c = string; *c; c++)
1124 if (!strchr (valid_chars, *c))
1132 g_strcompress (const gchar *source)
1134 const gchar *p = source, *octal;
1135 gchar *dest = g_malloc (strlen (source) + 1);
1145 case '0': case '1': case '2': case '3': case '4':
1146 case '5': case '6': case '7':
1149 while ((p < octal + 3) && (*p >= '0') && (*p <= '7'))
1151 *q = (*q * 8) + (*p - '0');
1172 default: /* Also handles \" and \\ */
1187 g_strescape (const gchar *source,
1188 const gchar *exceptions)
1195 g_return_val_if_fail (source != NULL, NULL);
1197 p = (guchar *) source;
1198 /* Each source byte needs maximally four destination chars (\777) */
1199 q = dest = g_malloc (strlen (source) * 4 + 1);
1201 memset (excmap, 0, 256);
1204 guchar *e = (guchar *) exceptions;
1250 if ((*p < ' ') || (*p >= 0177))
1253 *q++ = '0' + (((*p) >> 6) & 07);
1254 *q++ = '0' + (((*p) >> 3) & 07);
1255 *q++ = '0' + ((*p) & 07);
1269 g_strchug (gchar *string)
1273 g_return_val_if_fail (string != NULL, NULL);
1275 for (start = (guchar*) string; *start && isspace (*start); start++)
1278 g_memmove (string, start, strlen ((gchar *) start) + 1);
1284 g_strchomp (gchar *string)
1288 g_return_val_if_fail (string != NULL, NULL);
1293 for (s = string + strlen (string) - 1; s >= string && isspace ((guchar)*s);
1301 g_strsplit (const gchar *string,
1302 const gchar *delimiter,
1305 GSList *string_list = NULL, *slist;
1306 gchar **str_array, *s;
1309 g_return_val_if_fail (string != NULL, NULL);
1310 g_return_val_if_fail (delimiter != NULL, NULL);
1313 max_tokens = G_MAXINT;
1315 s = strstr (string, delimiter);
1318 guint delimiter_len = strlen (delimiter);
1326 new_string = g_new (gchar, len + 1);
1327 strncpy (new_string, string, len);
1328 new_string[len] = 0;
1329 string_list = g_slist_prepend (string_list, new_string);
1331 string = s + delimiter_len;
1332 s = strstr (string, delimiter);
1334 while (--max_tokens && s);
1336 string_list = g_slist_prepend (string_list, g_strdup (string));
1338 str_array = g_new (gchar*, n + 1);
1340 str_array[n--] = NULL;
1341 for (slist = string_list; slist; slist = slist->next)
1342 str_array[n--] = slist->data;
1344 g_slist_free (string_list);
1350 g_strfreev (gchar **str_array)
1356 for(i = 0; str_array[i] != NULL; i++)
1357 g_free(str_array[i]);
1365 * @str_array: %NULL-terminated array of strings
1367 * Copies %NULL-terminated array of strings. The copy is a deep copy;
1368 * the new array should be freed by first freeing each string, then
1369 * the array itself. g_strfreev() does this for you. If called
1370 * on a %NULL value, g_strdupv() simply returns %NULL.
1372 * Return value: a new %NULL-terminated array of strings
1375 g_strdupv (gchar **str_array)
1383 while (str_array[i])
1386 retval = g_new (gchar*, i + 1);
1389 while (str_array[i])
1391 retval[i] = g_strdup (str_array[i]);
1403 g_strjoinv (const gchar *separator,
1409 g_return_val_if_fail (str_array != NULL, NULL);
1411 if (separator == NULL)
1417 guint separator_len;
1419 separator_len = strlen (separator);
1420 /* First part, getting length */
1421 len = 1 + strlen (str_array[0]);
1422 for (i = 1; str_array[i] != NULL; i++)
1423 len += strlen (str_array[i]);
1424 len += separator_len * (i - 1);
1426 /* Second part, building string */
1427 string = g_new (gchar, len);
1428 ptr = g_stpcpy (string, *str_array);
1429 for (i = 1; str_array[i] != NULL; i++)
1431 ptr = g_stpcpy (ptr, separator);
1432 ptr = g_stpcpy (ptr, str_array[i]);
1436 string = g_strdup ("");
1442 g_strjoin (const gchar *separator,
1448 guint separator_len;
1451 if (separator == NULL)
1454 separator_len = strlen (separator);
1456 va_start (args, separator);
1458 s = va_arg (args, gchar*);
1462 /* First part, getting length */
1463 len = 1 + strlen (s);
1465 s = va_arg (args, gchar*);
1468 len += separator_len + strlen (s);
1469 s = va_arg (args, gchar*);
1473 /* Second part, building string */
1474 string = g_new (gchar, len);
1476 va_start (args, separator);
1478 s = va_arg (args, gchar*);
1479 ptr = g_stpcpy (string, s);
1481 s = va_arg (args, gchar*);
1484 ptr = g_stpcpy (ptr, separator);
1485 ptr = g_stpcpy (ptr, s);
1486 s = va_arg (args, gchar*);
1490 string = g_strdup ("");