1 --- gmediaserver-0.7.0/src/main.c.orig 2005-08-29 21:15:01.000000000 +0200
2 +++ gmediaserver-0.7.0/src/main.c 2005-08-30 12:37:40.000000000 +0200
4 #include <stdarg.h> /* C89 */
5 #include <stdbool.h> /* Gnulib, C99 */
6 #include <signal.h> /* ? */
8 #include <iconv.h> /* Gnulib, POSIX */
9 #include "iconvme.h" /* Gnulib */
11 #ifdef HAVE_NL_LANGINFO
16 { "disable-id3", no_argument, NULL, OPT_DISABLE_ID3 },
19 { "in-charset", required_argument, NULL, OPT_IN_CHARSET },
20 { "device-charset", required_argument, NULL, OPT_DEVICE_CHARSET },
22 { "friendly-name", required_argument, NULL, OPT_FRIENDLY_NAME },
23 { "pid-file", required_argument, NULL, OPT_PIDFILE },
24 { "profile", required_argument, NULL, OPT_PROFILE, },
30 iconv_t charset_convert = (iconv_t) -1;
32 const char version_etc_copyright[] = "Copyright (C) 2005 Oskar Liljeblad.";
35 convert_string(const char *str)
38 if (charset_convert == (iconv_t) -1)
40 return iconv_alloc(charset_convert, str);
42 + return xstrdup(str);
48 char *logfilename = NULL;
49 char *timestamp_format = NULL;
52 char *in_charset = NULL;
53 char *device_charset = NULL;
56 set_program_name(argv[0]);
59 if (setlocale(LC_ALL, "") == NULL)
60 warn(_("cannot set locale: %s\n"), errstr);
63 if (bindtextdomain(PACKAGE, LOCALEDIR) == NULL)
64 warn(_("cannot bind message domain: %s\n"), errstr);
73 case OPT_DEVICE_CHARSET:
74 device_charset = optarg;
77 case OPT_FRIENDLY_NAME:
78 if (optarg[0] == '\0')
79 die(_("friendly name cannot be empty\n"));
82 init_logging(logfilename, timestamp_format);
85 if (device_charset != NULL) {
86 if (in_charset == NULL) {
87 #ifdef HAVE_NL_LANGINFO
89 if (charset_convert == (iconv_t) -1)
90 die(_("cannot create character set convertor\nTry using another value for --in-charset or --device-charset\n"));
94 /* We could write pid before initiating logging too.
97 if (pidfilename != NULL)
98 unlink(pidfilename); /* ignore errors */
101 if (charset_convert != (iconv_t) -1)
102 iconv_close(charset_convert); /* ignore errors (only EINVAL) */
105 finish_logging(true);