summaryrefslogtreecommitdiffstats
path: root/libidu
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2009-10-30 21:28:53 +0100
committerJim Meyering <meyering@redhat.com>2009-10-30 21:28:53 +0100
commit05ce774b82ca6f81cb10e4cc3514b38ad568d6e0 (patch)
treed9e57731f3cbfc07340af8a55d01718c001474c5 /libidu
parent926d89efdc7f4c578723d71de210aaafaf8bbae3 (diff)
downloadidutils-05ce774b82ca6f81cb10e4cc3514b38ad568d6e0.tar.gz
idutils-05ce774b82ca6f81cb10e4cc3514b38ad568d6e0.tar.bz2
idutils-05ce774b82ca6f81cb10e4cc3514b38ad568d6e0.zip
build: accommodate new syntax-check test
Use EXIT_FAILURE and EXIT_SUCCESS, not 1 and 0. Apply these commands: perl -pi -e 's/\berror \(1,/error (EXIT_FAILURE,/' \ $(git grep -l '\<error (1,') perl -pi -e 's/\bexit \(1\)/exit (EXIT_FAILURE)/' \ $(git grep -l '\<exit (1)') perl -pi -e 's/\bexit \(0\)/exit (EXIT_SUCCESS)/' \ $(git grep -l '\<exit (0)') * libidu/idread.c (read_id_file, maybe_read_id_file, io_read): * libidu/idu-hash.c (hash_init): * libidu/idwrite.c (io_write): * libidu/scanners.c (parse_language_map, parse_language_map_file): (read_language_map_file): * libidu/walker.c (include_languages, exclude_languages): (get_current_dir_link): * src/fid.c (usage, help_me, main): * src/fnid.c (usage, help_me, main): * src/lid.c (usage, help_me, main, report_grep, report_edit): (query_regexp): * src/mkid.c (main, assert_writeable, write_id_file): * src/xtokid.c (help_me):
Diffstat (limited to 'libidu')
-rw-r--r--libidu/idread.c8
-rw-r--r--libidu/idu-hash.c2
-rw-r--r--libidu/idwrite.c2
-rw-r--r--libidu/scanners.c14
-rw-r--r--libidu/walker.c6
5 files changed, 16 insertions, 16 deletions
diff --git a/libidu/idread.c b/libidu/idread.c
index 449c2d1..c55d6bd 100644
--- a/libidu/idread.c
+++ b/libidu/idread.c
@@ -46,7 +46,7 @@ read_id_file (char const *id_file_name, struct idhead *idhp)
struct file_link **flinkv = maybe_read_id_file (id_file_name, idhp);
if (flinkv)
return flinkv;
- error (1, errno, _("can't open `%s'"), id_file_name);
+ error (EXIT_FAILURE, errno, _("can't open `%s'"), id_file_name);
return NULL;
}
@@ -65,9 +65,9 @@ maybe_read_id_file (char const *id_file_name, struct idhead *idhp)
read_idhead (idhp);
if (idhp->idh_magic[0] != IDH_MAGIC_0 || idhp->idh_magic[1] != IDH_MAGIC_1)
- error (1, 0, _("`%s' is not an ID file! (bad magic #)"), id_file_name);
+ error (EXIT_FAILURE, 0, _("`%s' is not an ID file! (bad magic #)"), id_file_name);
if (idhp->idh_version != IDH_VERSION)
- error (1, 0, _("`%s' is version %d, but I only grok version %d"),
+ error (EXIT_FAILURE, 0, _("`%s' is version %d, but I only grok version %d"),
id_file_name, idhp->idh_version, IDH_VERSION);
fseek (idhp->idh_FILE, idhp->idh_flinks_offset, 0);
@@ -187,7 +187,7 @@ io_read (FILE *input_FILE, void *addr, unsigned int size, int io_type)
*(unsigned char *)addr = getc (input_FILE);
break;
default:
- error (1, 0, _("unsupported size in io_read (): %d"), size);
+ error (EXIT_FAILURE, 0, _("unsupported size in io_read (): %d"), size);
}
}
else if (io_type == IO_TYPE_STR)
diff --git a/libidu/idu-hash.c b/libidu/idu-hash.c
index 638335e..3eab298 100644
--- a/libidu/idu-hash.c
+++ b/libidu/idu-hash.c
@@ -48,7 +48,7 @@ hash_init (struct hash_table* ht, unsigned long size,
ht->ht_empty_slots = ht->ht_size;
ht->ht_vec = xcalloc (ht->ht_size, sizeof(struct token *));
if (ht->ht_vec == 0)
- error (1, 0, _("can't allocate %ld bytes for hash table: memory exhausted"),
+ error (EXIT_FAILURE, 0, _("can't allocate %ld bytes for hash table: memory exhausted"),
ht->ht_size * sizeof(struct token *));
ht->ht_capacity = ht->ht_size * 15 / 16; /* 93.75% loading factor */
ht->ht_fill = 0;
diff --git a/libidu/idwrite.c b/libidu/idwrite.c
index 7771d34..0e0c593 100644
--- a/libidu/idwrite.c
+++ b/libidu/idwrite.c
@@ -155,7 +155,7 @@ io_write (FILE *output_FILE, void *addr, unsigned int size, int io_type)
putc (*(unsigned char *)addr, output_FILE);
break;
default:
- error (1, 0, _("unsupported size in io_write (): %d"), size);
+ error (EXIT_FAILURE, 0, _("unsupported size in io_write (): %d"), size);
}
}
else if (io_type == IO_TYPE_STR)
diff --git a/libidu/scanners.c b/libidu/scanners.c
index 67e9a11..4beb5ed 100644
--- a/libidu/scanners.c
+++ b/libidu/scanners.c
@@ -166,7 +166,7 @@ void
parse_language_map (char const *file_name)
{
if (obstack_init (&lang_args_obstack) == 0)
- error (1, 0, _("can't allocate language args obstack: memory exhausted"));
+ error (EXIT_FAILURE, 0, _("can't allocate language args obstack: memory exhausted"));
if (file_name == 0)
file_name = LANGUAGE_MAP_FILE;
parse_language_map_file (file_name, &lang_args_list);
@@ -220,7 +220,7 @@ parse_language_map_file (char const *file_name, struct lang_args **next_ptr)
new_args = obstack_alloc (&lang_args_obstack, sizeof *new_args);
if (new_args == 0)
- error (1, 0, _("can't allocate language args: memory exhausted"));
+ error (EXIT_FAILURE, 0, _("can't allocate language args: memory exhausted"));
new_args->la_pattern = obstack_copy0 (&lang_args_obstack, lmp, pattern_size);
new_args->la_args_string = 0;
new_args->la_next = 0;
@@ -283,22 +283,22 @@ read_language_map_file (char const *file_name)
map_fd = open (file_name, O_RDONLY);
if (map_fd < 0)
- error (1, errno, _("can't open language map file `%s'"), file_name);
+ error (EXIT_FAILURE, errno, _("can't open language map file `%s'"), file_name);
if (fstat (map_fd, &st) < 0)
- error (1, errno, _("can't get size of map file `%s'"), file_name);
+ error (EXIT_FAILURE, errno, _("can't get size of map file `%s'"), file_name);
lang_map_buffer = xmalloc (sizeof(char) * (st.st_size + 2));
if (lang_map_buffer == 0)
- error (1, 0, _("can't allocate language args: memory exhausted"));
+ error (EXIT_FAILURE, 0, _("can't allocate language args: memory exhausted"));
lang_map_buffer[st.st_size] = '\n';
lang_map_buffer[st.st_size+1] = '\0';
bytes = read (map_fd, lang_map_buffer, st.st_size);
if (bytes < 0)
- error (1, errno, _("can't read language map file `%s'"), file_name);
+ error (EXIT_FAILURE, errno, _("can't read language map file `%s'"), file_name);
/* FIXME: handle interrupted & partial reads */
if (bytes != st.st_size)
- error (1, errno, _("can't read entire language map file `%s'"), file_name);
+ error (EXIT_FAILURE, errno, _("can't read entire language map file `%s'"), file_name);
close (map_fd);
return lang_map_buffer;
diff --git a/libidu/walker.c b/libidu/walker.c
index 5fe2bf4..4093958 100644
--- a/libidu/walker.c
+++ b/libidu/walker.c
@@ -503,7 +503,7 @@ void
include_languages (char *lang_names)
{
if (langs_excluded)
- error (1, 0, _("can't mix --include and --exclude options"));
+ error (EXIT_FAILURE, 0, _("can't mix --include and --exclude options"));
langs_included = append_strings_to_vector (langs_included, lang_names, white_space);
}
@@ -511,7 +511,7 @@ void
exclude_languages (char *lang_names)
{
if (langs_excluded)
- error (1, 0, _("can't mix --include and --exclude options"));
+ error (EXIT_FAILURE, 0, _("can't mix --include and --exclude options"));
langs_excluded = append_strings_to_vector (langs_excluded, lang_names, white_space);
}
@@ -621,7 +621,7 @@ get_current_dir_link (void)
cwd = getenv ("PWD");
cwd = same_as_dot (cwd) ? xstrdup (cwd) : xgetcwd ();
if (cwd == NULL)
- error (1, errno, _("can't get working directory"));
+ error (EXIT_FAILURE, errno, _("can't get working directory"));
#if HAVE_LINK
dir_link = get_link_from_string (SLASH_STRING, 0);
dir_link->fl_flags = (dir_link->fl_flags & ~FL_TYPE_MASK) | FL_TYPE_DIR;