New Upstream Release - quvi
Ready changes
Summary
Merged new upstream version: 0.9.5 (was: 0.9.4).
Resulting package
Built on 2022-06-01T03:34 (took 3m38s)
The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:
apt install -t fresh-releases quvi-dbgsymapt install -t fresh-releases quvi
Lintian Result
Diff
diff --git a/ChangeLog b/ChangeLog
index cf120ba..7b9cc02 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,109 @@
+commit ebc2cd0
+Author: Toni Gundogdu <legatvs@gmail.com>
+Date: 2013-11-10
+
+ Update NEWS for v0.9.5
+
+ Signed-off-by: Toni Gundogdu <legatvs@gmail.com>
+
+NEWS
+
+commit 5e2675a
+Merge: d796a73 6b67bfb
+Author: Toni Gundogdu <legatvs@gmail.com>
+Date: 2013-10-20
+
+ Merge branch 'tg/next__redo_linput' into next
+
+commit 6b67bfb
+Author: Toni Gundogdu <legatvs@gmail.com>
+Date: 2013-10-20
+
+ DOC: input: Add file URI note
+
+ Signed-off-by: Toni Gundogdu <legatvs@gmail.com>
+
+doc/man1/input.txt
+
+commit 8dfc090
+Author: Toni Gundogdu <legatvs@gmail.com>
+Date: 2013-10-17
+
+ lutil_parse_input: Check linput_new return value
+
+ Signed-off-by: Toni Gundogdu <legatvs@gmail.com>
+
+src/util/input.c
+
+commit d92133c
+Author: Toni Gundogdu <legatvs@gmail.com>
+Date: 2013-10-17
+
+ linput: Rewrite input parsing completely
+
+ * FIX (memory leak): Release the GIOChannel created for the stdin
+ by decrementing the reference count of the <stdin> GIOChannel
+
+ * Do not unescape input URLs
+ - This was previously done because quvi-dump shamelessly escaped the
+ URLs completely (incl. the "reserved chars") and g_uri_parse_scheme,
+ which linput calls (to determine the action it should take with the
+ input URL), couldn't parse the escaped URI schemes otherwise
+
+ - Any normal applications leave the "reserved chars" unescaped, e.g.
+ the web browsers
+
+ * linput_new now returns an integer, indicating the success
+ - Program now exits if input parsing failed (e.g. invalid URI)
+
+ * Follow file URIs
+ - Making it possible to pass "file://" URIs to the program
+
+ Signed-off-by: Toni Gundogdu <legatvs@gmail.com>
+
+src/input/linput.c
+src/input/linput.h
+
+commit d796a73
+Author: Toni Gundogdu <legatvs@gmail.com>
+Date: 2013-10-10
+
+ quvi-dump: Do not escape reserved chars in URLs
+
+ Other:
+ * Escape UTF8 chars in the URLs (lprint:{rfc2483,json})
+
+ See also:
+ * https://tools.ietf.org/html/rfc3986#section-2.2
+ * https://en.wikipedia.org/wiki/Percent-encoding
+
+ Signed-off-by: Toni Gundogdu <legatvs@gmail.com>
+
+src/main.c
+src/print/json_print.c
+src/print/rfc2483_print.c
+src/print/xml_print.c
+
+commit 384a628
+Author: Toni Gundogdu <legatvs@gmail.com>
+Date: 2013-10-10
+
+ FIX: array initialized from parenthesized string constant (compilation)
+
+ Signed-off-by: Toni Gundogdu <legatvs@gmail.com>
+
+src/util/xchg.c
+
+commit 0c23359
+Author: Toni Gundogdu <legatvs@gmail.com>
+Date: 2013-10-10
+
+ FIX: comma at end of enumerator list (compilation)
+
+ Signed-off-by: Toni Gundogdu <legatvs@gmail.com>
+
+src/pbar/lpbar.c
+
commit c862c5b
Author: Toni Gundogdu <legatvs@gmail.com>
Date: 2013-10-05
diff --git a/NEWS b/NEWS
index cdab4f5..611681f 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,15 @@
+v0.9.5 [2013-11-10]
+
+Toni Gundogdu:
+ - FIX: compilation errors
+ - array initialized from parenthesized string constant [384a628]
+ - comma at end of enumerator list [0c23359]
+ - linput: Rewrite input parsing completely [d92133c]
+ - quvi-dump: Do not escape reserved chars in URLs [d796a73]
+
+ 10 files changed, 135 insertions(+), 96 deletions(-)
+
+
v0.9.4 [2013-10-05]
Toni Gundogdu:
diff --git a/VERSION b/VERSION
index ed5c3a8..06769c1 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-v0.9.4
+v0.9.5
diff --git a/configure b/configure
index d2cc254..b1603df 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for quvi 0.9.4.
+# Generated by GNU Autoconf 2.69 for quvi 0.9.5.
#
# Report bugs to <http://quvi.sf.net/bugs/>.
#
@@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='quvi'
PACKAGE_TARNAME='quvi'
-PACKAGE_VERSION='0.9.4'
-PACKAGE_STRING='quvi 0.9.4'
+PACKAGE_VERSION='0.9.5'
+PACKAGE_STRING='quvi 0.9.5'
PACKAGE_BUGREPORT='http://quvi.sf.net/bugs/'
PACKAGE_URL='http://quvi.sf.net/'
@@ -1378,7 +1378,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures quvi 0.9.4 to adapt to many kinds of systems.
+\`configure' configures quvi 0.9.5 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1449,7 +1449,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of quvi 0.9.4:";;
+ short | recursive ) echo "Configuration of quvi 0.9.5:";;
esac
cat <<\_ACEOF
@@ -1587,7 +1587,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-quvi configure 0.9.4
+quvi configure 0.9.5
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2002,7 +2002,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by quvi $as_me 0.9.4, which was
+It was created by quvi $as_me 0.9.5, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -4266,7 +4266,7 @@ fi
# Define the identity of the package.
PACKAGE='quvi'
- VERSION='0.9.4'
+ VERSION='0.9.5'
cat >>confdefs.h <<_ACEOF
@@ -15997,7 +15997,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by quvi $as_me 0.9.4, which was
+This file was extended by quvi $as_me 0.9.5, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -16064,7 +16064,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-quvi config.status 0.9.4
+quvi config.status 0.9.5
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/debian/changelog b/debian/changelog
index f432909..751fe1d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+quvi (0.9.5-1) UNRELEASED; urgency=low
+
+ * New upstream release.
+
+ -- Debian Janitor <janitor@jelmer.uk> Wed, 01 Jun 2022 03:30:49 -0000
+
quvi (0.9.4-1.2) unstable; urgency=high
* Non-maintainer upload.
diff --git a/debian/patches/0001-Fix-FTBFS-with-autoconf-2.70.patch b/debian/patches/0001-Fix-FTBFS-with-autoconf-2.70.patch
index 1d7b1a7..fa24a13 100644
--- a/debian/patches/0001-Fix-FTBFS-with-autoconf-2.70.patch
+++ b/debian/patches/0001-Fix-FTBFS-with-autoconf-2.70.patch
@@ -9,10 +9,10 @@ Bug-Debian: https://bugs.debian.org/978890
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
-diff --git a/configure.ac b/configure.ac
-index c45d4d8..d64f00d 100644
---- a/configure.ac
-+++ b/configure.ac
+Index: quvi/configure.ac
+===================================================================
+--- quvi.orig/configure.ac
++++ quvi/configure.ac
@@ -6,7 +6,7 @@ AC_PREREQ([2.69])
AC_INIT([quvi], m4_esyscmd([./gen-ver.sh -c | tr -d '\n']),
[http://quvi.sf.net/bugs/],[],[http://quvi.sf.net/])
diff --git a/doc/man1/input.txt b/doc/man1/input.txt
index 09d7024..768bf29 100644
--- a/doc/man1/input.txt
+++ b/doc/man1/input.txt
@@ -4,5 +4,5 @@ INPUT
The command will read stdin by default. The input is expected to
_contain_ URLs. The command arguments are expected to be either URLs or
file paths. If the input is read from either stdin or a file, the
-contents are read as RFC2483.
+contents are read as RFC2483. The input may contain file URIs.
diff --git a/doc/man1/quvi-dump.1 b/doc/man1/quvi-dump.1
index fe7297e..b196c0f 100644
--- a/doc/man1/quvi-dump.1
+++ b/doc/man1/quvi-dump.1
@@ -2,12 +2,12 @@
.\" Title: quvi-dump
.\" Author: [see the "Authors" section]
.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
-.\" Date: 10/05/2013
+.\" Date: 11/10/2013
.\" Manual: quvi Manual
-.\" Source: quvi 0.9.4
+.\" Source: quvi 0.9.5
.\" Language: English
.\"
-.TH "QUVI\-DUMP" "1" "10/05/2013" "quvi 0\&.9\&.4" "quvi Manual"
+.TH "QUVI\-DUMP" "1" "11/10/2013" "quvi 0\&.9\&.5" "quvi Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@@ -65,7 +65,7 @@ The support for the media hosts is determined by the current selection of \fBlib
See \fBquvirc\fR(5) for more information about the groups and the variables that quvi parses\&.
.SH "INPUT"
.sp
-The command will read stdin by default\&. The input is expected to \fIcontain\fR URLs\&. The command arguments are expected to be either URLs or file paths\&. If the input is read from either stdin or a file, the contents are read as RFC2483\&.
+The command will read stdin by default\&. The input is expected to \fIcontain\fR URLs\&. The command arguments are expected to be either URLs or file paths\&. If the input is read from either stdin or a file, the contents are read as RFC2483\&. The input may contain file URIs\&.
.SH "OPTIONS"
.SS "Core"
.PP
diff --git a/doc/man1/quvi-get.1 b/doc/man1/quvi-get.1
index 3e2e918..840edb5 100644
--- a/doc/man1/quvi-get.1
+++ b/doc/man1/quvi-get.1
@@ -2,12 +2,12 @@
.\" Title: quvi-get
.\" Author: [see the "Authors" section]
.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
-.\" Date: 10/05/2013
+.\" Date: 11/10/2013
.\" Manual: quvi Manual
-.\" Source: quvi 0.9.4
+.\" Source: quvi 0.9.5
.\" Language: English
.\"
-.TH "QUVI\-GET" "1" "10/05/2013" "quvi 0\&.9\&.4" "quvi Manual"
+.TH "QUVI\-GET" "1" "11/10/2013" "quvi 0\&.9\&.5" "quvi Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@@ -58,7 +58,7 @@ The support for the media hosts is determined by the current selection of \fBlib
See \fBquvirc\fR(5) for more information about the groups and the variables that quvi parses\&.
.SH "INPUT"
.sp
-The command will read stdin by default\&. The input is expected to \fIcontain\fR URLs\&. The command arguments are expected to be either URLs or file paths\&. If the input is read from either stdin or a file, the contents are read as RFC2483\&.
+The command will read stdin by default\&. The input is expected to \fIcontain\fR URLs\&. The command arguments are expected to be either URLs or file paths\&. If the input is read from either stdin or a file, the contents are read as RFC2483\&. The input may contain file URIs\&.
.SH "OPTIONS"
.SS "Core"
.PP
diff --git a/doc/man1/quvi-info.1 b/doc/man1/quvi-info.1
index a4dd12f..2bb3eb1 100644
--- a/doc/man1/quvi-info.1
+++ b/doc/man1/quvi-info.1
@@ -2,12 +2,12 @@
.\" Title: quvi-info
.\" Author: [see the "Authors" section]
.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
-.\" Date: 10/05/2013
+.\" Date: 11/10/2013
.\" Manual: quvi Manual
-.\" Source: quvi 0.9.4
+.\" Source: quvi 0.9.5
.\" Language: English
.\"
-.TH "QUVI\-INFO" "1" "10/05/2013" "quvi 0\&.9\&.4" "quvi Manual"
+.TH "QUVI\-INFO" "1" "11/10/2013" "quvi 0\&.9\&.5" "quvi Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
diff --git a/doc/man1/quvi-scan.1 b/doc/man1/quvi-scan.1
index 4e74ad4..b63be6f 100644
--- a/doc/man1/quvi-scan.1
+++ b/doc/man1/quvi-scan.1
@@ -2,12 +2,12 @@
.\" Title: quvi-scan
.\" Author: [see the "Authors" section]
.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
-.\" Date: 10/05/2013
+.\" Date: 11/10/2013
.\" Manual: quvi Manual
-.\" Source: quvi 0.9.4
+.\" Source: quvi 0.9.5
.\" Language: English
.\"
-.TH "QUVI\-SCAN" "1" "10/05/2013" "quvi 0\&.9\&.4" "quvi Manual"
+.TH "QUVI\-SCAN" "1" "11/10/2013" "quvi 0\&.9\&.5" "quvi Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@@ -50,7 +50,7 @@ The support for the media hosts is determined by the current selection of \fBlib
See \fBquvirc\fR(5) for more information about the groups and the variables that quvi parses\&.
.SH "INPUT"
.sp
-The command will read stdin by default\&. The input is expected to \fIcontain\fR URLs\&. The command arguments are expected to be either URLs or file paths\&. If the input is read from either stdin or a file, the contents are read as RFC2483\&.
+The command will read stdin by default\&. The input is expected to \fIcontain\fR URLs\&. The command arguments are expected to be either URLs or file paths\&. If the input is read from either stdin or a file, the contents are read as RFC2483\&. The input may contain file URIs\&.
.SH "OPTIONS"
.SS "Core"
.PP
diff --git a/doc/man1/quvi.1 b/doc/man1/quvi.1
index 25f3de5..1e96c3f 100644
--- a/doc/man1/quvi.1
+++ b/doc/man1/quvi.1
@@ -2,12 +2,12 @@
.\" Title: quvi
.\" Author: [see the "Authors" section]
.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
-.\" Date: 10/05/2013
+.\" Date: 11/10/2013
.\" Manual: quvi Manual
-.\" Source: quvi 0.9.4
+.\" Source: quvi 0.9.5
.\" Language: English
.\"
-.TH "QUVI" "1" "10/05/2013" "quvi 0\&.9\&.4" "quvi Manual"
+.TH "QUVI" "1" "11/10/2013" "quvi 0\&.9\&.5" "quvi Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
diff --git a/doc/man5/quvirc.5 b/doc/man5/quvirc.5
index b454524..7020ca2 100644
--- a/doc/man5/quvirc.5
+++ b/doc/man5/quvirc.5
@@ -2,12 +2,12 @@
.\" Title: quvirc
.\" Author: [see the "Authors" section]
.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
-.\" Date: 10/05/2013
+.\" Date: 11/10/2013
.\" Manual: quvi Manual
-.\" Source: quvi 0.9.4
+.\" Source: quvi 0.9.5
.\" Language: English
.\"
-.TH "QUVIRC" "5" "10/05/2013" "quvi 0\&.9\&.4" "quvi Manual"
+.TH "QUVIRC" "5" "11/10/2013" "quvi 0\&.9\&.5" "quvi Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
diff --git a/po/quvi.pot b/po/quvi.pot
index 99c8852..d76c870 100644
--- a/po/quvi.pot
+++ b/po/quvi.pot
@@ -6,9 +6,9 @@
#, fuzzy
msgid ""
msgstr ""
-"Project-Id-Version: quvi 0.9.4\n"
+"Project-Id-Version: quvi 0.9.5\n"
"Report-Msgid-Bugs-To: http://quvi.sf.net/bugs/\n"
-"POT-Creation-Date: 2013-10-05 12:34+0300\n"
+"POT-Creation-Date: 2013-11-10 10:01+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -148,54 +148,64 @@ msgstr ""
msgid "protocol `%s' is not supported"
msgstr ""
-#: src/input/linput.c:105
+#: src/input/linput.c:74
#, c-format
-msgid "error: %s: while reading file: %s\n"
+msgid "error: while reading file: %s\n"
msgstr ""
-#: src/input/linput.c:127
+#: src/input/linput.c:106
#, c-format
-msgid "error: ignoring input value `%s': not an URL or a file\n"
+msgid "error: while converting to URI: %s\n"
msgstr ""
-#: src/main.c:57
+#: src/input/linput.c:147
+#, c-format
+msgid "error: %s: an invalid URI\n"
+msgstr ""
+
+#: src/input/linput.c:174
+#, c-format
+msgid "error: %s: neither a valid URI or a local file\n"
+msgstr ""
+
+#: src/main.c:59
#, c-format
msgid "error: while executing: `%s': %s\n"
msgstr ""
-#: src/main.c:80
+#: src/main.c:82
msgid "Query and print the property values"
msgstr ""
-#: src/main.c:81
+#: src/main.c:83
msgid "Save media stream to a file"
msgstr ""
-#: src/main.c:82
+#: src/main.c:84
msgid "Inspect the configuration and the script properties"
msgstr ""
-#: src/main.c:83
+#: src/main.c:85
msgid "Scan and print the found embedded media URLs"
msgstr ""
-#: src/main.c:119
+#: src/main.c:121
msgid ""
"Usage: quvi [--version] [--help] COMMAND [ARGS]\n"
"\n"
msgstr ""
-#: src/main.c:120
+#: src/main.c:122
msgid "quvi commands are:\n"
msgstr ""
-#: src/main.c:132
+#: src/main.c:134
msgid ""
"\n"
"See 'quvi help COMMAND' for more information on a specific command.\n"
msgstr ""
-#: src/main.c:178
+#: src/main.c:180
#, c-format
msgid "error: `%s' is not a quvi command. See 'quvi help'.\n"
msgstr ""
@@ -311,25 +321,25 @@ msgstr ""
msgid "error: %s\n"
msgstr ""
-#: src/print/rfc2483_print.c:159
+#: src/print/rfc2483_print.c:161
msgid ""
"# Media streams\n"
"#\n"
msgstr ""
-#: src/print/rfc2483_print.c:230
+#: src/print/rfc2483_print.c:232
msgid ""
"# Playlist media URLs\n"
"#\n"
msgstr ""
-#: src/print/rfc2483_print.c:275
+#: src/print/rfc2483_print.c:277
msgid ""
"# Embedded media URLs\n"
"#\n"
msgstr ""
-#: src/print/rfc2483_print.c:343
+#: src/print/rfc2483_print.c:345
msgid ""
"# Subtitles\n"
"#\n"
@@ -368,7 +378,7 @@ msgstr ""
msgid "while ending the XML element `%s'"
msgstr ""
-#: src/print/xml_print.c:192
+#: src/print/xml_print.c:197
msgid "while dumping the XML document"
msgstr ""
@@ -448,7 +458,7 @@ msgstr ""
msgid "%s: while opening file: %s: %s"
msgstr ""
-#: src/util/input.c:36
+#: src/util/input.c:38
msgid "error: no input URL\n"
msgstr ""
diff --git a/src/input/linput.c b/src/input/linput.c
index d7bf3a7..15eeeac 100644
--- a/src/input/linput.c
+++ b/src/input/linput.c
@@ -21,75 +21,44 @@
#include "config.h"
#include <unistd.h>
+#include <stdlib.h>
#include <string.h>
#include <glib/gi18n.h>
-#include "lutil.h"
#include "linput.h"
+#include "lutil.h"
-static gchar *_read_stdin(linput_t linput)
+static gchar *_read_stdin()
{
- gchar *s, *r, *p;
GIOChannel *c;
- gsize n, sn;
+ gchar *r, *s;
+ gsize n;
c = g_io_channel_unix_new(STDIN_FILENO);
- s = NULL;
- r = NULL;
+ r = s = NULL;
n = 0;
while (g_io_channel_read_line(c, &s, NULL, NULL, NULL) != G_IO_STATUS_EOF)
{
- sn = strlen(s);
- p = g_realloc(r, n+sn+1);
+ gchar *p;
+ gsize l;
+
+ l = strlen(s);
+ p = g_realloc(r, n+l+1);
+
if (p != NULL)
{
r = p;
- memcpy(&(r[n]), s, sn);
- n += sn;
+ memcpy(&r[n], s, l);
+ n += l;
r[n] = '\0';
}
g_free(s);
- s = NULL;
}
+ g_io_channel_unref(c);
return (r);
}
-static gboolean _has_uri_scheme(const gchar *s, gchar **dst)
-{
- gchar *p, *t;
- gboolean r;
-
- t = g_uri_unescape_string(s, NULL);
- p = g_uri_parse_scheme(t);
- r = (p != NULL) ? TRUE:FALSE;
- g_free(p);
-
- if (dst != NULL && r == TRUE)
- *dst = t;
- else
- g_free(t);
-
- return (r);
-}
-
-static void _extract_urls(const gchar *b, linput_t l)
-{
- gchar **r, *u;
- gint i;
-
- r = g_uri_list_extract_uris(b);
- i = 0;
-
- while (r[i] != NULL)
- {
- if (_has_uri_scheme(r[i], &u) == TRUE)
- l->url.input = lutil_slist_prepend_if_unique(l->url.input, u);
- ++i;
- }
- g_strfreev(r);
-}
-
static gchar *_read_file(const gchar *fpath)
{
GError *e;
@@ -102,72 +71,129 @@ static gchar *_read_file(const gchar *fpath)
{
if (e != NULL)
{
- g_printerr(_("error: %s: while reading file: %s\n"),
- fpath, e->message);
+ g_printerr(_("error: while reading file: %s\n"), e->message);
g_error_free(e);
- e = NULL;
}
}
return (r);
}
-static void _no_rargs(linput_t linput)
+static gint _extract_uris(linput_t, const gchar*);
+
+static gint _read_from_uri(linput_t p, const gchar *u)
{
- gchar *b = _read_stdin(linput);
- if (b != NULL)
+ GError *e;
+ gchar *f;
+ gint r;
+
+ r = EXIT_FAILURE;
+ e = NULL;
+ f = g_filename_from_uri(u, NULL, &e);
+
+ if (f !=NULL)
+ {
+ gchar *c = _read_file(f);
+ if (c !=NULL)
+ {
+ r = _extract_uris(p, c);
+ r = EXIT_SUCCESS;
+ g_free(c);
+ }
+ g_free(f);
+ }
+ else
{
- _extract_urls(b, linput);
- g_free(b);
+ g_printerr(_("error: while converting to URI: %s\n"), e->message);
+ g_error_free(e);
}
+ return (r);
}
-static void _have_rargs(linput_t linput, const gchar **rargs)
+static gint _determine_input(linput_t p, const gboolean try_read_as_file,
+ const gchar *invalid_msg, const gchar *s)
{
- static const gchar *_E =
- N_("error: ignoring input value `%s': not an URL or a file\n");
+ gchar *c;
+ gint r;
- gchar *p, *u;
- gint i;
+ c = g_uri_parse_scheme(s);
+ r = EXIT_SUCCESS;
- i = 0;
- while (rargs[i] != NULL)
+ if ((c ==NULL || strlen(c) ==0) && try_read_as_file ==TRUE)
{
- p = (gchar*) rargs[i++];
- g_strstrip(p);
-
- /* If file. */
- if (g_file_test(p, G_FILE_TEST_IS_REGULAR) == TRUE)
- {
- gchar *b = _read_file(p);
- if (b != NULL)
- {
- _extract_urls(b, linput);
- g_free(b);
- }
- }
- /* If URI. */
- else if (_has_uri_scheme(p, &u) == TRUE)
+ gchar *b = _read_file(s);
+ if (b != NULL)
{
- linput->url.input =
- lutil_slist_prepend_if_unique(linput->url.input, u);
+ r = _extract_uris(p, b);
+ g_free(b);
}
- /* Unable to determine. */
else
- g_printerr(g_dgettext(GETTEXT_PACKAGE, _E), p);
+ r = EXIT_FAILURE;
+ }
+ else if (g_strcmp0(c, "http") ==0 || g_strcmp0(c, "https") ==0)
+ p->url.input = lutil_slist_prepend_if_unique(p->url.input, s);
+ else if (g_strcmp0(c, "file") ==0)
+ r = _read_from_uri(p, s);
+ else
+ {
+ g_printerr(g_dgettext(GETTEXT_PACKAGE, invalid_msg), s);
+ r = EXIT_FAILURE;
}
+ g_free(c);
+ return (r);
}
-void linput_new(linput_t linput, const gchar **rargs)
+static gint _extract_uris(linput_t p, const gchar *s)
{
+ static const gchar *E = N_("error: %s: an invalid URI\n");
+
+ gchar **u;
+ gint i, r;
+
+ u = g_uri_list_extract_uris(s);
+
+ for (i=0, r=EXIT_SUCCESS; u[i] !=NULL && r==EXIT_SUCCESS; ++i)
+ r = _determine_input(p, FALSE, E, u[i]);
+
+ g_strfreev(u);
+ return (r);
+}
+
+static gint _parse_without_rargs(linput_t p)
+{
+ gchar *c;
+ gint r;
+ c = _read_stdin();
+ r = _extract_uris(p, c);
+ g_free(c);
+ return (r);
+}
+
+static gint _parse_with_rargs(linput_t p, const gchar **rargs)
+{
+ static const gchar *E =
+ N_("error: %s: neither a valid URI or a local file\n");
+
+ gint i, r;
+ for (i=0, r=EXIT_SUCCESS; rargs[i] !=NULL && r ==EXIT_SUCCESS; ++i)
+ r = _determine_input(p, TRUE, E, rargs[i]);
+
+ return (r);
+}
+
+gint linput_new(linput_t linput, const gchar **rargs)
+{
+ gint r;
+
g_assert(linput != NULL);
g_assert(linput->url.input == NULL);
if (rargs == NULL || g_strv_length((gchar**) rargs) == 0)
- _no_rargs(linput);
+ r = _parse_without_rargs(linput);
else
- _have_rargs(linput, rargs);
+ r = _parse_with_rargs(linput, rargs);
linput->url.input = g_slist_reverse(linput->url.input);
+ return (r);
}
void linput_free(linput_t linput)
diff --git a/src/input/linput.h b/src/input/linput.h
index 2f05270..c50a163 100644
--- a/src/input/linput.h
+++ b/src/input/linput.h
@@ -1,5 +1,5 @@
/* quvi
- * Copyright (C) 2012 Toni Gundogdu <legatvs@gmail.com>
+ * Copyright (C) 2012,2013 Toni Gundogdu <legatvs@gmail.com>
*
* This file is part of quvi <http://quvi.sourceforge.net/>.
*
@@ -31,7 +31,7 @@ struct linput_s
typedef struct linput_s *linput_t;
-void linput_new(linput_t, const gchar**);
+gint linput_new(linput_t, const gchar**);
void linput_free(linput_t);
#endif /* linput_h */
diff --git a/src/main.c b/src/main.c
index a0a2986..db0fe12 100644
--- a/src/main.c
+++ b/src/main.c
@@ -29,6 +29,8 @@
#include "opts.h"
#include "cmd.h"
+const gchar *reserved_chars = "!*'();:@&=+$,/?#[]";
+
struct opts_s opts;
gint exit_status;
gchar *argv0;
diff --git a/src/pbar/lpbar.c b/src/pbar/lpbar.c
index d90e1c7..c952c29 100644
--- a/src/pbar/lpbar.c
+++ b/src/pbar/lpbar.c
@@ -29,7 +29,7 @@ typedef enum
{
Ki = 1024,
Mi = 1048576,
- Gi = 1073741824,
+ Gi = 1073741824
} ieee_1541;
#define _s(n) #n
diff --git a/src/print/json_print.c b/src/print/json_print.c
index 6df652b..c62796f 100644
--- a/src/print/json_print.c
+++ b/src/print/json_print.c
@@ -103,6 +103,8 @@ static gint _print_buffer(const json_t p)
return (EXIT_SUCCESS);
}
+extern const gchar *reserved_chars;
+
void lprint_json_errmsg(const gchar *fmt, ...)
{
va_list args;
@@ -111,7 +113,7 @@ void lprint_json_errmsg(const gchar *fmt, ...)
va_start(args, fmt);
if (g_vasprintf(&s, fmt, args) >0)
{
- gchar *e = g_uri_escape_string(s, NULL, TRUE);
+ gchar *e = g_uri_escape_string(s, reserved_chars, FALSE);
g_printerr("{\"error\" : \"%s\"}\n", e);
g_free(e);
g_free(s);
@@ -158,7 +160,7 @@ static gint _set_member(const json_t p, const lutilPropertyType pt,
json_builder_set_member_name(p->b, n);
if (s != NULL)
{
- gchar *e = g_uri_escape_string(s, NULL, TRUE);
+ gchar *e = g_uri_escape_string(s, reserved_chars, FALSE);
json_builder_add_string_value(p->b, e);
g_free(e);
}
@@ -455,7 +457,7 @@ gint lprint_json_scan_properties(quvi_scan_t qs, gpointer data)
json_builder_begin_object(p->b);
json_builder_set_member_name(p->b, "url");
- e = g_uri_escape_string(s, NULL, TRUE);
+ e = g_uri_escape_string(s, reserved_chars, FALSE);
json_builder_add_string_value(p->b, e);
json_builder_end_object(p->b);
diff --git a/src/print/rfc2483_print.c b/src/print/rfc2483_print.c
index 087601a..a2269c2 100644
--- a/src/print/rfc2483_print.c
+++ b/src/print/rfc2483_print.c
@@ -70,6 +70,8 @@ static gint _rfc2483_handle_free(gpointer data, const gint r)
return (r);
}
+extern const gchar *reserved_chars;
+
static gint _print(const rfc2483_t p, const lutilPropertyType pt,
const gchar *n, const gchar *s, const gdouble d,
const gboolean comment_out, const gboolean escape)
@@ -87,7 +89,7 @@ static gint _print(const rfc2483_t p, const lutilPropertyType pt,
{
if (escape == TRUE)
{
- gchar *e = g_uri_escape_string(s, NULL, TRUE);
+ gchar *e = g_uri_escape_string(s, reserved_chars, FALSE);
g_print("%s%s\n", h, e);
g_free(e);
}
@@ -275,7 +277,7 @@ gint lprint_rfc2483_scan_properties(quvi_scan_t qs, gpointer data)
g_print(_("# Embedded media URLs\n#\n"));
while ( (s = quvi_scan_next_media_url(qs)) != NULL)
{
- gchar *e = g_uri_escape_string(s, NULL, TRUE);
+ gchar *e = g_uri_escape_string(s, reserved_chars, FALSE);
g_print("%s\n", e);
g_free(e);
}
diff --git a/src/print/xml_print.c b/src/print/xml_print.c
index 29d23a2..5917e6a 100644
--- a/src/print/xml_print.c
+++ b/src/print/xml_print.c
@@ -141,15 +141,20 @@ static gint _end_e(const xml_t p, const ErrorMessage e, const gchar *w)
return (r);
}
+extern const gchar *reserved_chars;
+
static gint _write_attr(const xml_t p, const gchar *n, const gchar *s)
{
xmlChar *e;
gint r;
- e = xmlURIEscapeStr(BAD_CAST s, NULL);
+ e = xmlURIEscapeStr(BAD_CAST s, BAD_CAST reserved_chars);
+
+
r = (xmlTextWriterWriteAttribute(p->w, BAD_CAST n, e) <0)
? EXIT_FAILURE
: EXIT_SUCCESS;
+
xmlFree(e);
if (r != EXIT_SUCCESS)
@@ -206,7 +211,7 @@ void lprint_xml_errmsg(const gchar *fmt, ...)
va_start(args, fmt);
if (g_vasprintf(&s, fmt, args) >0)
{
- xmlChar *e = xmlURIEscapeStr(BAD_CAST s, NULL);
+ xmlChar *e = xmlURIEscapeStr(BAD_CAST s, BAD_CAST reserved_chars);
g_printerr("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
"<error message=\"%s\" />", e);
xmlFree(e);
diff --git a/src/util/input.c b/src/util/input.c
index b35318f..6c498e8 100644
--- a/src/util/input.c
+++ b/src/util/input.c
@@ -30,7 +30,9 @@ gint lutil_parse_input(gpointer p, const gchar **rargs)
{
linput_t l = (linput_t) p;
- linput_new(l, rargs);
+ if (linput_new(l, rargs) != EXIT_SUCCESS)
+ return (EXIT_FAILURE);
+
if (g_slist_length(l->url.input) ==0)
{
g_printerr(_("error: no input URL\n"));
diff --git a/src/util/xchg.c b/src/util/xchg.c
index cdf3ad0..d60ee2f 100644
--- a/src/util/xchg.c
+++ b/src/util/xchg.c
@@ -47,7 +47,7 @@ static const struct _media_xchg_table_s media_xchg_table[] =
{0, 0, NULL}
};
-static const gchar default_str[] = N_("default");
+static const gchar *default_str = N_("default");
/* Return a media property value. */
static gchar *_qm_get(quvi_media_t qm, const gint i)