1 diff -ruN gmediaserver-0.8.0-old/src/main.c gmediaserver-0.8.0-new/src/main.c
2 --- gmediaserver-0.8.0-old/src/main.c 2005-09-10 09:26:00.000000000 +0200
3 +++ gmediaserver-0.8.0-new/src/main.c 2005-09-17 20:48:01.000000000 +0200
5 #include <stdbool.h> /* Gnulib, C99 */
6 #include <signal.h> /* ? */
7 #include <locale.h> /* ? */
9 #include <iconv.h> /* Gnulib, POSIX */
10 #include "iconvme.h" /* Gnulib */
12 #ifdef HAVE_NL_LANGINFO
17 { "disable-id3", no_argument, NULL, OPT_DISABLE_ID3 },
20 { "in-charset", required_argument, NULL, OPT_IN_CHARSET },
21 { "device-charset", required_argument, NULL, OPT_DEVICE_CHARSET },
23 { "friendly-name", required_argument, NULL, OPT_FRIENDLY_NAME },
24 { "pid-file", required_argument, NULL, OPT_PIDFILE },
25 { "profile", required_argument, NULL, OPT_PROFILE, },
31 iconv_t charset_convert = (iconv_t) -1;
33 const char version_etc_copyright[] = "Copyright (C) 2005 Oskar Liljeblad.";
36 convert_string(const char *str)
39 if (charset_convert == (iconv_t) -1)
41 return iconv_alloc(charset_convert, str);
43 + return xstrdup(str);
49 char *logfilename = NULL;
50 char *timestamp_format = NULL;
53 char *in_charset = NULL;
54 char *device_charset = NULL;
57 set_program_name(argv[0]);
60 if (setlocale(LC_ALL, "") == NULL)
61 warn(_("cannot set locale: %s\n"), errstr);
64 if (bindtextdomain(PACKAGE, LOCALEDIR) == NULL)
65 warn(_("cannot bind message domain: %s\n"), errstr);
74 case OPT_DEVICE_CHARSET:
75 device_charset = optarg;
78 case OPT_FRIENDLY_NAME:
79 if (optarg[0] == '\0')
80 die(_("friendly name cannot be empty\n"));
83 init_logging(logfilename, timestamp_format);
86 if (device_charset != NULL) {
87 if (in_charset == NULL) {
88 #ifdef HAVE_NL_LANGINFO
90 if (charset_convert == (iconv_t) -1)
91 die(_("cannot create character set convertor\nTry using another value for --in-charset or --device-charset\n"));
95 /* We could write pid before initiating logging too.
98 if (pidfilename != NULL)
99 unlink(pidfilename); /* ignore errors */
102 if (charset_convert != (iconv_t) -1)
103 iconv_close(charset_convert); /* ignore errors (only EINVAL) */
106 finish_logging(true);