In this section, we will report some common problems encountered when porting a C program to a VMS environment and which we have not mentioned previously.
Under VMS, one can use two flavors of command interpreters: DCL and DEC/Shell. The syntax of file specifications under DCL differs significantly from the Unix syntax.
Some C run-time library functions in VMS that take file specifications as arguments or return file specifications to the caller, will accept an additional argument indicating which syntax is preferred. It is useful to use these run-time library functions via macros as follows:
#ifdef VMS # ifndef VMS_CI /* Which Command Interpreter to use */ # define VMS_CI 0 /* 0 for DEC/Shell, 1 for DCL */ # endif # define Getcwd(buff,siz) getcwd((buff),(siz),VMS_CI) # define Getname(fd,buff) getname((fd),(buff),VMS_CI) # define Fgetname(fp,buff) fgetname((fp),(buff),VMS_CI) #else /* !VMS */ # define Getcwd(buff,siz) getcwd((buff),(siz)) # define Getname(fd,buff) getname((fd),(buff)) # define Fgetname(fp,buff) fgetname((fp),(buff)) #endif /* !VMS */
More pitfalls await the unaware who accept file specifications from the user or take them from environment values (e.g., using the getenv function).
The easiest solution is to force the linker to add the module using the /INCLUDE command modifier. Of course, there is the possibility that the command line may exceed 256 characters...(*sigh*).
contents
Using Floating-Point Numbers
General Guidelines