C+ C NAME: C iOSGetForeign C CATEGORY: C Machine-dependent functions: VMS C PURPOSE: C Get command line arguments as single string C CALLING SEQUENCE: function iOSGetForeign(L,cStr) C INPUTS: C (none) C OUTPUTS: C cStr character*(*) command line string C L integer useful length of cStr (=itrim(cStr)) C iOSGetForeign integer 0: no command line string (--> L=0) C 1: command line string present (L > 0) C PROCEDURE: C Calls system function lib$get_foreign C MODIFICATION HISTORY: C SEP-1999, Paul Hick (UCSD/CASS; pphick@ucsd.edu); Added documentation C- integer L character cStr*(*) iOSGetForeign = mod(lib$get_foreign(cStr,,L),2) return end C+ C NAME: C iOSSpawnCmd C PURPOSE: C Execute a single shell command C CATEGORY: C Machine-dependent functions: VMS C CALLING SEQUENCE: function iOSSpawnCmd(Cmd,iNoWait) C INPUTS: C Cmd character*(*) DCL shell command C iNoWait integer if iNoWait > 0 then the calling program will not C wait for the lib$spawn to exit. C OUTPUTS: C iOSSpawnCmd integer 0: error executing command C 1: command executed succesully C CALLS: C itrim C PROCEDURE: C Calls system function lib$spawn. C The error status is determined from the return value of the lib$spawn call. C MODIFICATION HISTORY: C SEP-1999, Paul Hick (UCSD/CASS; pphick@ucsd.edu); Added documentation C- character Cmd*(*) integer iNoWait iOSSpawnCmd = itrim(Cmd) if (iOSSpawnCmd .gt. 0) then if (iNoWait .ge. 0) then iOSSpawnCmd = lib$spawn(Cmd(:iOSSpawnCmd),'NL:','NL:',iNoWait) else iOSSpawnCmd = lib$spawn(Cmd(:iOSSpawnCmd)) end if iOSSpawnCmd = mod(iOSSpawnCmd,2) end if return end C+ C NAME: C OSExitCmd C PURPOSE: C Terminate program execution. Set an exit code for external use. C CATEGORY: C Machine-dependent functions: VMS C CALLING SEQUENCE: subroutine OSExitCmd(Cmd,iCode) C INPUTS: C Cmd character*(*) shell command passed to lib$do_command C iCode integer error code passed to EXIT function C OUTPUTS: C (none) C PROCEDURE: C > Calls system functions lib$do_command and EXIT C > The lib$do_command terminates the program and executes the cDo command C at the level of calling procedure. Probably the execution of cDo C determines the error status in this case, NOT iCode. ???? C > If the cDo string is empty or the lib$do_command fails to terminate the C program, then the error code iCode is passed to EXIT. C MODIFICATION HISTORY: C SEP-1999, Paul Hick (UCSD/CASS; pphick@ucsd.edu); Added documentation C- character Cmd*(*) integer iCode I = iCode if (Cmd .ne. ' ') then I = mod(lib$do_command(Cmd),2) if (iCode .ne. 999) I = iCode else I = iCode end if call EXIT(I) return end C+ C NAME: C iOSSetDirectory C PURPOSE: C Change to a new working directory C CATEGORY: C Machine-dependent functions: VMS C CALLING SEQUENCE: function iOSSetDirectory(cDir) C INPUTS: C cDir character*(*) (incomplete) directory name C OUTPUTS: C iOSSetDirectory C integer 0: change of directory failed C 1: change of directory successful C CALLS: C iSetFileSpec, iGetFileSpec, iSetLogical, Say C INCLUDE: include 'filparts.h' C RESTRICTIONS: C Do NOT call this function directly. Use iSetDefaultDir.. C PROCEDURE: C Calls system function sys$setddir C Sets node, drive and directory C MODIFICATION HISTORY: C SEP-1999, Paul Hick (UCSD/CASS; pphick@ucsd.edu); Added documentation C- character cDir*(*) character cTmp*(FIL__LENGTH) integer sys$setddir iOSSetDirectory = iSetFileSpec(cDir) iOSSetDirectory = iGetFileSpec(0,FIL__DEVICE,cTmp) if (iOSSetDirectory .eq. 0) call Say('iOSSetDirectory','E','NODEV','No device specified') if (iSetLogical('SYS$DISK',cTmp(:iOSSetDirectory),'P') .eq. 0) & call Say('iOSSetDirectory','E','SETDEV','Failed setting new device') iOSSetDirectory = iGetFileSpec(FIL__DIRECTORY,FIL__DIRECTORY,cTmp) if (iOSSetDirectory .eq. 0) call Say('iOSSetDirectory','E','NODIR','No directory specified') iOSSetDirectory = mod(sys$setddir(cTmp(:iOSSetDirectory),,),2) return end C+ C NAME: C iOSDeleteFile C PURPOSE: C Delete a file C CATEGORY: C Machine-dependent functions: WIN-NT, Linux, Unix C CALLING SEQUENCE: function iOSDeleteFile(cFile) C INPUTS: C cFile character*(*) file to be deleted C OUTPUTS: C iOSDeleteFile integer 0: delete failed C 1: delete successful C PROCEDURE: C Input is passed unmodified to system function lib$delete_file. C Return status is determined from lib$delete_file exit status. C MODIFICATION HISTORY: C SEP-1999, Paul Hick (UCSD/CASS; pphick@ucsd.edu); Added documentation C- character cFile*(*) iOSDeleteFile = mod(lib$delete_file(cFile),2) return end C+ C NAME: C iOSRenameFile C PURPOSE: C Rename a file C CATEGORY: C Machine-dependent functions: WIN-NT C CALLING SEQUENCE: function iOSRenameFile(cFile1,cFile2) C INPUTS: C cFile1 character*(*) file to be renamed C cFile2 character*(*) new file name C OUTPUTS: C iOSRenameFile integer 0: rename failed C 1: rename successful C PROCEDURE: C Input is passed unmodified to system function lib$rename_file. C Return status is determined from lib$rename_file exit status. C MODIFICATION HISTORY: C SEP-1999, Paul Hick (UCSD/CASS; pphick@ucsd.edu); Added documentation C- character cFile1*(*) character cFile2*(*) iOSRenameFile = mod(lib$rename_file(cFile1,cFile2),2) return end C+ C NAME: C iOSCopyFile C PURPOSE: C Copies a file C CATEGORY: C Machine-dependent functions: Win-NT, Linux, Unix C CALLING SEQUENCE: function iOSCopyFile(cFile1,cFile2) C INPUTS: C cFile1 character*(*) file to be copied C cFile2 character*(*) new file name C OUTPUTS: C iOSCopyFile integer 0: copy failed C 1: copy successful C PROCEDURE: C Calls system functions conv$pass_files, conv$pass_options, conv$convert C MODIFICATION HISTORY: C SEP-1999, Paul Hick (UCSD/CASS; pphick@ucsd.edu); Added documentation C- character cFile1*(*) character cFile2*(*) integer option /0/, & stsblk(5) /4,0,0,0,0/, & conv$pass_files, conv$pass_options, conv$convert iOSCopyFile = conv$pass_files(cFile1,cFile2) iOSCopyFile = conv$pass_options(option) iOSCopyFile = conv$convert(stsblk) iOSCopyFile = mod(iOSCopyFile,2) ! 0 (failure) or 1 (success) return end