[AD] Patches for runner.c, runnergw.c and msvchelp.c to make it easier to identify the app producing an error

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


I have made some changes to runner.c, runnergw.c and msvchelp.c to make it easier to identify the app producing the error-message when doing a build.

If one of the apps produces an error-message, it includes the app-name in the error-message. This makes it easier to find out which app produced the error-message. runnergw also encloses the filename in quotes, and msvchelp also prints the filename if it needs to print an error-message.

AE.


--- msvchelp.c.old	2005-01-16 22:54:08.000000000 +0100
+++ msvchelp.c	2006-12-22 12:38:52.400515200 +0100
@@ -3,6 +3,10 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+
+#define MAKEFILE_HELPER_FILENAME "makefile.helper"
+
+
 int main(int argc, char *argv[])
 {
     char shortfilename[MAX_PATH];
@@ -11,37 +15,37 @@
     FILE *fout;
     
     if (argc != 2) {
-        fprintf(stderr, "No argument given!\n");
+        fprintf(stderr, "msvchelp: No argument given!\n");
         return 1;
     }
     
     longfilename = getenv(argv[1]);
     if (longfilename == NULL) {
-        fprintf(stderr, "Given argument does not correspond to any enviroment variable name!\n");
+        fprintf(stderr, "msvchelp: Given argument does not correspond to any enviroment variable name!\n");
         return 2;
     }
     
     ret = GetShortPathName(longfilename, shortfilename, MAX_PATH);
     if (ret == 0 || ret > MAX_PATH) {
-        fprintf(stderr, "Cannot convert to short name!\n");
+        fprintf(stderr, "msvchelp: Cannot convert to short name!\n");
         return 3;
     }
     
-    fout = fopen("makefile.helper", "wt");
+    fout = fopen(MAKEFILE_HELPER_FILENAME, "wt");
     if (fout == NULL) {
-        fprintf(stderr, "Cannot create output file!\n");
+        fprintf(stderr, "msvchelp: Cannot create output file '%s'!\n", MAKEFILE_HELPER_FILENAME);
         return 4;
     }
     
     ret = fprintf(fout, "%s = %s\n", argv[1], shortfilename);
     if (ret < 0) {
-        fprintf(stderr, "Cannot write to the output file!\n");
+        fprintf(stderr, "msvchelp: Cannot write to the output file '%s'!\n", MAKEFILE_HELPER_FILENAME);
         return 5;
     }
     
     ret = fclose(fout);
     if (ret != 0) {
-        fprintf(stderr, "Cannot close the output file!\n");
+        fprintf(stderr, "msvchelp: Cannot close the output file '%s'!\n", MAKEFILE_HELPER_FILENAME);
         return 6;
     }
     
--- runner.c.old	2004-07-05 00:44:50.000000000 +0200
+++ runner.c	2006-12-22 11:50:47.722552000 +0100
@@ -46,7 +46,7 @@
 	    f = fopen("_tmpfile.arg", "w");
 
 	    if (!f) {
-	       printf("Error writing _tmpfile.arg\n");
+	       printf("runner: Error writing _tmpfile.arg\n");
 	       return 1;
 	    }
 	 }
@@ -90,7 +90,7 @@
    p = strchr(buf, ' ');
    if (p) {
       if (strlen(p) >= 126) {
-	 fprintf(stderr, "Runner oops: command line is longer than 126 characters!\n");
+	 fprintf(stderr, "runner: oops: command line is longer than 126 characters!\n");
 	 remove("_tmpfile.arg");
 	 return 1; 
       }
--- runnergw.c.old	2004-07-05 00:44:50.000000000 +0200
+++ runnergw.c	2006-12-22 11:40:13.801017600 +0100
@@ -21,7 +21,7 @@
    for (i=1; i < argc; i++) {
       if (argv[i][0] == '@') {
          if ((file=fopen(argv[i]+1, "r")) == NULL) {
-            fprintf(stderr, "Unable to open %s.\n", argv[i]);
+            fprintf(stderr, "runnergw: Unable to open '%s'.\n", argv[i]);
             exit(EXIT_FAILURE);
          }
 


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/