diff options
author | Michal Krol <[email protected]> | 2009-09-04 08:16:14 +0200 |
---|---|---|
committer | Michal Krol <[email protected]> | 2009-09-07 10:11:56 +0200 |
commit | c42428c787aae4bc560adf507991f1e274407135 (patch) | |
tree | 9b7dcf0574db5839014645a920b0551cd0a29230 /src/glsl | |
parent | f9bd6f7152047e6230c85d76e412a5bb524e0413 (diff) |
glsl: Print out error message in apps/process.
Diffstat (limited to 'src/glsl')
-rw-r--r-- | 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 abcf1a92b83..d01294f3407 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: |