diff --git a/extracters/ods2/access.h b/extracters/ods2/access.h index 31c2b18..43dc909 100644 --- a/extracters/ods2/access.h +++ b/extracters/ods2/access.h @@ -14,7 +14,7 @@ #include "cache.h" #include "vmstime.h" -#ifdef BIG_ENDIAN +#ifdef USE_BIG_ENDIAN #define VMSLONG(l) ((l & 0xff) << 24 | (l & 0xff00) << 8 | (l & 0xff0000) >> 8 | l >> 24) #define VMSWORD(w) ((w & 0xff) << 8 | w >> 8) #define VMSSWAP(l) ((l & 0xff0000) << 8 | (l & 0xff000000) >> 8 |(l & 0xff) << 8 | (l & 0xff00) >> 8) diff --git a/extracters/ods2/makefile.unix b/extracters/ods2/makefile.unix index 6a3c0d8..5d123dd 100644 --- a/extracters/ods2/makefile.unix +++ b/extracters/ods2/makefile.unix @@ -1,12 +1,12 @@ -CCFLAGS = "-g" +CCFLAGS = -O4 DEFS = "-DVERSION=\"v1.3\"" all : ods2 ods2 : ods2.o rms.o direct.o update.o access.o device.o phyunix.o cache.o vmstime.o - cc $(CCFLAGS) -oods2 ods2.o rms.o direct.o update.o access.o device.o phyunix.o cache.o vmstime.o + cc $(CCFLAGS) -o ods2 ods2.o rms.o direct.o update.o access.o device.o phyunix.o cache.o vmstime.o vmstime.o : vmstime.c vmstime.h cc -c $(CCFLAGS) $(DEFS) vmstime.c diff --git a/extracters/ods2/ods2.c b/extracters/ods2/ods2.c index 7e456a1..57fd955 100644 --- a/extracters/ods2/ods2.c +++ b/extracters/ods2/ods2.c @@ -1,5 +1,7 @@ #define MODULE_NAME ODS2 -#define MODULE_IDENT "V1.3" +#define MODULE_IDENT "V1.3hb" + +/* Jul-2003, v1.3hb, some extensions by Hartmut Becker */ /* Ods2.c v1.3 Mainline ODS2 program */ @@ -1004,27 +1006,40 @@ int cmdexecute(int argc,char *argv[],int qualc,char *qualv[]) /* cmdsplit: break a command line into its components */ +/* + * New feature for Unix: '//' stops qualifier parsing (similar to '--' + * for some Unix tools). This enables us to copy to Unix directories. + * copy /bin // *.com /tmp/* + * is split into argv[0] -> "*.com" argv[1] -> "/tmp/*" qualv[0]-> "/bin" + */ + int cmdsplit(char *str) { int argc = 0,qualc = 0; char *argv[32],*qualv[32]; char *sp = str; int i; + char q = '/'; for (i = 0; i < 32; i++) argv[i] = qualv[i] = ""; while (*sp != '\0') { while (*sp == ' ') sp++; if (*sp != '\0') { - if (*sp == '/') { + if (*sp == q) { *sp++ = '\0'; + if (*sp == q) { + sp++; + q = '\0'; + continue; + } qualv[qualc++] = sp; } else { argv[argc++] = sp; } - while (*sp != ' ' && *sp != '/' && *sp != '\0') sp++; + while (*sp != ' ' && *sp != q && *sp != '\0') sp++; if (*sp == '\0') { break; } else { - if (*sp != '/') *sp++ = '\0'; + if (*sp != q) *sp++ = '\0'; } } } @@ -1073,13 +1088,65 @@ char *getcmd(char *inp, char *prompt) /* main: the simple mainline of this puppy... */ +/* + * Parse the command line to read and execute commands: + * ./ods2 mount scd1 $ set def [hartmut] $ copy *.com $ exit + * '$' is used as command delimiter because it is a familiar character + * in the VMS world. However, it should be used surounded by white spaces; + * otherwise, a token '$copy' is interpreted by the Unix shell as a shell + * variable. Quoting the whole command string might help: + * ./ods2 'mount scd1 $set def [hartmut] $copy *.com $exit' + * If the ods2 reader should use any switches '-c' should be used for + * the command strings, then quoting will be required: + * ./ods2 -c 'mount scd1 $ set def [hartmut] $ copy *.com $ exit' + * + * The same command concatenation can be implemented for the prompted input. + * As for indirect command files (@), it isn't checked if one of the chained + * commands fails. The user has to be careful, all the subsequent commands + * are executed! + */ + int main(int argc,char *argv[]) { char str[2048]; + char *command_line = NULL; FILE *atfile = NULL; + char *p; printf(" ODS2 %s\n", MODULE_IDENT); + if (argc>1) { + int i, l=0; + for (i=1; i1) + command_line[l-2]= '\0'; + } else command_line==NULL; while (1) { char *ptr; + if (command_line) { + static int i=0; + int j=0; + for (; j -#include +#include #include #include diff --git a/extracters/ods2/update.c b/extracters/ods2/update.c index 6e47013..c9f61cb 100644 --- a/extracters/ods2/update.c +++ b/extracters/ods2/update.c @@ -19,7 +19,7 @@ struct VCBDEV *rvn_to_dev(struct VCB *vcb,unsigned rvn); /* Bitmaps get accesses in 'WORK_UNITs' which can be an integer on a little endian machine but must be a byte on a big endian system */ -#ifdef BIG_ENDIAN +#ifdef USE_BIG_ENDIAN #define WORK_UNIT unsigned char #define WORK_MASK 0xff #else