summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2001-07-07 02:42:49 +0000
committerOwen Taylor <otaylor@src.gnome.org>2001-07-07 02:42:49 +0000
commitf1f680b68c946a2d2f6af3c942ce1b4c034f1702 (patch)
tree5a80da9edc7b4a8db868706c2ee2a44dd8bd8f9e
parent33e1075b222c6bfc79b1a3b23105e53a95e8fff6 (diff)
downloadglib-f1f680b68c946a2d2f6af3c942ce1b4c034f1702.tar.gz
Add length arguments to g_utf8_{strup,strdown,casefold,collate_key}.
Fri Jul 6 22:34:32 2001 Owen Taylor <otaylor@redhat.com> * glib/gunicode.h glib/gunidecomp.c glib/guniprop.c glib/gunicollate.c: Add length arguments to g_utf8_{strup,strdown,casefold,collate_key}. * glib/gdate.c: Fix for above.
-rw-r--r--ChangeLog9
-rw-r--r--ChangeLog.pre-2-09
-rw-r--r--ChangeLog.pre-2-109
-rw-r--r--ChangeLog.pre-2-129
-rw-r--r--ChangeLog.pre-2-29
-rw-r--r--ChangeLog.pre-2-49
-rw-r--r--ChangeLog.pre-2-69
-rw-r--r--ChangeLog.pre-2-89
-rw-r--r--glib/gdate.c12
-rw-r--r--glib/gunicode.h13
-rw-r--r--glib/gunicollate.c19
-rw-r--r--glib/gunidecomp.c9
-rw-r--r--glib/guniprop.c42
-rw-r--r--tests/unicode-caseconv.c6
-rw-r--r--tests/unicode-collate.c4
-rw-r--r--tests/unicode-normalize.c6
16 files changed, 129 insertions, 54 deletions
diff --git a/ChangeLog b/ChangeLog
index a475bacc7..83ccc0ee4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,15 @@
+Fri Jul 6 22:34:32 2001 Owen Taylor <otaylor@redhat.com>
+
+ * glib/gunicode.h glib/gunidecomp.c glib/guniprop.c
+ glib/gunicollate.c: Add length arguments to
+ g_utf8_{strup,strdown,casefold,collate_key}.
+
+ * glib/gdate.c: Fix for above.
+
2001-07-06 Pablo Saratxaga <pablo@mandrakesoft.com>
* configure.in: added Basque (eu) to ALL_LINGUAS
-
Mon Jul 2 19:48:52 2001 Andrew Lanoix <alanoix@umich.edu>
*giowin32.c: g_source_remove()ing an socket iochannel closes
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index a475bacc7..83ccc0ee4 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,8 +1,15 @@
+Fri Jul 6 22:34:32 2001 Owen Taylor <otaylor@redhat.com>
+
+ * glib/gunicode.h glib/gunidecomp.c glib/guniprop.c
+ glib/gunicollate.c: Add length arguments to
+ g_utf8_{strup,strdown,casefold,collate_key}.
+
+ * glib/gdate.c: Fix for above.
+
2001-07-06 Pablo Saratxaga <pablo@mandrakesoft.com>
* configure.in: added Basque (eu) to ALL_LINGUAS
-
Mon Jul 2 19:48:52 2001 Andrew Lanoix <alanoix@umich.edu>
*giowin32.c: g_source_remove()ing an socket iochannel closes
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index a475bacc7..83ccc0ee4 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,8 +1,15 @@
+Fri Jul 6 22:34:32 2001 Owen Taylor <otaylor@redhat.com>
+
+ * glib/gunicode.h glib/gunidecomp.c glib/guniprop.c
+ glib/gunicollate.c: Add length arguments to
+ g_utf8_{strup,strdown,casefold,collate_key}.
+
+ * glib/gdate.c: Fix for above.
+
2001-07-06 Pablo Saratxaga <pablo@mandrakesoft.com>
* configure.in: added Basque (eu) to ALL_LINGUAS
-
Mon Jul 2 19:48:52 2001 Andrew Lanoix <alanoix@umich.edu>
*giowin32.c: g_source_remove()ing an socket iochannel closes
diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12
index a475bacc7..83ccc0ee4 100644
--- a/ChangeLog.pre-2-12
+++ b/ChangeLog.pre-2-12
@@ -1,8 +1,15 @@
+Fri Jul 6 22:34:32 2001 Owen Taylor <otaylor@redhat.com>
+
+ * glib/gunicode.h glib/gunidecomp.c glib/guniprop.c
+ glib/gunicollate.c: Add length arguments to
+ g_utf8_{strup,strdown,casefold,collate_key}.
+
+ * glib/gdate.c: Fix for above.
+
2001-07-06 Pablo Saratxaga <pablo@mandrakesoft.com>
* configure.in: added Basque (eu) to ALL_LINGUAS
-
Mon Jul 2 19:48:52 2001 Andrew Lanoix <alanoix@umich.edu>
*giowin32.c: g_source_remove()ing an socket iochannel closes
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index a475bacc7..83ccc0ee4 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,8 +1,15 @@
+Fri Jul 6 22:34:32 2001 Owen Taylor <otaylor@redhat.com>
+
+ * glib/gunicode.h glib/gunidecomp.c glib/guniprop.c
+ glib/gunicollate.c: Add length arguments to
+ g_utf8_{strup,strdown,casefold,collate_key}.
+
+ * glib/gdate.c: Fix for above.
+
2001-07-06 Pablo Saratxaga <pablo@mandrakesoft.com>
* configure.in: added Basque (eu) to ALL_LINGUAS
-
Mon Jul 2 19:48:52 2001 Andrew Lanoix <alanoix@umich.edu>
*giowin32.c: g_source_remove()ing an socket iochannel closes
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index a475bacc7..83ccc0ee4 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,8 +1,15 @@
+Fri Jul 6 22:34:32 2001 Owen Taylor <otaylor@redhat.com>
+
+ * glib/gunicode.h glib/gunidecomp.c glib/guniprop.c
+ glib/gunicollate.c: Add length arguments to
+ g_utf8_{strup,strdown,casefold,collate_key}.
+
+ * glib/gdate.c: Fix for above.
+
2001-07-06 Pablo Saratxaga <pablo@mandrakesoft.com>
* configure.in: added Basque (eu) to ALL_LINGUAS
-
Mon Jul 2 19:48:52 2001 Andrew Lanoix <alanoix@umich.edu>
*giowin32.c: g_source_remove()ing an socket iochannel closes
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index a475bacc7..83ccc0ee4 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,8 +1,15 @@
+Fri Jul 6 22:34:32 2001 Owen Taylor <otaylor@redhat.com>
+
+ * glib/gunicode.h glib/gunidecomp.c glib/guniprop.c
+ glib/gunicollate.c: Add length arguments to
+ g_utf8_{strup,strdown,casefold,collate_key}.
+
+ * glib/gdate.c: Fix for above.
+
2001-07-06 Pablo Saratxaga <pablo@mandrakesoft.com>
* configure.in: added Basque (eu) to ALL_LINGUAS
-
Mon Jul 2 19:48:52 2001 Andrew Lanoix <alanoix@umich.edu>
*giowin32.c: g_source_remove()ing an socket iochannel closes
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index a475bacc7..83ccc0ee4 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,8 +1,15 @@
+Fri Jul 6 22:34:32 2001 Owen Taylor <otaylor@redhat.com>
+
+ * glib/gunicode.h glib/gunidecomp.c glib/guniprop.c
+ glib/gunicollate.c: Add length arguments to
+ g_utf8_{strup,strdown,casefold,collate_key}.
+
+ * glib/gdate.c: Fix for above.
+
2001-07-06 Pablo Saratxaga <pablo@mandrakesoft.com>
* configure.in: added Basque (eu) to ALL_LINGUAS
-
Mon Jul 2 19:48:52 2001 Andrew Lanoix <alanoix@umich.edu>
*giowin32.c: g_source_remove()ing an socket iochannel closes
diff --git a/glib/gdate.c b/glib/gdate.c
index caab6fa70..08b0334bb 100644
--- a/glib/gdate.c
+++ b/glib/gdate.c
@@ -515,8 +515,8 @@ g_date_fill_parse_tokens (const gchar *str, GDateParseTokens *pt)
gchar *casefold;
gchar *normalized;
- casefold = g_utf8_casefold (str);
- normalized = g_utf8_normalize (casefold, G_NORMALIZE_ALL);
+ casefold = g_utf8_casefold (str, -1);
+ normalized = g_utf8_normalize (casefold, -1, G_NORMALIZE_ALL);
g_free (casefold);
i = 1;
@@ -586,15 +586,15 @@ g_date_prepare_to_parse (const gchar *str, GDateParseTokens *pt)
g_date_strftime (buf, 127, "%b", &d);
- casefold = g_utf8_casefold (buf);
+ casefold = g_utf8_casefold (buf, -1);
g_free (short_month_names[i]);
- short_month_names[i] = g_utf8_normalize (casefold, G_NORMALIZE_ALL);
+ short_month_names[i] = g_utf8_normalize (casefold, -1, G_NORMALIZE_ALL);
g_free (casefold);
g_date_strftime (buf, 127, "%B", &d);
- casefold = g_utf8_casefold (buf);
+ casefold = g_utf8_casefold (buf, -1);
g_free (long_month_names[i]);
- long_month_names[i] = g_utf8_normalize (casefold, G_NORMALIZE_ALL);
+ long_month_names[i] = g_utf8_normalize (casefold, -1, G_NORMALIZE_ALL);
g_free (casefold);
++i;
diff --git a/glib/gunicode.h b/glib/gunicode.h
index a4af1f71e..b7f5e344a 100644
--- a/glib/gunicode.h
+++ b/glib/gunicode.h
@@ -247,9 +247,12 @@ gboolean g_utf8_validate (const gchar *str,
/* Validate a Unicode character */
gboolean g_unichar_validate (gunichar ch);
-gchar *g_utf8_strup (const gchar *str);
-gchar *g_utf8_strdown (const gchar *str);
-gchar *g_utf8_casefold (const gchar *str);
+gchar *g_utf8_strup (const gchar *str,
+ gssize len);
+gchar *g_utf8_strdown (const gchar *str,
+ gssize len);
+gchar *g_utf8_casefold (const gchar *str,
+ gssize len);
typedef enum {
G_NORMALIZE_DEFAULT,
@@ -263,11 +266,13 @@ typedef enum {
} GNormalizeMode;
gchar *g_utf8_normalize (const gchar *str,
+ gssize len,
GNormalizeMode mode);
gint g_utf8_collate (const gchar *str1,
const gchar *str2);
-gchar *g_utf8_collate_key (const gchar *str);
+gchar *g_utf8_collate_key (const gchar *str,
+ gssize len);
G_END_DECLS
diff --git a/glib/gunicollate.c b/glib/gunicollate.c
index bcda032d2..5c38836b6 100644
--- a/glib/gunicollate.c
+++ b/glib/gunicollate.c
@@ -27,6 +27,7 @@
#include "glib.h"
extern gunichar *_g_utf8_normalize_wc (const gchar *str,
+ gssize max_len,
GNormalizeMode mode);
/**
@@ -52,8 +53,8 @@ g_utf8_collate (const gchar *str1,
#ifdef __STDC_ISO_10646__
- gunichar *str1_norm = _g_utf8_normalize_wc (str1, G_NORMALIZE_ALL_COMPOSE);
- gunichar *str2_norm = _g_utf8_normalize_wc (str2, G_NORMALIZE_ALL_COMPOSE);
+ gunichar *str1_norm = _g_utf8_normalize_wc (str1, -1, G_NORMALIZE_ALL_COMPOSE);
+ gunichar *str2_norm = _g_utf8_normalize_wc (str2, -1, G_NORMALIZE_ALL_COMPOSE);
result = wcscoll ((wchar_t *)str1_norm, (wchar_t *)str2_norm);
@@ -63,8 +64,8 @@ g_utf8_collate (const gchar *str1,
#else /* !__STDC_ISO_10646__ */
const gchar *charset;
- gchar *str1_norm = g_utf8_normalize (str1, G_NORMALIZE_ALL_COMPOSE);
- gchar *str2_norm = g_utf8_normalize (str2, G_NORMALIZE_ALL_COMPOSE);
+ gchar *str1_norm = g_utf8_normalize (str1, -1, G_NORMALIZE_ALL_COMPOSE);
+ gchar *str2_norm = g_utf8_normalize (str2, -1, G_NORMALIZE_ALL_COMPOSE);
if (g_get_charset (&charset))
{
@@ -148,7 +149,8 @@ utf8_encode (char *buf, wchar_t val)
/**
* g_utf8_collate_key:
* @str: a UTF-8 encoded string.
- *
+ * @len: length of @str, in bytes, or -1 if @str is nul-terminated.
+ *
* Converts a string into a collation key that can be compared
* with other collation keys using strcmp(). The results of
* comparing the collation keys of two strings with strcmp()
@@ -159,14 +161,15 @@ utf8_encode (char *buf, wchar_t val)
* be freed with g_free when you are done with it.
**/
gchar *
-g_utf8_collate_key (const gchar *str)
+g_utf8_collate_key (const gchar *str,
+ gssize len)
{
gchar *result;
size_t len;
#ifdef __STDC_ISO_10646__
- gunichar *str_norm = _g_utf8_normalize_wc (str, G_NORMALIZE_ALL_COMPOSE);
+ gunichar *str_norm = _g_utf8_normalize_wc (str, len, G_NORMALIZE_ALL_COMPOSE);
wchar_t *result_wc;
size_t i;
size_t result_len = 0;
@@ -194,7 +197,7 @@ g_utf8_collate_key (const gchar *str)
#else /* !__STDC_ISO_10646__ */
const gchar *charset;
- gchar *str_norm = g_utf8_normalize (str, G_NORMALIZE_ALL_COMPOSE);
+ gchar *str_norm = g_utf8_normalize (str, len, G_NORMALIZE_ALL_COMPOSE);
if (g_get_charset (&charset))
{
diff --git a/glib/gunidecomp.c b/glib/gunidecomp.c
index 618b75d5d..6af932054 100644
--- a/glib/gunidecomp.c
+++ b/glib/gunidecomp.c
@@ -218,6 +218,7 @@ combine (gunichar a,
gunichar *
_g_utf8_normalize_wc (const gchar *str,
+ gssize max_len,
GNormalizeMode mode)
{
gsize n_wc;
@@ -231,7 +232,7 @@ _g_utf8_normalize_wc (const gchar *str,
n_wc = 0;
p = str;
- while (*p)
+ while ((max_len < 0 || p < str + max_len) && *p)
{
gunichar wc = g_utf8_get_char (p);
@@ -257,7 +258,7 @@ _g_utf8_normalize_wc (const gchar *str,
last_start = 0;
n_wc = 0;
p = str;
- while (*p)
+ while ((max_len < 0 || p < str + max_len) && *p)
{
gunichar wc = g_utf8_get_char (p);
guchar *decomp;
@@ -345,6 +346,7 @@ _g_utf8_normalize_wc (const gchar *str,
/**
* g_utf8_normalize:
* @str: a UTF-8 encoded string.
+ * @len: length of @str, in bytes, or -1 if @str is nul-terminated.
* @mode: the type of normalization to perform.
*
* Convert a string into canonical form, standardizing
@@ -378,9 +380,10 @@ _g_utf8_normalize_wc (const gchar *str,
**/
gchar *
g_utf8_normalize (const gchar *str,
+ gssize len,
GNormalizeMode mode)
{
- gunichar *result_wc = _g_utf8_normalize_wc (str, mode);
+ gunichar *result_wc = _g_utf8_normalize_wc (str, len, mode);
gchar *result;
result = g_ucs4_to_utf8 (result_wc, -1, NULL, NULL, NULL);
diff --git a/glib/guniprop.c b/glib/guniprop.c
index aa2c68a66..b5f998b3a 100644
--- a/glib/guniprop.c
+++ b/glib/guniprop.c
@@ -588,6 +588,7 @@ output_special_case (gchar *out_buffer,
static gsize
real_toupper (const gchar *str,
+ gssize max_len,
gchar *out_buffer,
LocaleType locale_type)
{
@@ -596,7 +597,7 @@ real_toupper (const gchar *str,
gsize len = 0;
gboolean last_was_i = FALSE;
- while (*p)
+ while ((max_len < 0 || p < str + max_len) && *p)
{
gunichar c = g_utf8_get_char (p);
int t = TYPE (c);
@@ -693,8 +694,9 @@ real_toupper (const gchar *str,
}
/**
- * g_ut8f_strup:
- * @string: a UTF-8 encoded string
+ * g_utf8_strup:
+ * @str: a UTF-8 encoded string
+ * @len: length of @str, in bytes, or -1 if @str is nul-terminated.
*
* Converts all Unicode characters in the string that have a case
* to uppercase. The exact manner that this is done depends
@@ -706,7 +708,8 @@ real_toupper (const gchar *str,
* converted to uppercase.
**/
gchar *
-g_utf8_strup (const gchar *str)
+g_utf8_strup (const gchar *str,
+ gssize len)
{
gsize len;
LocaleType locale_type;
@@ -719,9 +722,9 @@ g_utf8_strup (const gchar *str)
/*
* We use a two pass approach to keep memory management simple
*/
- len = real_toupper (str, NULL, locale_type);
+ len = real_toupper (str, len, NULL, locale_type);
result = g_malloc (len + 1);
- real_toupper (str, result, locale_type);
+ real_toupper (str, len, result, locale_type);
result[len] = '\0';
return result;
@@ -729,6 +732,7 @@ g_utf8_strup (const gchar *str)
static gsize
real_tolower (const gchar *str,
+ gssize max_len,
gchar *out_buffer,
LocaleType locale_type)
{
@@ -736,7 +740,7 @@ real_tolower (const gchar *str,
const char *last = NULL;
gsize len = 0;
- while (*p)
+ while ((max_len < 0 || p < str + max_len) && *p)
{
gunichar c = g_utf8_get_char (p);
int t = TYPE (c);
@@ -807,8 +811,9 @@ real_tolower (const gchar *str,
}
/**
- * g_ut8f_strdown:
- * @string: a UTF-8 encoded string
+ * g_utf8_strdown:
+ * @str: a UTF-8 encoded string
+ * @len: length of @str, in bytes, or -1 if @str is nul-terminated.
*
* Converts all Unicode characters in the string that have a case
* to lowercase. The exact manner that this is done depends
@@ -819,7 +824,8 @@ real_tolower (const gchar *str,
* converted to lowercase.
**/
gchar *
-g_utf8_strdown (const gchar *str)
+g_utf8_strdown (const gchar *str,
+ gssize len)
{
gsize len;
LocaleType locale_type;
@@ -832,9 +838,9 @@ g_utf8_strdown (const gchar *str)
/*
* We use a two pass approach to keep memory management simple
*/
- len = real_tolower (str, NULL, locale_type);
+ len = real_tolower (str, len, NULL, locale_type);
result = g_malloc (len + 1);
- real_tolower (str, result, locale_type);
+ real_tolower (str, len, result, locale_type);
result[len] = '\0';
return result;
@@ -843,6 +849,7 @@ g_utf8_strdown (const gchar *str)
/**
* g_utf8_casefold:
* @str: a UTF-8 encoded string
+ * @len: length of @str, in bytes, or -1 if @str is nul-terminated.
*
* Converts a string into a form that is independent of case. The
* result will not correspond to any particular case, but can be
@@ -860,15 +867,16 @@ g_utf8_strdown (const gchar *str)
* case independent form of @str.
**/
gchar *
-g_utf8_casefold (const gchar *str)
+g_utf8_casefold (const gchar *str,
+ gssize len)
{
GString *result = g_string_new (NULL);
const char *p;
gchar buf[6];
- int len;
+ int charlen;
p = str;
- while (*p)
+ while ((len < 0 || p < str + len) && *p)
{
gunichar ch = g_utf8_get_char (p);
@@ -896,8 +904,8 @@ g_utf8_casefold (const gchar *str)
}
ch = g_unichar_tolower (ch);
- len = g_unichar_to_utf8 (ch, buf);
- g_string_append_len (result, buf, len);
+ charlen = g_unichar_to_utf8 (ch, buf);
+ g_string_append_len (result, buf, charlen);
next:
p = g_utf8_next_char (p);
diff --git a/tests/unicode-caseconv.c b/tests/unicode-caseconv.c
index 6b65a7005..65836e142 100644
--- a/tests/unicode-caseconv.c
+++ b/tests/unicode-caseconv.c
@@ -54,7 +54,7 @@ int main (int argc, char **argv)
test = strings[1];
- convert = g_utf8_strup (test);
+ convert = g_utf8_strup (test, -1);
if (strcmp (convert, strings[4]) != 0)
{
fprintf (stderr, "Failure: toupper(%s) == %s, should have been %s\n",
@@ -63,7 +63,7 @@ int main (int argc, char **argv)
}
g_free (convert);
- convert = g_utf8_strdown (test);
+ convert = g_utf8_strdown (test, -1);
if (strcmp (convert, strings[2]) != 0)
{
fprintf (stderr, "Failure: tolower(%s) == %s, should have been %s\n",
@@ -98,7 +98,7 @@ int main (int argc, char **argv)
test = strings[0];
- convert = g_utf8_casefold (test);
+ convert = g_utf8_casefold (test, -1);
if (strcmp (convert, strings[1]) != 0)
{
fprintf (stderr, "Failure: casefold(%s) == '%s', should have been '%s'\n",
diff --git a/tests/unicode-collate.c b/tests/unicode-collate.c
index 44cedb584..0ed2735de 100644
--- a/tests/unicode-collate.c
+++ b/tests/unicode-collate.c
@@ -41,7 +41,7 @@ int main (int argc, char **argv)
if (argc == 2)
{
- in = g_io_channel_new_file (argv[1], G_IO_FILE_MODE_READ, &error);
+ in = g_io_channel_new_file (argv[1], "r", &error);
if (!in)
{
fprintf (stderr, "Cannot open %s: %s\n", argv[1], error->message);
@@ -64,7 +64,7 @@ int main (int argc, char **argv)
str[term_pos] = '\0';
- line.key = g_utf8_collate_key (str);
+ line.key = g_utf8_collate_key (str, -1);
line.str = str;
g_array_append_val (line_array, line);
diff --git a/tests/unicode-normalize.c b/tests/unicode-normalize.c
index 0bd80df34..da6c3336d 100644
--- a/tests/unicode-normalize.c
+++ b/tests/unicode-normalize.c
@@ -67,7 +67,7 @@ test_form (int line,
{
for (i = 0; i < 3; i++)
{
- char *result = g_utf8_normalize (c[i], mode);
+ char *result = g_utf8_normalize (c[i], -1, mode);
if (strcmp (result, c[expected]) != 0)
{
fprintf (stderr, "\nFailure: %d/%d: %s\n", line, i + 1, raw[5]);
@@ -83,7 +83,7 @@ test_form (int line,
{
for (i = 3; i < 5; i++)
{
- char *result = g_utf8_normalize (c[i], mode);
+ char *result = g_utf8_normalize (c[i], -1, mode);
if (strcmp (result, c[expected]) != 0)
{
fprintf (stderr, "\nFailure: %d/%d: %s\n", line, i, raw[5]);
@@ -144,7 +144,7 @@ int main (int argc, char **argv)
if (argc == 3)
line_to_do = atoi(argv[2]);
- in = g_io_channel_new_file (argv[1], G_IO_FILE_MODE_READ, &error);
+ in = g_io_channel_new_file (argv[1], "r", &error);
if (!in)
{
fprintf (stderr, "Cannot open %s: %s\n", argv[1], error->message);