From: SMTP%"RELAY-INFO-VAX@CRVAX.SRI.COM" 7-JUL-1994 14:31:19.52 To: EVERHART CC: Subj: Re: can you make a SETDEFAULT program in VAX-C? Date: Thu, 07 Jul 1994 11:52:35 +0100 From: Arne Vajhoej Subject: Re: can you make a SETDEFAULT program in VAX-C? To: york@NEPTUNE.ECE.SYR.EDU, INFO-VAX@SRI.COM Message-id: <01HEF9I5UP7696VKUZ@kopc.hhs.dk> X-VMS-To: IN%"york@NEPTUNE.ECE.SYR.EDU" X-VMS-Cc: IN::"INFO-VAX@SRI.COM" MIME-version: 1.0 Content-type: TEXT/PLAIN; CHARSET=ISO-8859-1 Content-transfer-encoding: 8BIT > I have seen many excellant "SET DEFAULT" programs (in DCL,MACRO, > FORTRAN, and PASCAL). But I would like to find (or write) one in VAX-C. > > Can this be done? Ofcourse it can ! > In PROGRAMING IN VAX-C manual, it says: > "For CHDIR() to be effective accrossed images, it > should be executed in SUPERVISOR, KERNAL, or > EXECUTIVE mode." > > OK, so how do I change modes? Via the system-services SYS$CMEXEC or SYS$CMKRNL, but it is in general not safe to call C RTL routines from other than user mode (but many many of them will actual work). It is much better to use the same routines (SYS$SETDDIR and LIB$SET_LOGICAL) that the programs written in other languages. > Also, I did not see any calls to modify the PROMPT, For a unpriviliged program then terminate the program with a LIB$DO_COMMAND that sets the prompt. > nor to create > GLOBAL SYMBOLs (for PUSHDIR/POPDIR functions). The routines LIB$SET_SYMBOL and LIB$GET_SYMBOL can be used for global symbols too. PS: You will see much of this demonstrated in a small utility available via anonymous FTP from KOPC.HHS.DK - see description attached below. (but it is FORTRAN not C) Arne Arne Vajhøj local DECNET: KO::ARNE Computer Department PSI: PSI%238310013040::ARNE Business School of Southern Denmark Internet: ARNE@KO.HHS.DK ================================================================================ [.SETPMT]SETPMT.ZIP Description : changes the prompt to current directory whenever current directory is changed via DCL (and that is always the case unless some programs calls SYS$SETDDIR themselves). No privs required. Source : FORTRAN Binary : OBJ's and EXE's in SETPMT_BIN.ZIP (compiled with FORTRAN 6.1 and linked on VMS 5.5-2) Notes : needs VERB or VMS 5.5 (VAX only) Posted : not