summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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
-rw-r--r--src/fid.c8
-rw-r--r--src/fnid.c8
-rw-r--r--src/lid.c20
-rw-r--r--src/mkid.c10
-rw-r--r--src/xtokid.c2
10 files changed, 40 insertions, 40 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;
diff --git a/src/fid.c b/src/fid.c
index 24d1833..e72e820 100644
--- a/src/fid.c
+++ b/src/fid.c
@@ -71,7 +71,7 @@ usage (void)
{
fprintf (stderr, _("Try `%s --help' for more information.\n"),
program_name);
- exit (1);
+ exit (EXIT_FAILURE);
}
static void __attribute__((__noreturn__))
@@ -89,7 +89,7 @@ also given list the identifiers that occur in both files.\n\
--version output version information and exit\n\
"));
printf (_("\nReport bugs to " PACKAGE_BUGREPORT "\n\n"));
- exit (0);
+ exit (EXIT_SUCCESS);
}
int
@@ -136,7 +136,7 @@ main (int argc, char **argv)
if (show_version)
{
printf ("%s - %s\n", program_name, PACKAGE_VERSION);
- exit (0);
+ exit (EXIT_SUCCESS);
}
if (show_help)
@@ -158,7 +158,7 @@ main (int argc, char **argv)
/* Look for the ID database up the tree */
idh.idh_file_name = locate_id_file_name (idh.idh_file_name);
if (idh.idh_file_name == 0)
- error (1, errno, _("can't locate `ID'"));
+ error (EXIT_FAILURE, errno, _("can't locate `ID'"));
init_idh_obstacks (&idh);
init_idh_tables (&idh);
diff --git a/src/fnid.c b/src/fnid.c
index 95253cd..d54ec11 100644
--- a/src/fnid.c
+++ b/src/fnid.c
@@ -50,7 +50,7 @@ usage (void)
{
fprintf (stderr, _("Try `%s --help' for more information.\n"),
program_name);
- exit (1);
+ exit (EXIT_FAILURE);
}
static struct option const long_options[] =
@@ -78,7 +78,7 @@ using shell-style wildcards.\n\
--version output version information and exit\n\
"));
printf (_("\nReport bugs to " PACKAGE_BUGREPORT "\n\n"));
- exit (0);
+ exit (EXIT_SUCCESS);
}
int
@@ -125,7 +125,7 @@ main (int argc, char **argv)
if (show_version)
{
printf ("%s - %s\n", program_name, PACKAGE_VERSION);
- exit (0);
+ exit (EXIT_SUCCESS);
}
if (show_help)
@@ -152,7 +152,7 @@ main (int argc, char **argv)
/* Look for the ID database up the tree */
idh.idh_file_name = locate_id_file_name (idh.idh_file_name);
if (idh.idh_file_name == 0)
- error (1, errno, _("can't locate `ID'"));
+ error (EXIT_FAILURE, errno, _("can't locate `ID'"));
init_idh_obstacks (&idh);
init_idh_tables (&idh);
diff --git a/src/lid.c b/src/lid.c
index d06a146..b1d0fdf 100644
--- a/src/lid.c
+++ b/src/lid.c
@@ -240,7 +240,7 @@ usage (void)
{
fprintf (stderr, _("Try `%s --help' for more information.\n"),
program_name);
- exit (1);
+ exit (EXIT_FAILURE);
}
static void __attribute__((__noreturn__))
@@ -288,7 +288,7 @@ matched identifier followed by the list of file names in which it occurs.\n\
"),
(separator_style == ss_braces ? _("braces") : _("space")));
printf (_("\nReport bugs to " PACKAGE_BUGREPORT "\n\n"));
- exit (0);
+ exit (EXIT_SUCCESS);
}
int
@@ -411,7 +411,7 @@ main (int argc, char **argv)
if (show_version)
{
printf ("%s - %s\n", program_name, PACKAGE_VERSION);
- exit (0);
+ exit (EXIT_SUCCESS);
}
if (show_help)
@@ -440,7 +440,7 @@ main (int argc, char **argv)
/* Look for the ID database up the tree */
idh.idh_file_name = locate_id_file_name (idh.idh_file_name);
if (idh.idh_file_name == 0)
- error (1, errno, _("can't locate `ID'"));
+ error (EXIT_FAILURE, errno, _("can't locate `ID'"));
init_idh_obstacks (&idh);
init_idh_tables (&idh);
@@ -477,7 +477,7 @@ main (int argc, char **argv)
}
fclose (idh.idh_FILE);
- exit (0);
+ exit (EXIT_SUCCESS);
}
static void
@@ -582,7 +582,7 @@ report_grep (char const *name, struct file_link **flinkv)
{
char buf[BUFSIZ];
regerror (regcomp_errno, &compiled, buf, sizeof (buf));
- error (1, 0, "%s", buf);
+ error (EXIT_FAILURE, 0, "%s", buf);
}
}
}
@@ -608,7 +608,7 @@ report_grep (char const *name, struct file_link **flinkv)
{
int regexec_errno = regexec (&compiled, line, 0, 0, 0);
if (regexec_errno == REG_ESPACE)
- error (1, 0,
+ error (EXIT_FAILURE, 0,
_("can't match regular-expression: memory exhausted"));
else if (regexec_errno)
continue;
@@ -733,7 +733,7 @@ report_edit (char const *name, struct file_link **flinkv)
case 'q':
putchar (c);
putchar ('\n');
- exit (0);
+ exit (EXIT_SUCCESS);
case 'n':
putchar (c);
@@ -767,7 +767,7 @@ editit:
switch (fork ())
{
case -1:
- error (1, errno, _("can't fork"));
+ error (EXIT_FAILURE, errno, _("can't fork"));
break;
case 0:
@@ -915,7 +915,7 @@ query_regexp (char const *pattern_0, report_func_t report_func)
{
char buf[BUFSIZ];
regerror (regcomp_errno, &compiled, buf, sizeof (buf));
- error (1, 0, "%s", buf);
+ error (EXIT_FAILURE, 0, "%s", buf);
}
fseek (idh.idh_FILE, idh.idh_tokens_offset, SEEK_SET);
diff --git a/src/mkid.c b/src/mkid.c
index 658a7e1..cbee3de 100644
--- a/src/mkid.c
+++ b/src/mkid.c
@@ -290,7 +290,7 @@ main (int argc, char **argv)
if (show_version)
{
printf ("%s - %s\n", program_name, PACKAGE_VERSION);
- exit (0);
+ exit (EXIT_SUCCESS);
}
if (show_help)
@@ -486,12 +486,12 @@ assert_writeable (char const *filename)
{
char *dirname = dir_name (filename);
if (access (dirname, 06) < 0)
- error (1, errno, _("can't create `%s' in `%s'"),
+ error (EXIT_FAILURE, errno, _("can't create `%s' in `%s'"),
base_name (filename), dirname);
free(dirname);
}
else
- error (1, errno, _("can't modify `%s'"), filename);
+ error (EXIT_FAILURE, errno, _("can't modify `%s'"), filename);
}
}
@@ -699,7 +699,7 @@ write_id_file (struct idhead *idhp)
printf (_("Writing `%s'...\n"), idhp->idh_file_name);
idhp->idh_FILE = fopen (idhp->idh_file_name, "w+b");
if (idhp->idh_FILE == NULL)
- error (1, errno, _("can't create `%s'"), idhp->idh_file_name);
+ error (EXIT_FAILURE, errno, _("can't create `%s'"), idhp->idh_file_name);
idhp->idh_magic[0] = IDH_MAGIC_0;
idhp->idh_magic[1] = IDH_MAGIC_1;
@@ -767,7 +767,7 @@ write_id_file (struct idhead *idhp)
write_idhead (&idh);
if (ferror (idhp->idh_FILE) || fclose (idhp->idh_FILE) != 0)
- error (1, errno, _("error closing `%s'"), idhp->idh_file_name);
+ error (EXIT_FAILURE, errno, _("error closing `%s'"), idhp->idh_file_name);
}
/* Define primary and secondary hash and comparison functions for the
diff --git a/src/xtokid.c b/src/xtokid.c
index 8c0b906..cff5a08 100644
--- a/src/xtokid.c
+++ b/src/xtokid.c
@@ -103,7 +103,7 @@ The following arguments apply to the language-specific scanners:\n\
"));
language_help_me ();
printf (_("\nReport bugs to " PACKAGE_BUGREPORT "\n\n"));
- exit (0);
+ exit (EXIT_SUCCESS);
}
int