src/utils/faCmp/faCmp.c 1.8
1.8 2009/11/13 21:33:25 markd
use different exit code when differences are detected to make it easy to use in scripts
Index: src/utils/faCmp/faCmp.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/utils/faCmp/faCmp.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -b -B -U 4 -r1.7 -r1.8
--- src/utils/faCmp/faCmp.c 30 Jan 2008 23:11:27 -0000 1.7
+++ src/utils/faCmp/faCmp.c 13 Nov 2009 21:33:25 -0000 1.8
@@ -23,8 +23,14 @@
" -peptide - read as peptide sequences\n"
"default:\n"
" no masking information is used during compare. It is as if both\n"
" sequences were not masked.\n"
+ "\n"
+ "Exit codes:\n"
+ " - 0 if files are the same\n"
+ " - 1 if files differ\n"
+ " - 255 on an error\n"
+ "\n"
);
}
/* command line options and values */
static struct optionSpec optionSpecs[] =
@@ -81,9 +87,12 @@
slSort(&bList, faSortByName);
}
if (aCount != bCount)
- errAbort("%d sequences in %s, %d in %s", aCount, aFile, bCount, bFile);
+ {
+ fprintf(stderr, "%d sequences in %s, %d in %s\n", aCount, aFile, bCount, bFile);
+ exit(1);
+ }
for (a = aList, b = bList; a != NULL && b != NULL; a = a->next, b = b->next)
{
verbose(2, "comparing %s to %s\n",a->name, b->name);
if (a->size != b->size)
@@ -109,9 +118,12 @@
}
if (errCount == 0)
fprintf(stderr, "%s and %s are the same\n", aFile, bFile);
else
- errAbort("%s and %s have %d sequences that differ", aFile, bFile, errCount);
+ {
+ fprintf(stderr, "%s and %s have %d sequences that differ\n", aFile, bFile, errCount);
+ exit(1);
+ }
}
int main(int argc, char *argv[])
/* Process command line. */