Module: Mesa
Branch: glsl-pp-rework-1
Commit: 27e223a49881b99bc2627c349e3603fe46202840
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=27e223a49881b99bc2627c349e3603fe46202840

Author: Michal Krol <[email protected]>
Date:   Fri Sep  4 08:16:14 2009 +0200

glsl: Print out error message in apps/process.

---

 src/glsl/apps/process.c |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/glsl/apps/process.c b/src/glsl/apps/process.c
index abcf1a9..d01294f 100644
--- a/src/glsl/apps/process.c
+++ b/src/glsl/apps/process.c
@@ -104,21 +104,24 @@ main(int argc,
       return -1;
    }
 
-   if (sl_pp_process(&context, &tokens[tokens_eaten], &outtokens)) {
+   out = fopen(argv[2], "wb");
+   if (!out) {
       sl_pp_context_destroy(&context);
       free(tokens);
-      return -1;
+      return 1;
    }
 
-   free(tokens);
+   if (sl_pp_process(&context, &tokens[tokens_eaten], &outtokens)) {
+      fprintf(out, "$ERROR: `%s'\n", context.error_msg);
 
-   out = fopen(argv[2], "wb");
-   if (!out) {
       sl_pp_context_destroy(&context);
-      free(outtokens);
-      return 1;
+      free(tokens);
+      fclose(out);
+      return -1;
    }
 
+   free(tokens);
+
    for (i = 0; outtokens[i].token != SL_PP_EOF; i++) {
       switch (outtokens[i].token) {
       case SL_PP_NEWLINE:

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to