$! $! Hack to update various source files for VMS. $! $! Currently: cardrdr.c, dasdls.c, hetlib.c, hscutl.c, panel.c, $! hostopts.h, hmacros.h $! $! P1 = Input file $! P2 = Output file (new version of input file if not specified) $! $ $ tab[0,8] = 9 $ If F$TrnLnm("Input") .Nes. "" Then Close Input $ If F$TrnLnm("Output") .Nes. "" Then Close Output $ $ InputFile = P1 $ OutputFile = P2 $ $ Version = F$Parse(OutputFile, , , "Version") $ $ If OutputFile .Eqs. "" Then OutputFile = InputFile $ $ Node = F$Parse(OutputFile, , , "Node") $ Device = F$Parse(OutputFile, , , "Device") $ Directory = F$Parse(OutputFile, , , "Directory") $ Name = F$Parse(OutputFile, , InputFile, "Name") $ Type = F$Parse(OutputFile, , InputFile, "Type") $ $ OutputFile = Node + Device + Directory + Name + Type + Version $ $ Open /Read Input 'InputFile' $ Create 'OutputFile' $ Open /Append Output 'OutputFile' $ $ Loop: $ $ Read Input Line /End=Eof $ $ If Name .Eqs. "HOSTOPTS" $ Then $ $ If F$Element(2, " ", F$Edit(Line, "Compress,Trim,Upcase")) .Eqs. "OTHER" .And. - F$Element(3, " ", F$Edit(Line, "Compress,Trim,Upcase")) .Eqs. "(DEFAULT)" $ Then $ Write Output "/* Hard-coded VMS-specific features and options... */" $ Write Output "/*-------------------------------------------------------------------*/" $ Write Output "#elif defined(__VMS) /* VMS options */" $ Write Output "/* Similar to OTHER with minor differences */" $ Write Output "" $ Write Output "#define DLL_IMPORT extern /* (a safe default) */" $ Write Output "#define DLL_EXPORT" $ Write Output "" $ Write Output "#undef TUNTAP_IFF_RUNNING_NEEDED /* (NO tuntap support) */" $ Write Output "#undef OPTION_SCSI_TAPE /* (NO SCSI tape support) */" $ Write Output "#undef OPTION_SCSI_ERASE_TAPE /* (NOT supported) */" $ Write Output "#undef OPTION_SCSI_ERASE_GAP /* (NOT supported) */" $ Write Output "#undef OPTION_FBA_BLKDEVICE /* (no FBA BLKDEVICE support)*/" $ Write Output "" $ Write Output "#define MAX_DEVICE_THREADS 0 /* (0 == unlimited) */" $ Write Output "#undef MIXEDCASE_FILENAMES_ARE_UNIQUE /* (""Foo"" same as ""fOo""!!) */" $ Write Output "" $ Write Output "#define DEFAULT_HERCPRIO 0" $ Write Output "#define DEFAULT_TOD_PRIO -20" $ Write Output "#define DEFAULT_CPU_PRIO 15" $ Write Output "#define DEFAULT_DEV_PRIO 8" $ Write Output "#define DEFAULT_SRV_PRIO 4" ! Only required in Hyperion $ Write Output "" $ Write Output "#if defined( HAVE_FORK )" $ Write Output " #define HOW_TO_IMPLEMENT_SH_COMMAND USE_FORK_API_FOR_SH_COMMAND" $ Write Output "#else" $ Write Output " #define HOW_TO_IMPLEMENT_SH_COMMAND USE_ANSI_SYSTEM_API_FOR_SH_COMMAND" $ Write Output "#endif" $ Write Output "#define SET_CONSOLE_CURSOR_SHAPE_METHOD CURSOR_SHAPE_NOT_SUPPORTED" $ Write Output "#undef OPTION_EXTCURS /* Normal cursor handling */" $ Write Output "" $! The following is only required for Hyperion new message system and new telnet server $ Write Output "#define va_copy(To, From) (To) = (From) /* Must be before hmacros.h */" $ Write Output "" $ Write Output "/*-------------------------------------------------------------------*/" $ Endif $ $ Write Output Line $ $ Endif $ $ If Name .Eqs. "HMACROS" $ Then $ $ If F$Element(0, "(", F$Element(1, " ", F$Edit(Line, "Compress,Trim"))) .Eqs. "close_pipe" .And. - F$Element(0, "(", F$Element(2, " ", F$Edit(Line, "Compress,Trim"))) .Eqs. "closesocket" $ Then $ Write Output Line $ Write Output "#elif defined( __VMS ) $ Write Output " #define create_pipe(a) socketpair(AF_INET,SOCK_STREAM,IPPROTO_IP,a)" $ Write Output " #define read_pipe(f,b,n) recv(f,b,n,0)" $ Write Output " #define write_pipe(f,b,n) send(f,b,(int)n,0)" $ Write Output " #define close_pipe(f) close(f)" $ Else $ Write Output Line $ Endif $ $ Endif $ $ If Name .Eqs. "PANEL" $ Then $ $ If F$Element(0, " ", F$Edit(Line, "Compress,Trim")) .Eqs. "#define" .And. - F$Element(1, " ", F$Edit(Line, "Compress,Trim")) .Eqs. "PANEL_MAX_ROWS" $ Then $ Write Output "#ifdef __VMS" $ Write Output "#include " $ Write Output "#endif /* __VMS */" $ Write Output "" $ Endif $ $ If F$Edit(Line, "Compress,Trim") .Eqs. "#ifndef _MSVC_" $ Then $ Write Output "#if !defined( _MSVC_ ) && !defined( __VMS )" $ Read Input Line /End=Eof $ Endif $ $ If F$Edit(Line, "Compress,Trim") .Eqs. "#endif // _MSVC_" $ Then $ Write Output "#endif // !_MSVC_ && !__VMS" $ Write Output "#ifdef __VMS" $ Write Output " int efn, status, lib$signal(), lib$get_ef(), sys$assign(), vms_getch();" $ Write Output " short channel;" $ Write Output " $DESCRIPTOR(input, ""SYS$COMMAND:"");" $ Write Output "#endif /* __VMS */" $ Read Input Line /End=Eof $ Endif $ $ If F$Element(1, " ", F$Edit(Line, "Compress,Trim,Upcase")) .Eqs. "NOTIFY" .And. - F$Element(2, " ", F$Edit(Line, "Compress,Trim,Upcase")) .Eqs. "LOGGER_THREAD" $ Then $ Write Output "#ifdef __VMS" $ Write Output "" $ Write Output " /* Reserve an event flag for calling sys$qiow in vms_getch() */" $ Write Output "" $ Write Output " status = lib$get_ef(&efn);" $ Write Output " if (!(status & 1)) lib$signal(status);" $ Write Output "" $ Write Output " /* Assign a channel to sys$command for vms_getch() */" $ Write Output "" $ Write Output " status = sys$assign(&input, &channel, 0, 0);" $ Write Output " if (!(status & 1)) lib$signal(status);" $ Write Output "" $ Write Output "#endif /* __VMS */" $ Write Output "" $ Endif $ $ If F$Edit(Line, "Compress,Trim") .Eqs. "#else // !defined( _MSVC_ )" $ Then $ Write Output "#elif defined( __VMS )" $ Write Output " /* Wait for keyboard input */" $ Write Output "#define WAIT_FOR_KEYBOARD_INPUT_SLEEP_MILLISECS (20)" $ Write Output " for (i=sysblk.panrate/WAIT_FOR_KEYBOARD_INPUT_SLEEP_MILLISECS;" $ Write Output " i && !(kbbuf[0] = vms_getch(efn, channel)); i--)" $ Write Output " usleep(WAIT_FOR_KEYBOARD_INPUT_SLEEP_MILLISECS * 1000);" $ Write Output "" $ Write Output " ADJ_SCREEN_SIZE();" $ Write Output "" $ Write Output " /* If keyboard input has [finally] arrived, then process it */" $ Write Output " if ( kbbuf[0] )" $ Write Output " {" $ Write Output " kbbuf[kblen=1] = '\0';" $ Write Output " translate_keystroke( kbbuf, &kblen );" $ Write Output "" $ Write Output "#else // !defined( _MSVC_ ) && !defined( __VMS )" $ Read Input Line /End=Eof $ Endif $ $ If F$Edit(Line, "Compress,Trim") .Eqs. "#endif // defined( _MSVC_ )" $ Then $ Write Output "#endif // defined( _MSVC_ ) || defined( __VMS )" $ Read Input Line /End=Eof $ Endif $ $ Write Output Line $ $ Endif $ $ If Name .Eqs. "CARDRDR" $ Then $ $ If F$Element(2, " ", F$Edit(Line, "Compress,Trim")) .Eqs. "HOPEN" $ Then $ Write Output "#ifdef __VMS" $ Write Output " rc = HOPEN (dev->filename, O_RDONLY | O_BINARY, 0);" $ Write Output "#else /* __VMS */" $ Write Output Line $ Write Output "#endif /* __VMS */" $ Read Input Line /End=Eof $ Endif $ $ If F$Element(2, " ", F$Edit(Line, "Compress,Trim")) .Eqs. "fdopen(dev->fd," $ Then $ Write Output "#ifdef __VMS" $ Write Output " dev->fh = fdopen(dev->fd, ""r"");" $ Write Output "#else /* __VMS */" $ Write Output Line $ Write Output "#endif /* __VMS */" $ Write Output "" $ Write Output " if (dev->fh == NULL)" $ Write Output " {" $ Write Output " /* Something went wrong with fdopen */" $ Write Output "" $ Write Output " logmsg (_(""XHCRD020E Error calling fdopen on file %s: %s\n"")," $ Write Output " dev->filename, strerror(errno));" $ Write Output "" $ Write Output " /* Set unit check with equipment check */" $ Write Output " dev->sense[0] = SENSE_EC;" $ Write Output " *unitstat = CSW_CE | CSW_DE | CSW_UC;" $ Write Output " return -1;" $ Write Output " }" $ Write Output "" $ Read Input Line /End=Eof $ Endif $ $ Write Output Line $ $ Endif $ $ If Name .Eqs. "DASDLS" $ Then $ $ If F$Element(0, "(", F$Edit(Line, "Compress,Trim")) .Eqs. ": printf" $ Then $ Line = " : (void) printf(runflgs & rf_caldate ? "" ---------""" $ Endif $ $ Write Output Line $ $ Endif $ $ If Name .Eqs. "HETLIB" $ Then $ $ Word0 = F$Element(0, " ", F$Edit(Line, "Compress,Trim")) $ Word2 = F$Element(2, " ", F$Edit(Line, "Compress,Trim")) $ If Word0 .Eqs. "omode" .And. (Word2 .Eqs. """r+b"";" .Or. Word2 .Eqs. """rb"";") $ Then $ Write Output "#ifdef __VMS" $ Write Output Line - "b" $ Write Output "#else /* __VMS */" $ Write Output Line $ Write Output "#endif /* __VMS */" $ Read Input Line /End=Eof $ Endif $ $ Write Output Line $ $ Endif $ $ If Name .Eqs. "HSCUTL" $ Then $ $ If F$Edit(Line, "Compress,Trim") .Eqs. "int flags = fcntl( sfd, F_GETFL );" $ Then $ Write Output "" $ Write Output "#ifdef __VMS" $ Write Output "" $ Write Output " int non_blocking = !blocking_mode;" $ Write Output "" $ Write Output " return ioctl( sfd, FIONBIO, &non_blocking);" $ Write Output "" $ Write Output "#else /* __VMS */" $ Write Output "" $ Endif $ $ If F$Edit(Line, "Compress,Trim") .Eqs. "return fcntl( sfd, F_SETFL, flags );" $ Then $ Write Output Line $ Write Output "" $ Write Output "#endif /* __VMS */" $ Write Output "" $ Read Input Line /End=Eof $ Endif $ $ Write Output Line $ $ Endif $ Goto Loop $ $ Eof: $ $ Close Input $ Close Output $