summaryrefslogtreecommitdiffstats
path: root/src
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 /src
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 'src')
-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
5 files changed, 24 insertions, 24 deletions
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