Diffs of what was changed:
diff -u orig/access.h ./access.h
--- orig/access.h Fri Sep 7
16:38:07 2001
+++ ./access.h Sat Feb 8 23:05:27 2003
@@ -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 -u orig/makefile.unix ./makefile.unix
--- orig/makefile.unix Thu Sep 27 02:40:14 2001
+++ ./makefile.unix Sat Feb 8 23:06:24
2003
@@ -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 -u orig/ods2.c ./ods2.c
--- orig/ods2.c Fri Sep 7 23:17:04 2001
+++ ./ods2.c Tue Aug 10 22:43:23 2004
@@ -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 */
@@ -315,7 +317,7 @@
nam.nam$b_rss =
NAM$C_MAXRSS;
fab.fab$l_fop =
FAB$M_NAM;
while ((sts =
sys_search(&fab)) & 1) {
- sts
= sys_open(&fab);
+ sts =
sys_open(&fab);
if ((sts & 1) == 0) {
printf("%%COPY-F-OPENFAIL, Open error: %d\n",sts);
perror("-COPY-F-ERR ");
@@ -1004,27 +1006,40 @@
/* 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 @@
/* 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;
i<argc; i++) {
+
if (command_line==NULL) {
+
command_line=malloc(1);
+
*command_line = '\0';
+
l= 1;
+
}
+
l+= strlen(argv[i]);
+
command_line= realloc(command_line,l+1);
+
strcat (command_line, argv[i]);
+
command_line[l-1]= ' ';
+
command_line[l++]= '\0';
+ }
+ if
(l>1)
+
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<sizeof str && command_line[i]; i++)
+
if (command_line[i]=='$') {
+
++i;
+
break;
+
} else str[j++]= command_line[i];
+
if (j<sizeof str)
+
str[j]= '\0';
+
else str[j-1]= '\0';
+
if (command_line[i]=='\0')
+
command_line= realloc(command_line,0);
+ } else
+{
if (atfile != NULL) {
if (fgets(str,sizeof(str),atfile) == NULL) {
fclose(atfile);
@@ -1098,7 +1165,8 @@
if (gets(str) == NULL) break;
#endif
}
- ptr = str;
+}
+ ptr = str;
while (*ptr == ' ' ||
*ptr == '\t') ptr++;
if (strlen(ptr)
&& *ptr != '!') {
if (*ptr == '@') {
diff -u orig/phyunix.c ./phyunix.c
--- orig/phyunix.c Thu Sep 27 11:00:42
2001
+++ ./phyunix.c Sat Feb 8 23:06:54 2003
@@ -15,7 +15,7 @@
*/
#include <stdio.h>
-#include <strings.h>
+#include <string.h>
#include <unistd.h>
#include <fcntl.h>
diff -u orig/update.c ./update.c
--- orig/update.c Thu Sep 27
08:52:06 2001
+++ ./update.c Sat Feb 8 23:05:50 2003
@@ -19,7 +19,7 @@
/* 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