IMHW400@INDYVAX.BITNET (07/19/88)
Due to a mounting pile of requests, I'm posting the following little goody. (It allows you to log a job in under the current UIC, controlled by another terminal. We use it to get our operators logged in automagically at boot time.) By the way: what is considered a reasonable level of demand, when deciding whether to post software to the whole list? $!..................... Cut between dotted lines and save ...................... $!.............................................................................. $! VAX/VMS archive file created by VMS_SHAR V-5.01 01-Oct-1987 $! which was written by Michael Bednarek (U3369429@ucsvc.dn.mu.oz.au) $! To unpack, simply save and execute (@) this file. $! $! This archive was created by IMHW400 $! on Thursday 28-APR-1988 09:21:57.25 $! $! It contains the following 7 files: $! AAAREADME.LIS LOGIN-OPERATOR.COM LOGIN.C LOGIN.CLD LOGIN.OPT $! MAKE-OPERATOR.COM MAKEFILE. $!============================================================================== $ Set Symbol/Scope=(NoLocal,NoGlobal) $ Version=F$GetSYI("VERSION") ! See what VMS version we have here: $ If Version.ges."V4.4" then goto Version_OK $ Write SYS$Output "Sorry, you are running VMS ",Version, - ", but this procedure requires V4.4 or higher." $ Exit 44 $Version_OK: CR[0,8]=13 $ Pass_or_Failed="failed!,passed." $ Goto Start $Convert_File: $ Read/Time_Out=0/Error=No_Error1/Prompt="creating ''File_is'" SYS$Command ddd $No_Error1: Define/User_Mode SYS$Output NL: $ Edit/TPU/NoSection/NoDisplay/Command=SYS$Input/Output='File_is' - VMS_SHAR_DUMMY.DUMMY f:=Get_Info(Command_Line,"File_Name");b:=Create_Buffer("",f); o:=Get_Info(Command_Line,"Output_File");Set(Output_File,b,o); Position(Beginning_of(b));Loop x:=Erase_Character(1);Loop ExitIf x<>"V"; Move_Vertical(1);x:=Erase_Character(1);Append_Line; Move_Horizontal(-Current_Offset);EndLoop;Move_Vertical(1); ExitIf Mark(None)=End_of(b) EndLoop;Position(Beginning_of(b));Loop x:=Search("`",Forward,Exact);ExitIf x=0;Position(x);Erase_Character(1); If Current_Character='`' then Move_Horizontal(1);else Copy_Text(ASCII(INT(Erase_Character(3))));EndIf;EndLoop;Exit; $ Delete VMS_SHAR_DUMMY.DUMMY;* $ Checksum 'File_is $ Success=F$Element(Check_Sum_is.eq.CHECKSUM$CHECKSUM,",",Pass_or_Failed)+CR $ Read/Time_Out=0/Error=No_Error2/Prompt=" CHECKSUM ''Success'" SYS$Command ddd $No_Error2: Return $Start: $ File_is="AAAREADME.LIS" $ Check_Sum_is=692465409 $ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY XThis package contains the LOGIN program, which logs in an interactive job Xon a designated terminal. Also included is a sample application: our XSYSTARTUP.COM calls MAKE-OPERATOR.COM once for each operator terminal that Xwe run, so that the operators are logged in automatically when the VAX is Xbooted. Note the following subtleties: X Xo`009The designated terminal must be available to the created job. Usually X`009this means that the job's owner must be the terminal's owner. See X`009the sample application. X Xo`009The image should be INSTALLed /PRIVILEGE=ALTPRI; otherwise, since it X`009runs in batch, batch queue priority limits may be applied. X X*sigh* Neither the author nor the University makes any representations Xregarding the fitness of the attached software for any particular purpose. XThe software is offered "as-is". The software may be distributed freely Xso long as the author's name and organization are not removed from the source, Xbut may not be sold or incorporated into a commercial product. X XMark H. Wood XIMHW400@INDYVAX.BITNET $ GoSub Convert_File $ File_is="LOGIN-OPERATOR.COM" $ Check_Sum_is=1732211413 $ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY X$!`009Procedure to automagically log in an operator on a specified terminal. X$!`009The terminal is parameter 1. X$!`009M. H. Wood, 8-Jul-1987 X$! X$!`009MHW, 13-Jan-1987`009Use new LOGIN program instead of running X$!`009`009`009`009LOGINOUT directly X$! X$ SET COMMAND SYS$SYSTEM:LOGIN X$ LOGIN 'P1' $ GoSub Convert_File $ File_is="LOGIN.C" $ Check_Sum_is=89090868 $ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY X#module LOGIN X X/* X**++ X** FACILITY: X** X** Log a job in on a specified terminal X** X** ABSTRACT: X** X** LOGIN creates an interactive job for the current user, attached to a X**`009specified terminal. X** X** AUTHORS: X** X** Mark H. Wood X**`009Indiana University - Purdue University at Indianapolis X** X** X** CREATION DATE: 21-Dec-1987 X** X** MODIFICATION HISTORY: X** X**`00904-Mar-1988 MHW`009Pass base priority by value, not by reference, so X**`009`009`009we get it right (no more prio-zero OPERATORs!) X**-- X**/ X X X/* X** X** INCLUDE FILES X** X**/ X X#include descrip X#include jpidef X#include prcdef X#include stdio X#include string X X X/* X** X** MACRO DEFINITIONS X** X**/ X X#define failure(expr)`009( ! success(expr)) X#define success(expr)`009((expr) & 1) X#define`009UAI$_PRI`00947 X`012 X/* X**++ X** FUNCTIONAL DESCRIPTION: X** X** main procedure X** X** FORMAL PARAMETERS: X** X** none X** X** IMPLICIT INPUTS: X** X** job is logged in as the current user X** X** IMPLICIT OUTPUTS: X** X** none X** X** COMPLETION CODES: X** X** various by system services and routines X** X** SIDE EFFECTS: X** X** a job is created and attached to a terminal X** X**-- X**/ Xmain() X{ X static const $DESCRIPTOR(terminal_dx,"TERMINAL"); X static const $DESCRIPTOR(loginout_dx,"SYS$SYSTEM:LOGINOUT.EXE"); X static unsigned long status, pid, baspri; X static const unsigned long`009jpi_username = JPI$_USERNAME; X static struct dsc$descriptor X`009usrnam_dx = { 0, DSC$K_DTYPE_T, DSC$K_CLASS_D, 0 }, X`009tty_dx = { 0, DSC$K_DTYPE_T, DSC$K_CLASS_D, 0 }; X static struct item X`009`009 { X`009`009 unsigned short`009buffer_length, item_code; X`009`009 unsigned long`009buffer_address, return_length_address; X`009`009 }`009getuai_items[] = { X`009`009`009`009`009 { X`009`009`009`009`009`009sizeof(baspri), X`009`009`009`009`009`009UAI$_PRI, X`009`009`009`009`009`009&baspri, X`009`009`009`009`009`0090 X`009`009`009`009`009 }, X`009`009`009`009`009 { 0, 0, 0, 0 } X`009`009`009`009`009 }; X X if failure(status = LIB$GETJPI(&jpi_username,0,0,0,&usrnam_dx)) X`009return status; X if failure(status = CLI$GET_VALUE(&terminal_dx,&tty_dx)) X`009return status; X if failure(status = SYS$GETUAI(0,0,&usrnam_dx,&getuai_items,0,0,0)) X`009return status; X status = SYS$CREPRC( X`009`009`009&pid, X`009`009`009&loginout_dx, X`009`009`009&tty_dx, X`009`009`009&tty_dx, X`009`009`0090,0,0,0, X`009`009`009baspri, X`009`009`0090,0, X`009`009`009PRC$M_DETACH | PRC$M_INTER | PRC$M_NOPASSWORD X`009`009`009); X if success(status) printf("Created process %08lX",pid); X return status; X} $ GoSub Convert_File $ File_is="LOGIN.CLD" $ Check_Sum_is=72104534 $ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY XDEFINE VERB LOGIN X`009PARAMETER P1, X`009`009LABEL=TERMINAL, X`009`009PROMPT="Terminal", X`009`009VALUE(REQUIRED) $ GoSub Convert_File $ File_is="LOGIN.OPT" $ Check_Sum_is=1046437521 $ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY XSYS$LIBRARY:VAXCRTL/SHAREABLE $ GoSub Convert_File $ File_is="MAKE-OPERATOR.COM" $ Check_Sum_is=756558069 $ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY X$!`009Procedure to automagically create an OPERATOR job at boot time. X$!`009MHW, 8-Jul-1987 X$!`009MHW, 21-Sep-1987`009Only do one job, on terminal spec'd by parm X$!`009MHW, 1-Oct-1987`009`009Allow colons in P1 value, since we need them X$! X$ ASSIGN/USER 'P1' SYS$COMMAND`009`009! So operators don't need SECURITY X$ REPLY/ENABLE=SECURITY`009`009`009! but see security alarms X$ SET PROTECTION=OWNER=RWLP/DEVICE 'P1'/OWNER_UIC=[OPERATOR] X$ SUBMIT SYS$MANAGER:LOGIN-OPERATOR - X`009/AFTER="+00:00:20" - X`009/LOG_FILE=SYS$SYSDEVICE:[OPERATOR]LOGIN.LOG - X`009/PARAMETERS=('P1') - X`009/USER=OPERATOR $ GoSub Convert_File $ File_is="MAKEFILE." $ Check_Sum_is=878401162 $ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY XLOGIN : LOGIN.EXE LOGIN.CLD X`009PURGE *.EXE,*.OBJ X XLOGIN.EXE : LOGIN.OBJ LOGIN.OPT X`009LINK LOGIN.OBJ,LOGIN.OPT/OPT X XLOGIN.OBJ : LOGIN.C UAIDEF.H $ GoSub Convert_File $ Exit $!..................... Cut between dotted lines and save ...................... ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Mark H. Wood IMHW400@INDYVAX.BITNET (317)274-0749 III U U PPPP U U III Indiana University - Purdue University at Indianapolis I U U P P U U I 799 West Michigan Street, ET 1023 I U U PPPP U U I Indianapolis, IN 46202 USA I U U P U U I [@disclaimer@] III UUU P UUU III