From a446a7a3cee3c5af8cc6d08985c458156b797153 Mon Sep 17 00:00:00 2001 From: Markus Hoffmann Date: Mon, 15 Feb 2016 15:44:21 +0100 Subject: [PATCH 1/2] Introduced a new commandline option -f to omit the GFA version check. It looks like that at least the version 1,2,3 files can already be processed fine. So I converted the error message into a warning and inform about the -f option. --- .gitignore | 5 +++++ Makefile | 4 ++-- gfalist.c | 46 ++++++++++++++++++++++++++++------------------ sky.c | 2 +- sky.h | 1 + 5 files changed, 37 insertions(+), 21 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bf65d48 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +*.o +gfalist +gfalist_*.deb +libsky.a +version.h diff --git a/Makefile b/Makefile index 916c17d..3fdeaaf 100644 --- a/Makefile +++ b/Makefile @@ -59,8 +59,8 @@ libsky.a: $(SKY_OBJS) # $(AR) rcv $@ $*.o # rm $*.o -gfalist: $(GFALIST_OBJS) - $(CC) $(LFLAGS) $+ -o $@ -lsky +gfalist: $(GFALIST_OBJS) libsky.a + $(CC) $(LFLAGS) $+ -o $@ libsky.a gfalist.exe: $(CSRC) $(WINCC) $+ -o $@ gfalist.ttp: $(CSRC) diff --git a/gfalist.c b/gfalist.c index 47b3007..0b5afb6 100644 --- a/gfalist.c +++ b/gfalist.c @@ -28,7 +28,7 @@ static unsigned char *rvsimp(struct gfainf *gi, unsigned short type, { static unsigned char vbuf[11]; /* vffff_ffff\0 */ unsigned char *dst = vbuf; - char *src = vbuf; + char *src = (char *)vbuf; sprintf(src, "v%x_%x", type, var); while (*src != '\0') switch (*src++) { @@ -113,23 +113,31 @@ static void process(char *name, FILE *ost, char *file, unsigned int flags) if ((flags & TP_VERB) != 0x00) output(" Processing DI-Block\n"); - gf4tp_getdi(&gi, dibuf); - - /* Cannot process files older than version 4 yet. */ - switch (gh.vers) { - case 1: - case 2: - case 3: - output("Version %d files not supported yet.\n", gh.vers); - if (ist != stdin) - fclose(ist); + /* Check GFA Version. */ + + if((flags&TP_FORCE)==0) { + /* Cannot process files older than version 4 yet. */ + switch (gh.vers) { + case 1: + case 2: + case 3: + output("WARNING: Version %d files not supported yet.\n", gh.vers); + output("If you want to try anyways, please restart gfalist with the -f option.\n"); + if(ist!=stdin) fclose(ist); + return; + case 70: + output("WARNING: GF%.14s files not supported yet.\n", gh.mag); + output("If you want to try anyways, please restart gfalist with the -f option.\n"); + if(ist!=stdin) fclose(ist); return; - case 70: - output("GF%.14s files not supported yet.\n", gh.mag); - if (ist != stdin) - fclose(ist); + default: + output("ERROR: GFA file version: %d is unknown and not supported!\n",gh.vers); + output("If you want to try anyways, please restart gfalist with the -f option.\n"); + if(ist!=stdin) fclose(ist); return; + } } + gf4tp_getdi(&gi, dibuf); cnt = gh.sep[16] - gh.sep[0]; @@ -223,8 +231,7 @@ static void process(char *name, FILE *ost, char *file, unsigned int flags) fclose(ist); } -int main(int argc, char *argv[]) -{ +int main(int argc, char *argv[]) { extern char *optarg; extern int optind, opterr, optopt; const char *outfile = NULL; @@ -235,7 +242,7 @@ int main(int argc, char *argv[]) gf4tp_init(output, rvsimp); - while ((opt = getopt(argc, argv, "o:vctVbih")) != -1) + while ((opt = getopt(argc, argv, "o:vctVbihf")) != -1) switch (opt) { case 'o': /* Output */ if (outfile != NULL) { @@ -247,6 +254,9 @@ int main(int argc, char *argv[]) case 'b': /* Bug emulation */ flags |= TP_BUGEM; break; + case 'f': /* force (do not check for GFA version) */ + flags |= TP_FORCE; + break; case 'v': /* Verbose */ flags |= TP_VERB; break; diff --git a/sky.c b/sky.c index 64f31a7..cdf4920 100644 --- a/sky.c +++ b/sky.c @@ -570,7 +570,7 @@ unsigned char *gf4tp_tp(unsigned char *dst, struct gfainf *gi, src += 8; copy64b(u.ull, dcb); - dcs = dst; + dcs = (char *)dst; sprintf(dcs, "%G", u.d); while (*dcs != '\0') switch (*dcs++) { diff --git a/sky.h b/sky.h index 90e7c23..29331b2 100644 --- a/sky.h +++ b/sky.h @@ -14,6 +14,7 @@ #define TP_TIME 0x08 /* Measure time */ #define TP_BUGEM 0x10 /* Emulate bugs */ #define TP_SAVEINLINE 0x20 /* Save INLINE data into .inl files */ +#define TP_FORCE 0x40 /* do not check for GFA version */ struct gfahdr { unsigned char resvd:7; From 686b07b2e02d48cc5397867e8b0c81de8748ff60 Mon Sep 17 00:00:00 2001 From: Markus Hoffmann Date: Wed, 19 Jun 2019 09:45:49 +0200 Subject: [PATCH 2/2] Update man-page --- gfalist.1 | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/gfalist.1 b/gfalist.1 index 1236dfb..2522414 100644 --- a/gfalist.1 +++ b/gfalist.1 @@ -1,12 +1,12 @@ -.TH gfalist 1 "06 May 2003" +.TH GFALIST 1 "06 May 2003" "GFA-List" .SH NAME gfalist - Reads tokenized GFA BASIC version 3.x source files (.GFA) and converts them to human readable ASCII listings (.LST). .SH SYNOPSIS .B gfalist -\fR[\fB-o lstfile\fR] +\fR[\fB-o\fR \fIlstfile\fR] .RB [ -vcthi ] -.RI gfafile +.I gfafile .SH DESCRIPTION Reads an .gfa file as input. Produces a .lst (ASCII) @@ -14,23 +14,39 @@ file as output. .SH OPTIONS .TP -.BI "\-o " file +.BR \-o " " \fIfile\fR Place output in file \c .I file\c \&. INLINE data will not be saved. .TP -.BI "\-i " -Save INLINE data into separate files, named after the pointers, ending .inl. +.BR \-b +bug emulation. .TP -.B -h,--help +.BR \-c +conversion. +.TP +.BR \-f +force +.B gfalist +to process the input file even when it is not the correct GFA-Basic version. +.TP +.BR \-i +save INLINE data into separate files, named after the pointers, ending .inl. +.TP +.BR \-h ", " \-\-help ", " \-V makes .B gfalist print a short usage information and exit. .TP -.B -v,--verbose +.BR \-t +timer. +.TP +.BR \-v ", " \-\-verbose +make .B gfalist -prints information about its processing on Standard Error. +print information about its processing to \fIstderr\fR. +.PP For detailed help and description of the implemented commands take a look at the README file and manual which comes with the gfalist package.