use macros for exit codes

Tue, 23 Aug 2016 12:06:46 +0200

author
Mike Becker <universe@uap-core.de>
date
Tue, 23 Aug 2016 12:06:46 +0200
changeset 38
77c158821738
parent 37
1a67185e5496
child 39
ac35daceb24c

use macros for exit codes

src/c2html.c file | annotate | diff | comparison | revisions
--- a/src/c2html.c	Tue Aug 23 12:05:41 2016 +0200
+++ b/src/c2html.c	Tue Aug 23 12:06:46 2016 +0200
@@ -244,7 +244,7 @@
                 break;
             case 'h':
                 printhelp();
-                return 0;
+                return EXIT_SUCCESS;
             case 'v':
             case 'V':
 #ifdef VERSION_DEVELOP
@@ -252,9 +252,9 @@
 #else
                 printf("%d.%d\n", VERSION_MAJOR, VERSION_MINOR);
 #endif
-                return 0;
+                return EXIT_SUCCESS;
             default:
-                return 1;
+                return EXIT_FAILURE;
         }
     }
 
@@ -268,7 +268,7 @@
             fout = fopen(settings.outfilename, "w");
             if (!fout) {
                 perror("Error opening output file");
-                return -1;
+                return EXIT_FAILURE;
             }
         } else {
             fout = stdout;
@@ -276,7 +276,7 @@
         
         if (copyfile(settings.headerfile, fout)) {
             perror("Error opening header file");
-            retcode = -1;
+            retcode = EXIT_FAILURE;
             goto prog_end;
         }
         
@@ -308,12 +308,12 @@
             freeinputfilebuffer(inputfile);
         } else {
             perror("Error opening input file");
-            retcode = -1;
+            retcode = EXIT_FAILURE;
         }
         
         if (copyfile(settings.footerfile, fout)) {
             perror("Error opening footer file");
-            retcode = -1;
+            retcode = EXIT_FAILURE;
         }
         
         prog_end:        

mercurial