From 6d66f3b9d2b0299dbed61b40bff41135346815a7 Mon Sep 17 00:00:00 2001 From: Timothe Litt Date: Tue, 11 Apr 2023 11:55:37 -0400 Subject: [PATCH] ODS2: Fix options_t signedness & handling options_t is assumed to be unsigned in several places, but was defined as an int32_t. I don't remember why, but if something breaks, it'll be fixed there. In particular, several commands assumed an unsigned right shift to extract fields from options... Also, remove newlines from host text records copied to FILES-11 when RMS provides (or expects) suitable dellimiters: FIX, VAR, and VFC. UDF, and STREAM* retain them. --- extracters/ods2/copycmd.c | 10 +++++++++- extracters/ods2/ods2.h | 2 +- extracters/ods2/ssdef.msg | 11 +++++------ extracters/ods2/version.h | 2 +- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/extracters/ods2/copycmd.c b/extracters/ods2/copycmd.c index 1961e09..193b193 100644 --- a/extracters/ods2/copycmd.c +++ b/extracters/ods2/copycmd.c @@ -1043,6 +1043,7 @@ static vmscond_t copy_to( options_t options, int argc, char **argv ) { static vmscond_t copy_1_to( options_t options, char *from, char *to ) { vmscond_t sts; size_t records = 0, bufsize = 80; + int keepnl = 0; char *buf = NULL; FILE *fromf; struct FAB fab; @@ -1166,6 +1167,13 @@ static vmscond_t copy_1_to( options_t options, char *from, char *to ) { case FAB$C_STMLF: case FAB$C_STMCR: fab.fab$b_rat |= FAB$M_CR; + keepnl = 1; + break; + case FAB$C_UDF: + keepnl = 1; + break; + default: + keepnl - 0; break; } @@ -1278,7 +1286,7 @@ static vmscond_t copy_1_to( options_t options, char *from, char *to ) { buf = NULL; break; } - while( (rab.rab$l_rbf = fgetline( fromf, TRUE, &buf, &bufsize )) != NULL ) { + while( (rab.rab$l_rbf = fgetline( fromf, keepnl, &buf, &bufsize )) != NULL ) { size_t len; char * rp; diff --git a/extracters/ods2/ods2.h b/extracters/ods2/ods2.h index 3fb8c83..8fc01b2 100644 --- a/extracters/ods2/ods2.h +++ b/extracters/ods2/ods2.h @@ -113,6 +113,6 @@ typedef uint32_t vmscond_t; #define OPT_NOSORT ((options_t)(1u << 31)) -typedef int32_t options_t; +typedef uint32_t options_t; #endif /* #ifndef _ODS2_H */ diff --git a/extracters/ods2/ssdef.msg b/extracters/ods2/ssdef.msg index 218555b..320fcef 100644 --- a/extracters/ods2/ssdef.msg +++ b/extracters/ods2/ssdef.msg @@ -65,6 +65,7 @@ GLOBERR /FAO=2 .FACILITY CREATE,86 /SHARED + .LITERAL CREATE_OFFSET = (86) ! 0x00000050 Warning .LITERAL CREATE_CLOSEOUT = ((CREATE_FACILITY@16) + SHR$_ILLDESQUE + 2) ! 0x085612d2 Error .LITERAL CREATE_CREATED = ((CREATE_FACILITY@16) + SHR$_ILLDIRCOPY + 3) ! 0x085612eb Info .LITERAL CREATE_EXISTS = ((CREATE_FACILITY@16) + SHR$_INSVIRMEM + 3) ! 0x085612f3 Info @@ -90,7 +91,6 @@ CREDIRFAIL /FAO=1 .FACILITY DELETE,87 /SHARED - .LITERAL DELETE_OFFSET = (87) ! 0x00000050 Warning .LITERAL DELETE_OPENIN = ((DELETE_FACILITY@16) + SHR$_FILDEL) ! 0x08571320 Warning .END @@ -273,6 +273,10 @@ CONFLQUAL /FAO=2 .END + .FACILITY HELP,92 /SHARED + + .END + .FACILITY HELP,92 .SEVERITY INFO @@ -484,11 +488,6 @@ VHDNOTVALID /FAO=1 .END - .FACILITY MOUNT,95 /SHARED - .LITERAL MOUNT_OFFSET = (95) ! 0x00000058 Warning - - .END - .FACILITY MOUNT,95 .SEVERITY INFO diff --git a/extracters/ods2/version.h b/extracters/ods2/version.h index bbbfc5f..6b20410 100644 --- a/extracters/ods2/version.h +++ b/extracters/ods2/version.h @@ -27,7 +27,7 @@ #ifdef DEBUG_BUILD #define MODULE_IDENT "Debug build" #else -#define MODULE_IDENT "V3.0" +#define MODULE_IDENT "V3.0.2" #endif #define MODULE_NAME ODS2