diff options
Diffstat (limited to 'src/program/program.c')
-rw-r--r-- | src/program/program.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/src/program/program.c b/src/program/program.c index 51757a2..09650ec 100644 --- a/src/program/program.c +++ b/src/program/program.c @@ -10,9 +10,15 @@ struct Source* extract_source(char *src_name) file=fopen(src_name,"r"); if(file==NULL) - return NULL; + { + fprintf(stderr,"Could not open source file. "); + exit(1); + } if(fseek(file,0L,SEEK_END)!=0) - return NULL; + { + fprintf(stderr,"Could not open source file. "); + exit(1); + } ret=malloc(sizeof(struct Source)); ret->src_size=ftell(file); @@ -42,6 +48,9 @@ struct Options* parse_command_line(int argc,char **argv) ret->src_name=NULL; ret->output_name=NULL; ret->is_quiet=0; + ret->providing_own_queue_implementation=0; + ret->providing_own_buffer_implementation=0; + ret->has_mutex=0; for(i=0;i<argc;++i) { @@ -51,6 +60,12 @@ struct Options* parse_command_line(int argc,char **argv) ret->target=OPTION_TARGET_AST; else if(!strncmp(argv[i],"--print-c",sizeof("--print-c"))) ret->target=OPTION_TARGET_C; + else if(!strncmp(argv[i],"--extern-queue",sizeof("--extern-queue"))) + ret->providing_own_queue_implementation=1; + else if(!strncmp(argv[i],"--extern-buffer",sizeof("--extern-buffer"))) + ret->providing_own_buffer_implementation=1; + else if(!strncmp(argv[i],"--extern-mutex",sizeof("--extern-mutex"))) + ret->has_mutex=1; else if(!strncmp(argv[i],"-o",sizeof("-o")) || !strncmp(argv[i],"--output",sizeof("--output"))) { if(++i<argc) @@ -59,19 +74,23 @@ struct Options* parse_command_line(int argc,char **argv) ret->output_name=argv[i]; else if(!ret->is_quiet) { - fprintf(stderr,"Error: Output filename is too long"); + fprintf(stderr,"Error: Output filename is too long\n"); exit(1); }else { exit(1); } } + }else if(argv[i][0]=='-') + { + fprintf(stderr,"Error: Invalid command line option %s\n",argv[i]); + exit(1); }else if(strnlen(argv[i],101)<100) { ret->src_name=argv[i]; }else if(!ret->is_quiet) { - fprintf(stderr,"Error: Input filename is too long"); + fprintf(stderr,"Error: Input filename is too long\n"); exit(1); }else { |