1 $Id: update-patches 24 2008-08-31 14:56:13Z wbx $
2 --- gmediaserver-0.13.0.orig/src/main.c 2007-10-20 11:41:37.000000000 +0200
3 +++ gmediaserver-0.13.0/src/main.c 2008-10-28 12:14:59.000000000 +0100
5 #include <stdbool.h> /* Gnulib, C99 */
6 #include <signal.h> /* ? */
7 #include <locale.h> /* ? */
9 #include <iconv.h> /* Gnulib, POSIX */
10 #include "striconv.h" /* Gnulib */
12 #ifdef HAVE_NL_LANGINFO
15 @@ -72,9 +74,11 @@ enum {
16 static const char *short_options = "bv::i:o:p:";
17 static struct option long_options[] = {
18 { "disable-tags", no_argument, NULL, OPT_DISABLE_TAGS },
20 { "fs-charset", required_argument, NULL, OPT_FS_CHARSET },
21 { "device-charset", required_argument, NULL, OPT_DEVICE_CHARSET },
22 { "log-charset", required_argument, NULL, OPT_LOG_CHARSET },
24 { "friendly-name", required_argument, NULL, OPT_FRIENDLY_NAME },
25 { "pid-file", required_argument, NULL, OPT_PIDFILE },
26 { "profile", required_argument, NULL, OPT_PROFILE, },
27 @@ -92,14 +96,17 @@ static struct option long_options[] = {
32 static iconv_t utf8_to_device = (iconv_t) -1;
33 static iconv_t utf8_to_log = (iconv_t) -1;
34 static iconv_t fs_to_utf8 = (iconv_t) -1;
36 const char version_etc_copyright[] = "Copyright (C) 2005, 2006 Oskar Liljeblad.";
39 convert_string_to_device(const char *str)
43 if (utf8_to_device == (iconv_t) -1)
45 @@ -107,12 +114,15 @@ convert_string_to_device(const char *str
48 warn(_("%s: cannot convert to device character set: %s\n"), quotearg(str), errstr);
55 convert_string_to_log(const char *str)
60 if (utf8_to_log == (iconv_t) -1)
61 @@ -121,7 +131,9 @@ convert_string_to_log(const char *str)
64 /* Cannot warn here - would deadlock! */
70 static char *cache_fs_str = NULL;
71 @@ -129,6 +141,7 @@ static char *cache_fs_str = NULL;
73 conv_filename(const char *str)
77 if (fs_to_utf8 == (iconv_t) -1) {
78 cache_fs_str = xstrdup(str);
79 @@ -140,6 +153,9 @@ conv_filename(const char *str)
84 + return xstrdup(str);
89 @@ -188,8 +204,10 @@ main(int argc, char **argv)
90 set_program_name(argv[0]);
91 set_quoting_style(0, escape_quoting_style);
94 if (setlocale(LC_ALL, "") == NULL)
95 warn(_("cannot set locale: %s\n"), errstr);
98 if (bindtextdomain(PACKAGE, LOCALEDIR) == NULL)
99 warn(_("cannot bind message domain: %s\n"), errstr);
100 @@ -215,6 +233,7 @@ main(int argc, char **argv)
101 case OPT_DISABLE_TAGS:
102 tags_enabled = false;
108 @@ -224,6 +243,7 @@ main(int argc, char **argv)
109 case OPT_LOG_CHARSET:
110 log_charset = optarg;
113 case OPT_FRIENDLY_NAME:
114 if (optarg[0] == '\0')
115 die(_("friendly name cannot be empty\n"));
116 @@ -294,9 +314,11 @@ main(int argc, char **argv)
117 printf(_("Run the UPnP media server.\n\n"));
118 printf(_(" --friendly-name=NAME set display name for media server\n"));
119 printf(_(" --disable-tags do not scan files for tags\n"));
121 printf(_(" --fs-charset=CHARSET character set used in file names\n"));
122 printf(_(" --device-charset=CHARSET character set used in the player device\n"));
123 printf(_(" --log-charset=CHARSET character set used in logs and display\n"));
125 printf(_(" -v, --verbose[=LEVEL] set verbosity level (0-4)\n"));
126 printf(_(" --pid-file=FILE write pid to FILE when up and running\n"));
127 printf(_(" -i, --interface=NAME listen on a specific interface\n"));
128 @@ -371,6 +393,7 @@ main(int argc, char **argv)
129 if (fs_charset == NULL && getenv("G_BROKEN_FILENAMES") != NULL)
130 fs_charset = nl_langinfo(CODESET);
133 if (fs_charset != NULL) {
134 fs_to_utf8 = iconv_open("UTF-8", fs_charset);
135 if (fs_to_utf8 == (iconv_t) -1)
136 @@ -395,6 +418,7 @@ main(int argc, char **argv)
137 die(_("cannot create character set convertor from %s to %s\n"), "UTF-8", quotearg(log_charset));
139 say(4, _("Using log character set %s\n"), quote(log_charset == NULL ? "UTF-8" : log_charset));
142 init_logging(logfilename, timestamp_format);
144 @@ -478,12 +502,14 @@ main(int argc, char **argv)
146 finish_logging(true);
149 if (fs_to_utf8 != (iconv_t) -1)
150 iconv_close(fs_to_utf8); /* ignore errors (only EINVAL) */
151 if (utf8_to_device != (iconv_t) -1)
152 iconv_close(utf8_to_device); /* ignore errors (only EINVAL) */
153 if (utf8_to_log != (iconv_t) -1)
154 iconv_close(utf8_to_log); /* ignore errors (only EINVAL) */