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.
This commit is contained in:
Timothe Litt
2023-04-11 11:55:37 -04:00
parent 6d42eb35fd
commit 6d66f3b9d2
4 changed files with 16 additions and 9 deletions

View File

@@ -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;

View File

@@ -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 */

View File

@@ -65,6 +65,7 @@ GLOBERR <unknown error !UL processing !AZ> /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 <failed to create directory !AZ> /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 <can not specify both !AZallocate and !AZtruncate> /FAO=2
.END
.FACILITY HELP,92 /SHARED
.END
.FACILITY HELP,92
.SEVERITY INFO
@@ -484,11 +488,6 @@ VHDNOTVALID <the VHD library !AZ is not usable> /FAO=1
.END
.FACILITY MOUNT,95 /SHARED
.LITERAL MOUNT_OFFSET = (95) ! 0x00000058 Warning
.END
.FACILITY MOUNT,95
.SEVERITY INFO

View File

@@ -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