$! ************************************************* $! * JOBS012_PACKAGE.COM $! * This command procedure will extract all source modules required $! * to create the JOBS012 package. After extracting the files, $! * this procedure will optionally execute the BUILD.COM command $! * procedure included with this package to compile the source files and $! * link the executable image. $! * $! * Created 4-APR-2000 by the PACKAGE utility $! ************************************************* $! $ Write SYS$OUTPUT "" $ Write SYS$OUTPUT "This procedure extracts and optionally builds the JOBS012 package." $ Write SYS$OUTPUT "All files will be extracted to ",F$Environment("Default") $ Write SYS$OUTPUT "" $ Call Extract_Files $ Write SYS$OUTPUT "" $ Get_Answer: $ Read/Error=Exit/Prompt="Do you wish to build the JOBS012 package? " - SYS$COMMAND Answer $ Answer = F$Extract(0,1,F$Edit(Answer,"Trim,UpCase")) $ If Answer .EQS. "N" Then Goto Exit $ If Answer .NES. "Y" Then Goto Get_Answer $ @BUILD.COM $ Exit: $ Exit $! $! $ Extract_Files: SubRoutine $ Call Extract_BUILD_COM $ Call Extract_CLI_C $ Call Extract_CLI_H $ Call Extract_JOBS_C $ Call Extract_JOBS_H $ Call Extract_JOBS_HLP $ Call Extract_JOBS_CLD_CLD $ Call Extract_MESSAGE_H $ Call Extract_MESSAGE_MSG $ Call Extract_PSCANDEF_H $ Call Extract_STATEDEF_H $ Call Extract_UTILS_C $ Call Extract_UTILS_H $ EndSubRoutine ! Extract_Files $! $! $! $ Extract_BUILD_COM: SubRoutine $ Write SYS$OUTPUT "Extracting BUILD.COM..." $ WO := Write OutFile $ SQ = "'" $ SQ2 = SQ + SQ $ Close/NoLog OutFile $ Open/Write/Share OutFile BUILD.COM $ WO "$! **********************************************************************" $ WO "$! * BUILD.COM *" $ WO "$! * (Re)build necessary modules and relink program. *" $ WO "$! * *" $ WO "$! * This is a generic ""make"" command procedure. Modify the section *" $ WO "$! * below with the following symbols: *" $ WO "$! * *" $ WO "$! * Image_Name = ""xxx.EXE"" - the name of the output image name *" $ WO "$! * Version = ""Vn.n"" - the version number of the product *" $ WO "$! * Object_List == """" - this symbol must be defined as null *" $ WO "$! * *" $ WO "$! * Then add or modify the ""Call"" lines for each module in the *" $ WO "$! * program: *" $ WO "$! * *" $ WO "$! * Call Compile_C filename.C ''SQ'P1''SQ' - for each C source module *" $ WO "$! * Call Message filename.MSG ''SQ'P1''SQ' - for each message source mod *" $ WO "$! * Call CLD filename.CLD ''SQ'P1''SQ' - for each CLD source module *" $ WO "$! * *" $ WO "$! * BUILD will recompile only those modules which have changed *" $ WO "$! * since last compile and relink the image. *" $ WO "$! * *" $ WO "$! * If you specify ""ALL"" as parameter P1, all source modules are *" $ WO "$! * unconditionally recompiled. *" $ WO "$! * *" $ WO "$! * 18-DEC-1996 RDJ Command Procedure Creation. *" $ WO "$! **********************************************************************" $ WO "$!" $ WO "$ Object_List == """"" $ WO "$ Image_Name = ""JOBS.EXE""" $ WO "$ Version = ""V1.2""" $ WO "$!" $ WO "$ Call Compile_C JOBS.C ''SQ'P1''SQ'" $ WO "$ Call Compile_C UTILS.C ''SQ'P1''SQ'" $ WO "$ Call Compile_C CLI.C ''SQ'P1''SQ'" $ WO "$ Call Message MESSAGE.MSG ''SQ'P1''SQ'" $ WO "$ Call CLD JOBS_CLD.CLD ''SQ'P1''SQ'" $ WO "$!" $ WO "$! **************************************************************************" $ WO "$ Write SYS$OUTPUT ""Linking ",SQ2,"Image_Name''SQ'...""" $ WO "$ PID = F$GetJPI("""",""PID"")" $ WO "$ On Error Then Goto Cleanup" $ WO "$ If F$GetSyi(""Arch_Name"") .EQS. ""VAX""" $ WO "$ Then" $ WO "$ Close/NoLog OutFile" $ WO "$ Open/Write OutFile SYS$SCRATCH:BUILD_TMP.''SQ'PID''SQ'" $ WO "$ Write OutFile ""$ Link/Exec=",SQ2,"Image_Name''SQ'/NoTrace SYS$INPUT/Opt""" $ WO "$ Write OutFile """,SQ2,"Object_List''SQ',SYS$SHARE:VAXCRTL/Share""" $ WO "$ Write OutFile ""IDENTIFICATION=""""",SQ2,"Version''SQ'""""""" $ WO "$ Close OutFile" $ WO "$ @SYS$SCRATCH:BUILD_TMP.''SQ'PID''SQ'" $ WO "$ Else" $ WO "$ Close/NoLog OutFile" $ WO "$ Open/Write OutFile SYS$SCRATCH:BUILD_TMP.''SQ'PID''SQ'" $ WO "$ Write OutFile ""$ Link/Exec=",SQ2,"Image_Name''SQ'/NoTrace SYS$INPUT/Opt""" $ WO "$ Write OutFile Object_List" $ WO "$ Write OutFile ""IDENTIFICATION=""""",SQ2,"Version''SQ'""""""" $ WO "$ Close OutFile" $ WO "$ @SYS$SCRATCH:BUILD_TMP.''SQ'PID''SQ'" $ WO "$ EndIf" $ WO "$ Cleanup:" $ WO "$ Write SYS$OUTPUT ""Cleaning up..""" $ WO "$ If F$Search(""SYS$SCRATCH:BUILD_TMP.",SQ2,"PID''SQ'"") .NES. """" Then -" $ WO " Delete/NoLog/NoConfirm SYS$SCRATCH:BUILD_TMP.''SQ'PID''SQ';*" $ WO "$ Purge/NoLog/NoConfirm *.OBJ" $ WO "$ Purge/NoLog/NoConfirm *.EXE" $ WO "$ Exit" $ WO "$!" $ WO "$! **********************************************************************" $ WO "$! * Compile_C: Compile a ''SQ'C''SQ' source module. *" $ WO "$! **********************************************************************" $ WO "$ Compile_C: SubRoutine" $ WO "$ If Object_List .EQS. """"" $ WO "$ Then" $ WO "$ Object_List == F$Parse(P1,,,""Name"")" $ WO "$ Else" $ WO "$ Object_List == Object_List + "","" + F$Parse(P1,,,""Name"")" $ WO "$ EndIf" $ WO "$ If P2 .EQS. ""ALL"" Then Goto Compile_It" $ WO "$ O_File = F$Parse(P1,,,""Name"") + "".OBJ""" $ WO "$ If F$Search(""",SQ2,"O_File''SQ'"") .EQS. """" Then Goto Compile_It" $ WO "$ Object_Date = F$CvTime(F$File_Attributes(O_File,""RDT""),""Comparison"")" $ WO "$ Source_Date = F$CvTime(F$File_Attributes(P1,""RDT""),""Comparison"")" $ WO "$ If Source_Date .LTS. Object_Date" $ WO "$ Then" $ WO "$ Write SYS$OUTPUT """,SQ2,"P1''SQ' is up to date; skipping...""" $ WO "$ Exit" $ WO "$ EndIf" $ WO "$ Compile_It:" $ WO "$ Write SYS$OUTPUT ""Compiling ",SQ2,"P1''SQ'...""" $ WO "$ If F$GetSyi(""Arch_Name"") .EQS. ""VAX""" $ WO "$ Then" $ WO "$ CC/NoDebug ''SQ'P1''SQ'" $ WO "$ Else" $ WO "$ CC/NoDebug/Standard=VAXC ''SQ'P1''SQ'" $ WO "$ EndIf" $ WO "$ Exit" $ WO "$ EndSubRoutine" $ WO "$!" $ WO "$! **********************************************************************" $ WO "$! * Message: Compile a message module. *" $ WO "$! **********************************************************************" $ WO "$ Message: SubRoutine" $ WO "$ If Object_List .EQS. """"" $ WO "$ Then" $ WO "$ Object_List == F$Parse(P1,,,""Name"")" $ WO "$ Else" $ WO "$ Object_List == Object_List + "","" + F$Parse(P1,,,""Name"")" $ WO "$ EndIf" $ WO "$ If P2 .EQS. ""ALL"" Then Goto Compile_It" $ WO "$ O_File = F$Parse(P1,,,""Name"") + "".OBJ""" $ WO "$ If F$Search(""",SQ2,"O_File''SQ'"") .EQS. """" Then Goto Compile_It" $ WO "$ Object_Date = F$CvTime(F$File_Attributes(O_File,""RDT""),""Comparison"")" $ WO "$ Source_Date = F$CvTime(F$File_Attributes(P1,""RDT""),""Comparison"")" $ WO "$ If Source_Date .LTS. Object_Date" $ WO "$ Then" $ WO "$ Write SYS$OUTPUT """,SQ2,"P1''SQ' is up to date; skipping...""" $ WO "$ Exit" $ WO "$ EndIf" $ WO "$ Compile_It:" $ WO "$ Write SYS$OUTPUT ""Compiling ",SQ2,"P1''SQ'...""" $ WO "$ Message/Object ''SQ'P1''SQ'" $ WO "$ Exit" $ WO "$ EndSubRoutine" $ WO "$!" $ WO "$! **********************************************************************" $ WO "$! * CLD: Compile a CLD module. *" $ WO "$! **********************************************************************" $ WO "$ CLD: SubRoutine" $ WO "$ If Object_List .EQS. """"" $ WO "$ Then" $ WO "$ Object_List == F$Parse(P1,,,""Name"")" $ WO "$ Else" $ WO "$ Object_List == Object_List + "","" + F$Parse(P1,,,""Name"")" $ WO "$ EndIf" $ WO "$ If P2 .EQS. ""ALL"" Then Goto Compile_It" $ WO "$ O_File = F$Parse(P1,,,""Name"") + "".OBJ""" $ WO "$ If F$Search(""",SQ2,"O_File''SQ'"") .EQS. """" Then Goto Compile_It" $ WO "$ Object_Date = F$CvTime(F$File_Attributes(O_File,""RDT""),""Comparison"")" $ WO "$ Source_Date = F$CvTime(F$File_Attributes(P1,""RDT""),""Comparison"")" $ WO "$ If Source_Date .LTS. Object_Date" $ WO "$ Then" $ WO "$ Write SYS$OUTPUT """,SQ2,"P1''SQ' is up to date; skipping...""" $ WO "$ Exit" $ WO "$ EndIf" $ WO "$ Compile_It:" $ WO "$ Write SYS$OUTPUT ""Compiling ",SQ2,"P1''SQ'...""" $ WO "$ Set Command/Object ''SQ'P1''SQ'" $ WO "$ Exit" $ WO "$ EndSubRoutine" $ WO " $ Close/NoLog OutFile $ Exit $ EndSubRoutine ! Extract_BUILD_COM $! $ Extract_CLI_C: SubRoutine $ Write SYS$OUTPUT "Extracting CLI.C..." $ WO := Write OutFile $ SQ = "'" $ SQ2 = SQ + SQ $ Close/NoLog OutFile $ Open/Write/Share OutFile CLI.C $ WO "/************************************************************************" $ WO " * *" $ WO " * JOBS *" $ WO " * version 1.2 *" $ WO " * *" $ WO " * This software has been released into public domain and may be *" $ WO " * freely copied, distributed, and modified. This software is *" $ WO " * provided AS IS, free of charge. The author assumes no *" $ WO " * responsibility or liability for the use of this software. *" $ WO " * *" $ WO " ************************************************************************" $ WO " * Project: JOBS012 *" $ WO " * Module: CLI *" $ WO " ************************************************************************" $ WO " * Revision History *" $ WO " * *" $ WO " * 17-DEC-1996 RDJ Module completion. *" $ WO " ************************************************************************/" $ WO "#include " $ WO "#include " $ WO "#include " $ WO "#include " $ WO "#include " $ WO "#include " $ WO "#include " $ WO "#include " $ WO "#include " $ WO "#include ""cli.h""" $ WO "" $ WO "typedef enum {false,true} boolean;" $ WO "" $ WO "/************************************************************************" $ WO " * cli_parse_command_line: parse the CLI command line for correct *" $ WO " * syntax and set up for other command line parsing calls. *" $ WO " ************************************************************************/" $ WO "unsigned long cli_parse_command_line (command_name, command_module)" $ WO "char *command_name;" $ WO "long *command_module;" $ WO "{" $ WO " char command_buffer[256];" $ WO " $DESCRIPTOR (d_line, command_buffer);" $ WO " $DESCRIPTOR (d_cldline, command_buffer);" $ WO " unsigned long status;" $ WO " short int length;" $ WO " int command_length;" $ WO "" $ WO " sprintf (command_buffer, ""%s "", command_name);" $ WO " command_length = strlen(command_buffer);" $ WO " d_line.dsc$w_length = d_line.dsc$w_length - command_length;" $ WO " d_line.dsc$a_pointer = d_line.dsc$a_pointer + command_length;" $ WO " lib$get_foreign(&d_line,0,&length,0);" $ WO " command_buffer[length + command_length] = ''SQ'\0''SQ';" $ WO " d_cldline.dsc$w_length = length + command_length;" $ WO " status = cli$dcl_parse (&d_cldline,command_module,0,0,0);" $ WO " if (status == 196609)" $ WO " return (SS$_NORMAL);" $ WO " if (status == CLI$_ENTNF)" $ WO " return (SS$_NORMAL);" $ WO " exit (SS$_NORMAL);" $ WO "}" $ WO "" $ WO "" $ WO "" $ WO "" $ WO "" $ WO "/************************************************************************" $ WO " * cli_check_qualifier: search the command line for a specific *" $ WO " * qualifier and set a boolean status variable. *" $ WO " ************************************************************************/" $ WO "cli_check_qualifier (qualifier_name, status)" $ WO "char *qualifier_name; /* name of qualifier to check for */" $ WO "boolean *status; /* status variable */" $ WO "{" $ WO " $DESCRIPTOR (entity_desc,qualifier_name);" $ WO "" $ WO " entity_desc.dsc$w_length = strlen(qualifier_name);" $ WO " switch (cli$present (&entity_desc)) {" $ WO " case CLI$_PRESENT:" $ WO " case CLI$_DEFAULTED:" $ WO " *status = true;" $ WO " break;" $ WO " default:" $ WO " *status = false;" $ WO " }" $ WO "}" $ WO "" $ WO "" $ WO "" $ WO "" $ WO "" $ WO "/************************************************************************" $ WO " * cli_get_value: get the value of a command line entity. *" $ WO " ************************************************************************/" $ WO "unsigned long cli_get_value (entity, value)" $ WO "char *entity; /* entity to get value of */" $ WO "char *value; /* returned value */" $ WO "{" $ WO " $DESCRIPTOR (entity_desc,entity); /* descriptor for entity string */" $ WO " $DESCRIPTOR (value_desc,value); /* descriptor for value string */" $ WO " unsigned short value_length; /* length of returned value */" $ WO " unsigned long status; /* return status of cli$ call */" $ WO "" $ WO " entity_desc.dsc$w_length = strlen(entity);" $ WO " value_desc.dsc$w_length = 256;" $ WO " status = cli$get_value (&entity_desc,&value_desc,&value_length);" $ WO " value[value_length] = ''SQ'\0''SQ';" $ WO " return (status);" $ WO "}" $ WO "" $ WO " $ Close/NoLog OutFile $ Exit $ EndSubRoutine ! Extract_CLI_C $! $ Extract_CLI_H: SubRoutine $ Write SYS$OUTPUT "Extracting CLI.H..." $ WO := Write OutFile $ SQ = "'" $ SQ2 = SQ + SQ $ Close/NoLog OutFile $ Open/Write/Share OutFile CLI.H $ WO "/************************************************************************" $ WO " * *" $ WO " * JOBS *" $ WO " * version 1.2 *" $ WO " * *" $ WO " * This software has been released into public domain and may be *" $ WO " * freely copied, distributed, and modified. This software is *" $ WO " * provided AS IS, free of charge. The author assumes no *" $ WO " * responsibility or liability for the use of this software. *" $ WO " * *" $ WO " ************************************************************************" $ WO " * Project: JOBS012 *" $ WO " * Module: CLI *" $ WO " ************************************************************************" $ WO " * Revision History *" $ WO " * *" $ WO " * 17-DEC-1996 RDJ Module completion. *" $ WO " ************************************************************************/" $ WO "" $ WO "" $ WO "extern JOBS_CLD_TABLE();" $ WO "extern unsigned long cli_parse_command_line();" $ WO "extern int cli_check_qualifier();" $ WO "extern unsigned long cli_get_value();" $ WO " $ Close/NoLog OutFile $ Exit $ EndSubRoutine ! Extract_CLI_H $! $ Extract_JOBS_C: SubRoutine $ Write SYS$OUTPUT "Extracting JOBS.C..." $ WO := Write OutFile $ SQ = "'" $ SQ2 = SQ + SQ $ Close/NoLog OutFile $ Open/Write/Share OutFile JOBS.C $ WO "/************************************************************************" $ WO " * *" $ WO " * JOBS *" $ WO " * version 1.2 *" $ WO " * *" $ WO " * This software has been released into public domain and may be *" $ WO " * freely copied, distributed, and modified. This software is *" $ WO " * provided AS IS, free of charge. The author assumes no *" $ WO " * responsibility or liability for the use of this software. *" $ WO " * *" $ WO " ************************************************************************" $ WO " * Project: JOBS012 *" $ WO " * Module: JOBS *" $ WO " ************************************************************************" $ WO " * Revision History *" $ WO " * *" $ WO " * 17-JUN-1993 RDJ Module completion. *" $ WO " * *" $ WO " * 17-DEC-1996 RDJ Included ''SQ'fatal''SQ' routine and modified *" $ WO " * references to ''SQ'cli''SQ' routines to *" $ WO " * eliminate ""richlib"". *" $ WO " * *" $ WO " * 4-APR-2000 RDJ Added process mode to display and *" $ WO " * revamped code to compiled cleanly *" $ WO " * under DECC. Moved many funcitons to *" $ WO " * new UTILS module. *" $ WO " ************************************************************************/" $ WO "#include " $ WO "#include " $ WO "#include " $ WO "#include ""jobs.h""" $ WO "#include ""utils.h""" $ WO "#include ""message.h""" $ WO "" $ WO "" $ WO "main () {" $ WO " struct option_struct option;" $ WO " unsigned long pctx = 0; /* context for process scan */" $ WO " unsigned long status; /* status of service calls */" $ WO " process *proc; /* current process */" $ WO " int pcount = 0; /* process count */" $ WO "" $ WO " parse(&option);" $ WO " if ((status = pscan_setup(&pctx,&option)) != SS$_NORMAL)" $ WO " exit(status);" $ WO " while ((proc = get_next_process(&pctx,&option)) != NULL)" $ WO " display_process(proc,&option,&pcount);" $ WO " if (pcount == 0)" $ WO " fatal(JOBS$NOPROCS,option.username);" $ WO "" $ WO "}" $ WO "" $ WO " $ Close/NoLog OutFile $ Exit $ EndSubRoutine ! Extract_JOBS_C $! $ Extract_JOBS_H: SubRoutine $ Write SYS$OUTPUT "Extracting JOBS.H..." $ WO := Write OutFile $ SQ = "'" $ SQ2 = SQ + SQ $ Close/NoLog OutFile $ Open/Write/Share OutFile JOBS.H $ WO "/************************************************************************" $ WO " * *" $ WO " * JOBS *" $ WO " * version 1.2 *" $ WO " * *" $ WO " * This software has been released into public domain and may be *" $ WO " * freely copied, distributed, and modified. This software is *" $ WO " * provided AS IS, free of charge. The author assumes no *" $ WO " * responsibility or liability for the use of this software. *" $ WO " * *" $ WO " ************************************************************************" $ WO " * Project: JOBS012 *" $ WO " * Module: JOBS *" $ WO " ************************************************************************" $ WO " * Revision History *" $ WO " * *" $ WO " * 17-JUN-1993 RDJ Module completion. *" $ WO " * *" $ WO " * 17-DEC-1996 RDJ Included ''SQ'fatal''SQ' routine and modified *" $ WO " * references to ''SQ'cli''SQ' routines to *" $ WO " * eliminate ""richlib"". *" $ WO " * *" $ WO " * 4-APR-2000 RDJ Added process mode to display and *" $ WO " * revamped code to compiled cleanly *" $ WO " * under DECC. Moved many funcitons to *" $ WO " * new UTILS module. *" $ WO " ************************************************************************/" $ WO "#define VERSION ""1.2"" /* current version number */" $ WO "" $ WO "typedef enum {false,true} boolean; /* define boolean type */" $ WO "" $ WO "" $ WO " $ Close/NoLog OutFile $ Exit $ EndSubRoutine ! Extract_JOBS_H $! $ Extract_JOBS_HLP: SubRoutine $ Write SYS$OUTPUT "Extracting JOBS.HLP..." $ WO := Write OutFile $ SQ = "'" $ SQ2 = SQ + SQ $ Close/NoLog OutFile $ Open/Write/Share OutFile JOBS.HLP $ WO "1 JOBS" $ WO "" $ WO "Provides a list of all processes owned by the current username or" $ WO "the specified user. Information displayed includes the process id," $ WO "process name, base priority, mode, state, login date and time, and " $ WO "image name." $ WO "" $ WO "2 Command_Qualifiers" $ WO "" $ WO "/CLUSTER" $ WO " /CLUSTER" $ WO " /NOCLUSTER (default)" $ WO "" $ WO " When the /CLUSTER qualifier is given, JOBS displays information" $ WO " about all owned jobs in the cluster. The node name of each process" $ WO " is also displayed." $ WO "" $ WO "/MODE" $ WO " /MODE=(option-list)" $ WO "" $ WO " Filters the list of processes displayed to include only processes" $ WO " running in the specified process mode(s). Specify one or more of" $ WO " the following keywords. Multiple keywords must be enclosed in" $ WO " parenthesis and separated by a comma. If /MODE is not specified," $ WO " all processes for the specified username are displayed, reglardless" $ WO " of mode." $ WO "" $ WO " INTERACTIVE Displays only interactive processes." $ WO "" $ WO " BATCH Displays only batch processes." $ WO "" $ WO " NETWORK Displays only network processes." $ WO "" $ WO " DETACHED Displays only detached processes." $ WO "" $ WO " OTHER Same as DETACHED." $ WO "" $ WO "" $ WO "/USERNAME" $ WO "" $ WO " /USERNAME=username" $ WO "" $ WO " Specifies an altername username to display process information on." $ WO " By default, processes belonging to the current username are" $ WO " displayed. This qualifier requires WORLD privilege." $ WO "" $ WO " $ Close/NoLog OutFile $ Exit $ EndSubRoutine ! Extract_JOBS_HLP $! $ Extract_JOBS_CLD_CLD: SubRoutine $ Write SYS$OUTPUT "Extracting JOBS_CLD.CLD..." $ WO := Write OutFile $ SQ = "'" $ SQ2 = SQ + SQ $ Close/NoLog OutFile $ Open/Write/Share OutFile JOBS_CLD.CLD $ WO "" $ WO "" $ WO "Module JOBS_CLD_TABLE" $ WO "" $ WO "Define Verb JOBS" $ WO " NoParameters" $ WO " Qualifier CLUSTER, Negatable ! Show all processes in cluster" $ WO " Qualifier VERSION, NonNegatable ! Show version number" $ WO " Qualifier USERNAME, NonNegatable, ! Show for other user" $ WO " Value(Required)" $ WO " Qualifier MODE, NonNegatable," $ WO " Value(Required,Type=MODETYPES,List)" $ WO " " $ WO " Disallow VERSION and (CLUSTER or USERNAME or MODE)" $ WO "" $ WO "Define Type MODETYPES" $ WO " Keyword INTERACTIVE, Negatable" $ WO " Keyword BATCH, Negatable" $ WO " Keyword DETACHED, Negatable" $ WO " Keyword OTHER, Negatable" $ WO " Keyword NETWORK, Negatable" $ WO " $ Close/NoLog OutFile $ Exit $ EndSubRoutine ! Extract_JOBS_CLD_CLD $! $ Extract_MESSAGE_H: SubRoutine $ Write SYS$OUTPUT "Extracting MESSAGE.H..." $ WO := Write OutFile $ SQ = "'" $ SQ2 = SQ + SQ $ Close/NoLog OutFile $ Open/Write/Share OutFile MESSAGE.H $ WO "/************************************************************************" $ WO " * *" $ WO " * JOBS *" $ WO " * version 1.2 *" $ WO " * *" $ WO " * This software has been released into public domain and may be *" $ WO " * freely copied, distributed, and modified. This software is *" $ WO " * provided AS IS, free of charge. The author assumes no *" $ WO " * responsibility or liability for the use of this software. *" $ WO " * *" $ WO " ************************************************************************" $ WO " * Project: JOBS012 *" $ WO " * Module: MESSAGE *" $ WO " ************************************************************************" $ WO " * Revision History *" $ WO " * *" $ WO " * 17-JUN-1993 RDJ Module completion. *" $ WO " ************************************************************************/" $ WO "" $ WO "" $ WO "globalvalue" $ WO " JOBS$NOWORLD, /* no WORLD privilege */" $ WO " JOBS$NOPROCS, /* no processes found */" $ WO " JOBS$VERSION; /* current version is ... */" $ WO "" $ WO " $ Close/NoLog OutFile $ Exit $ EndSubRoutine ! Extract_MESSAGE_H $! $ Extract_MESSAGE_MSG: SubRoutine $ Write SYS$OUTPUT "Extracting MESSAGE.MSG..." $ WO := Write OutFile $ SQ = "'" $ SQ2 = SQ + SQ $ Close/NoLog OutFile $ Open/Write/Share OutFile MESSAGE.MSG $ WO ".TITLE Jobs Messages" $ WO ".IDENT ''SQ'Version 1.2''SQ'" $ WO ".FACILITY JOBS,90/PREFIX=JOBS$" $ WO ".BASE 100" $ WO "" $ WO ".SEVERITY FATAL" $ WO "NOWORLD " $ WO "" $ WO ".SEVERITY ERROR" $ WO "" $ WO "" $ WO ".SEVERITY WARNING" $ WO "NOPROCS /FAO_COUNT=1" $ WO "" $ WO ".SEVERITY INFORMATIONAL" $ WO "VERSION /FAO_COUNT=1" $ WO "" $ WO ".SEVERITY SUCCESS" $ WO ".END" $ WO " $ Close/NoLog OutFile $ Exit $ EndSubRoutine ! Extract_MESSAGE_MSG $! $ Extract_PSCANDEF_H: SubRoutine $ Write SYS$OUTPUT "Extracting PSCANDEF.H..." $ WO := Write OutFile $ SQ = "'" $ SQ2 = SQ + SQ $ Close/NoLog OutFile $ Open/Write/Share OutFile PSCANDEF.H $ WO "#define PSCAN$_BEGIN 0" $ WO "#define PSCAN$_ACCOUNT 1" $ WO "#define PSCAN$_AUTHPRI 2" $ WO "#define PSCAN$_CURPRIV 3" $ WO "#define PSCAN$_GRP 4" $ WO "#define PSCAN$_HW_MODEL 5" $ WO "#define PSCAN$_HW_NAME 6" $ WO "#define PSCAN$_JOBPRCCNT 7" $ WO "#define PSCAN$_JOBTYPE 8" $ WO "#define PSCAN$_MASTER_PID 9" $ WO "#define PSCAN$_MEM 10" $ WO "#define PSCAN$_MODE 11" $ WO "#define PSCAN$_NODE_CSID 12" $ WO "#define PSCAN$_NODENAME 13" $ WO "#define PSCAN$_OWNER 14" $ WO "#define PSCAN$_PRCCNT 15" $ WO "#define PSCAN$_PRCNAM 16" $ WO "#define PSCAN$_PRI 17" $ WO "#define PSCAN$_PRIB 18" $ WO "#define PSCAN$_STATE 19" $ WO "#define PSCAN$_STS 20" $ WO "#define PSCAN$_TERMINAL 21" $ WO "#define PSCAN$_UIC 22" $ WO "#define PSCAN$_USERNAME 23" $ WO "#define PSCAN$_GETJPI_BUFFER_SIZE 24" $ WO "#define PSCAN$_END 25" $ WO "#define PSCAN$K_TYPE 129" $ WO "#define PSCAN$M_OR 1" $ WO "#define PSCAN$M_BIT_ALL 2" $ WO "#define PSCAN$M_BIT_ANY 4" $ WO "#define PSCAN$M_GEQ 8" $ WO "#define PSCAN$M_GTR 16" $ WO "#define PSCAN$M_LEQ 32" $ WO "#define PSCAN$M_LSS 64" $ WO "#define PSCAN$M_PREFIX_MATCH 128" $ WO "#define PSCAN$M_WILDCARD 256" $ WO "#define PSCAN$M_CASE_BLIND 512" $ WO "#define PSCAN$M_EQL 1024" $ WO "#define PSCAN$M_NEQ 2048" $ WO "#define PSCAN$S_ITEM_SPECIFIC_FLAGS 2" $ WO "#define PSCAN$V_OR 0" $ WO "#define PSCAN$V_BIT_ALL 1" $ WO "#define PSCAN$V_BIT_ANY 2" $ WO "#define PSCAN$V_GEQ 3" $ WO "#define PSCAN$V_GTR 4" $ WO "#define PSCAN$V_LEQ 5" $ WO "#define PSCAN$V_LSS 6" $ WO "#define PSCAN$V_PREFIX_MATCH 7" $ WO "#define PSCAN$V_WILDCARD 8" $ WO "#define PSCAN$V_CASE_BLIND 9" $ WO "#define PSCAN$V_EQL 10" $ WO "#define PSCAN$V_NEQ 11" $ WO " $ Close/NoLog OutFile $ Exit $ EndSubRoutine ! Extract_PSCANDEF_H $! $ Extract_STATEDEF_H: SubRoutine $ Write SYS$OUTPUT "Extracting STATEDEF.H..." $ WO := Write OutFile $ SQ = "'" $ SQ2 = SQ + SQ $ Close/NoLog OutFile $ Open/Write/Share OutFile STATEDEF.H $ WO "" $ WO "#define SCH$C_COLPG 1 /* collided page wait */" $ WO "#define SCH$C_MWAIT 2 /* mutex and misc. resource wait */" $ WO "#define SCH$C_CEF 3 /* common event flag wait */" $ WO "#define SCH$C_PFW 4 /* page fault wait */" $ WO "#define SCH$C_LEF 5 /* local event flag wait */" $ WO "#define SCH$C_LEFO 6 /* local event falg wait,out of bal set */" $ WO "#define SCH$C_HIB 7 /* hibernate wait */" $ WO "#define SCH$C_HIBO 8 /* hibernate wait, out of balance set */" $ WO "#define SCH$C_SUSP 9 /* suspended */" $ WO "#define SCH$C_SUSPO 10 /* suspended, out of balance set */" $ WO "#define SCH$C_FPG 11 /* free page wait */" $ WO "#define SCH$C_COM 12 /* computable */" $ WO "#define SCH$C_COMO 13 /* computable, out of balance set */" $ WO "#define SCH$C_CUR 14 /* current process */" $ WO " $ Close/NoLog OutFile $ Exit $ EndSubRoutine ! Extract_STATEDEF_H $! $ Extract_UTILS_C: SubRoutine $ Write SYS$OUTPUT "Extracting UTILS.C..." $ WO := Write OutFile $ SQ = "'" $ SQ2 = SQ + SQ $ Close/NoLog OutFile $ Open/Write/Share OutFile UTILS.C $ WO "/************************************************************************" $ WO " * *" $ WO " * JOBS *" $ WO " * version 1.2 *" $ WO " * *" $ WO " * This software has been released into public domain and may be *" $ WO " * freely copied, distributed, and modified. This software is *" $ WO " * provided AS IS, free of charge. The author assumes no *" $ WO " * responsibility or liability for the use of this software. *" $ WO " * *" $ WO " ************************************************************************" $ WO " * Project: JOBS012 *" $ WO " * Module: UTILS *" $ WO " ************************************************************************" $ WO " * Revision History *" $ WO " * *" $ WO " * 3-APR-2000 RDJ Module creation. *" $ WO " * 4-APR-2000 RDJ Added support for /MODE qualifier. *" $ WO " ************************************************************************/" $ WO "" $ WO "#include " $ WO "#include " $ WO "#include " $ WO "#include " $ WO "#include " $ WO "#include " $ WO "#include " $ WO "#include " $ WO "#include " $ WO "#include " $ WO "#include " $ WO "#include ""statedef.h""" $ WO "#include ""pscandef.h""" $ WO "#include ""jobs.h""" $ WO "#include ""utils.h""" $ WO "#include ""message.h""" $ WO "#include ""cli.h""" $ WO "" $ WO "" $ WO "" $ WO "" $ WO "/************************************************************************" $ WO " * pscan_setup: set up and execute call to sys$process_scan. *" $ WO " ************************************************************************/" $ WO "unsigned long pscan_setup(pctx,option)" $ WO "long *pctx; /* pscan context */" $ WO "struct option_struct *option; /* cli options */" $ WO "{" $ WO " item_list_3 pid_itmlst[] = {" $ WO " {12,PSCAN$_USERNAME,0,0}, /* specify username */" $ WO " {0,0,0,0}," $ WO " {0,0,0,0}};" $ WO " long all_nodes = 0; /* show all nodes in cluster */" $ WO " long username_flags; /* username-specific flags */" $ WO "" $ WO " pid_itmlst[0].buffer_address = (long) &(option->username);" $ WO " pid_itmlst[0].buffer_length = strlen(option->username);" $ WO " if (option->cluster == true) { /* for /CLUSTER */" $ WO " pid_itmlst[1].buffer_length = 0;" $ WO " pid_itmlst[1].item_code = PSCAN$_NODE_CSID;" $ WO " pid_itmlst[1].buffer_address = (long) &all_nodes;" $ WO " pid_itmlst[1].return_length_address = PSCAN$M_NEQ;" $ WO " }" $ WO " return (sys$process_scan(pctx,&pid_itmlst));" $ WO "}" $ WO "" $ WO "/************************************************************************" $ WO " * get_next_process: get info for the next process. *" $ WO " * 4-APR-2000 RDJ Added checking for specific process *" $ WO " * mode(s). *" $ WO " ************************************************************************/" $ WO "process *get_next_process(pctx,option)" $ WO "long *pctx; /* pscan context */" $ WO "struct option_struct *option; /* cli options */" $ WO "{" $ WO " static process p;" $ WO " unsigned long status; /* status of service calls */" $ WO " unsigned short process_name_length; /* length of process name */" $ WO " char full_image[256]; /* name of executing image */" $ WO " unsigned short full_image_length; /* length of executing image */" $ WO " long login_time_quad; /* process login time */" $ WO " long login_time_quad_2; /* (quadword) */" $ WO " long state; /* current state of process */" $ WO " long process_mode = 0; /* mode of process */" $ WO " unsigned short process_node_length; /* length of node name */" $ WO "" $ WO " static char pmodes[] = {''SQ'O''SQ',''SQ'N''SQ',''SQ'B''SQ',''SQ'I''SQ'};" $ WO "" $ WO " item_list_3 jpi_itmlst[] = {" $ WO " {15,JPI$_PRCNAM,(long) &(p.process_name),(long) &process_name_length}," $ WO " {255,JPI$_IMAGNAME,(long) &full_image,(long) &full_image_length}," $ WO " {8,JPI$_LOGINTIM,(long) &login_time_quad,0}," $ WO " {4,JPI$_PRIB,(long) &(p.priority),0}," $ WO " {4,JPI$_STATE,(long) &state,0}," $ WO " {4,JPI$_PID,(long) &(p.pid),0}," $ WO " {6,JPI$_NODENAME,(long) &(p.nodename),(long) &process_node_length}," $ WO " {4,JPI$_MODE,(long) &process_mode,0}," $ WO " {0,0,0,0}};" $ WO "" $ WO "" $ WO " /* continue looping to get info for the next */" $ WO " /* process. return process info when a valid */" $ WO " /* process is found that matches any of the */" $ WO " /* modes the user wants. return NULL only when */" $ WO " /* there are no more processes to search for. */" $ WO " for ever {" $ WO " if ((status = sys$getjpiw(0,pctx,0,&jpi_itmlst,0,0,0)) != SS$_NORMAL) {" $ WO " if (status == SS$_NOMOREPROC) return NULL;" $ WO " lib$signal(status);" $ WO " return NULL;" $ WO " }" $ WO " if (process_name_length > 15)" $ WO " fatal(JOBS$NOPROCS,option->username);" $ WO " p.process_name[process_name_length] = ''SQ'\0''SQ';" $ WO " full_image[full_image_length] = ''SQ'\0''SQ';" $ WO " p.nodename[process_node_length] = ''SQ'\0''SQ';" $ WO " get_state_string(state,p.state);" $ WO " get_short_image (full_image,p.image);" $ WO " get_login_time(&login_time_quad,p.login_time);" $ WO " switch (p.mode = pmodes[process_mode]) {" $ WO " case ''SQ'I''SQ':" $ WO " if (option->mode_interactive) return &p;" $ WO " break;" $ WO " case ''SQ'B''SQ':" $ WO " if (option->mode_batch) return &p;" $ WO " break;" $ WO " case ''SQ'N''SQ':" $ WO " if (option->mode_network) return &p;" $ WO " break;" $ WO " case ''SQ'O''SQ':" $ WO " if (option->mode_other) return &p;" $ WO " break;" $ WO " }" $ WO " }" $ WO " return &p;" $ WO "}" $ WO "" $ WO "/************************************************************************" $ WO " * display_process: display an individual process. *" $ WO " ************************************************************************/" $ WO "void display_process (p,option,pcount)" $ WO "process *p; /* process to display */" $ WO "struct option_struct *option; /* cli options */" $ WO "int *pcount; /* count number of processes */" $ WO "{" $ WO " register int j; /* lcv */" $ WO " char current_time_string[24]; /* get current date/time */" $ WO " $DESCRIPTOR(current_time,current_time_string);" $ WO " char nodename[16]; /* name of current node */" $ WO "" $ WO " lib$date_time(¤t_time); " $ WO " current_time.dsc$a_pointer[current_time.dsc$w_length] = ''SQ'\0''SQ';" $ WO "" $ WO " if (++*pcount == 1) { /* display header */" $ WO " if (option->cluster == false) {" $ WO " get_node_name(nodename);" $ WO " printf (""Processes for user %s on node %s at %s:\n"",option->username," $ WO " nodename,current_time.dsc$a_pointer);" $ WO " printf (""Proc ID Process Name Pr State Login Time Image\n\n"");" $ WO " }" $ WO " else {" $ WO " printf (""Clusterwide processes for user %s at %s:\n"",option->username," $ WO " current_time.dsc$a_pointer);" $ WO " printf (""Proc ID Node Process Name Pr State Login Time Image\n\n"");" $ WO " }" $ WO " }" $ WO "" $ WO " if (option->cluster == false) { /* regular display */" $ WO " printf (""%-8X %-15s %2d %c %-5s %-17s %s\n"",p->pid,p->process_name," $ WO " p->priority,p->mode,p->state,p->login_time,p->image);" $ WO " } else { /* cluster display.. */" $ WO " for (j=12;j<18; j++) /* ..make login time shorter */" $ WO " p->login_time[j-5] = p->login_time[j];" $ WO " p->login_time[6] = ''SQ' ''SQ';" $ WO " printf (""%-8X %-6s %-15s %2d %c %-5s %-12s %s\n"",p->pid," $ WO " p->nodename,p->process_name,p->priority,p->mode,p->state," $ WO " p->login_time,p->image);" $ WO " }" $ WO "}" $ WO "" $ WO "" $ WO "/************************************************************************" $ WO " * get_login_time: convert login time from internal to external format. *" $ WO " ************************************************************************/" $ WO "void get_login_time (internal,external)" $ WO "long *internal; /* internal time */" $ WO "char *external; /* external time */" $ WO "{" $ WO " unsigned long status; /* status of service calls */" $ WO " unsigned short length; /* length of output time */" $ WO " $DESCRIPTOR(date_desc,external);" $ WO "" $ WO " date_desc.dsc$w_length = 23;" $ WO " if ((status = sys$asctim(&length,&date_desc,internal,0)) != SS$_NORMAL)" $ WO " exit (status);" $ WO " external[length-6] = ''SQ'\0''SQ';" $ WO "}" $ WO "" $ WO "/************************************************************************" $ WO " * get_short_image: turn full image spec into file name only. *" $ WO " ************************************************************************/" $ WO "void get_short_image (full_image,short_image)" $ WO "char *full_image; /* full spec of image name */" $ WO "char *short_image; /* file name of image */" $ WO "{" $ WO " struct dsc$descriptor filename_desc;" $ WO " unsigned long status;" $ WO " item_list_2 fscn_itmlst[] = {" $ WO " {255,FSCN$_NAME,0}," $ WO " {0,0,0}};" $ WO "" $ WO " filename_desc.dsc$w_length = strlen(full_image);" $ WO " filename_desc.dsc$a_pointer = full_image;" $ WO " filename_desc.dsc$b_dtype = DSC$K_DTYPE_T;" $ WO " filename_desc.dsc$b_class = DSC$K_CLASS_S;" $ WO " if ((status = sys$filescan(&filename_desc,fscn_itmlst,0)) != SS$_NORMAL)" $ WO " exit (status);" $ WO " strncpy(short_image,(char *) fscn_itmlst[0].buffer_address,fscn_itmlst[0].buffer_length);" $ WO " short_image[fscn_itmlst[0].buffer_length] = ''SQ'\0''SQ';" $ WO "}" $ WO "" $ WO "" $ WO "/************************************************************************" $ WO " * get_state_string: get a process state in string format. *" $ WO " ************************************************************************/" $ WO "void get_state_string (state_number,state_string)" $ WO "long state_number; /* state in long format */" $ WO "char *state_string; /* state in string format */" $ WO "{" $ WO " switch (state_number) {" $ WO " case SCH$C_CEF:" $ WO " strcpy (state_string,""CEF"");" $ WO " break;" $ WO " case SCH$C_COM:" $ WO " strcpy (state_string,""COM"");" $ WO " break;" $ WO " case SCH$C_COMO:" $ WO " strcpy (state_string,""COMO"");" $ WO " break;" $ WO " case SCH$C_CUR:" $ WO " strcpy (state_string,""CUR"");" $ WO " break;" $ WO " case SCH$C_COLPG:" $ WO " strcpy (state_string,""COLPG"");" $ WO " break;" $ WO " case SCH$C_FPG:" $ WO " strcpy (state_string,""FPG"");" $ WO " break;" $ WO " case SCH$C_HIB:" $ WO " strcpy (state_string,""HIB"");" $ WO " break;" $ WO " case SCH$C_HIBO:" $ WO " strcpy (state_string,""HIBO"");" $ WO " break;" $ WO " case SCH$C_LEF:" $ WO " strcpy (state_string,""LEF"");" $ WO " break;" $ WO " case SCH$C_LEFO:" $ WO " strcpy (state_string,""LEFO"");" $ WO " break;" $ WO " case SCH$C_MWAIT:" $ WO " strcpy (state_string,""MWAIT"");" $ WO " break;" $ WO " case SCH$C_PFW:" $ WO " strcpy (state_string,""PFW"");" $ WO " break;" $ WO " case SCH$C_SUSP:" $ WO " strcpy (state_string,""SUSP"");" $ WO " break;" $ WO " case SCH$C_SUSPO:" $ WO " strcpy (state_string,""SUSPO"");" $ WO " break;" $ WO " default:" $ WO " strcpy (state_string,""(?)"");" $ WO " }" $ WO "}" $ WO "" $ WO "" $ WO "/************************************************************************" $ WO " * parse: parse command line for arguments. *" $ WO " * 4-APR-2000 RDJ Added support for /MODE qualifier *" $ WO " ************************************************************************/" $ WO "void parse (option)" $ WO "struct option_struct *option;" $ WO "{" $ WO " boolean version; /* was /VERSION specified? */" $ WO " boolean username_specified; /* was /USERNAME specified? */" $ WO " boolean mode_specified; /* was /MODE specified? */" $ WO " unsigned long status; /* status of service calls */" $ WO " char username[256]; /* current username */" $ WO " short username_length; /* length of current username */" $ WO " item_list_3 getjpi_itemlist[] = { /* input to $getjpi call */" $ WO " {12,JPI$_USERNAME,(long) &username,(long) &username_length}," $ WO " {0,0,0,0}};" $ WO "" $ WO " cli_parse_command_line (""JOBS"",&JOBS_CLD_TABLE);" $ WO " cli_check_qualifier (""VERSION"",&version);" $ WO " if (version == true)" $ WO " fatal(JOBS$VERSION,VERSION);" $ WO " cli_check_qualifier (""CLUSTER"",&(option->cluster));" $ WO " cli_check_qualifier (""USERNAME"",&username_specified);" $ WO " if (username_specified == true) {" $ WO " check_privs();" $ WO " cli_get_value(""USERNAME"",&username);" $ WO " username[12] = ''SQ'\0''SQ';" $ WO " username_length = 12;" $ WO " while (username[--username_length] == ''SQ' ''SQ');" $ WO " username[username_length] = ''SQ'\0''SQ';" $ WO " strcpy (option->username,username);" $ WO " }" $ WO " else {" $ WO " if ((status = sys$getjpiw(0,0,0,&getjpi_itemlist,0,0,0)) != SS$_NORMAL)" $ WO " exit (status);" $ WO " while (username[--username_length] == ''SQ' ''SQ');" $ WO " username[username_length+1] = ''SQ'\0''SQ';" $ WO " strcpy (option->username,username);" $ WO " }" $ WO " cli_check_qualifier(""MODE"",&mode_specified);" $ WO " if (mode_specified) {" $ WO " cli_check_qualifier(""MODE.INTERACTIVE"",&(option->mode_interactive));" $ WO " cli_check_qualifier(""MODE.BATCH"",&(option->mode_batch));" $ WO " cli_check_qualifier(""MODE.DETACHED"",&(option->mode_other));" $ WO " cli_check_qualifier(""MODE.OTHER"",&(option->mode_other));" $ WO " cli_check_qualifier(""MODE.NETWORK"",&(option->mode_network));" $ WO " } else {" $ WO " option->mode_interactive = true;" $ WO " option->mode_batch = true;" $ WO " option->mode_network = true;" $ WO " option->mode_other = true;" $ WO " }" $ WO "}" $ WO "" $ WO "" $ WO "/************************************************************************" $ WO " * get_node_name: get the name of the current node. *" $ WO " ************************************************************************/" $ WO "void get_node_name(nodename) " $ WO "char *nodename; /* name of current node */" $ WO "{" $ WO " unsigned long status; /* status of service calls */" $ WO " unsigned short nodename_length; /* length of nodename */" $ WO " item_list_3 syi_itmlst[] = {" $ WO " {15,SYI$_NODENAME,(long) nodename,(long) &nodename_length}," $ WO " {0,0,0,0}};" $ WO "" $ WO " if ((status = sys$getsyi(0,0,0,&syi_itmlst,0,0,0)) != SS$_NORMAL)" $ WO " exit (status);" $ WO " nodename[nodename_length] = ''SQ'\0''SQ';" $ WO "}" $ WO "" $ WO "" $ WO "/************************************************************************" $ WO " * check_privs: check if calling process has WORLD privilege. *" $ WO " ************************************************************************/" $ WO "void check_privs (){" $ WO " long privs;" $ WO " long privs_2;" $ WO " item_list_3 jpi_itmlst[] = {" $ WO " {8,JPI$_PROCPRIV,(long) &privs,0}," $ WO " {0,0,0,0}};" $ WO "" $ WO " sys$getjpi(0,0,0,&jpi_itmlst,0,0,0);" $ WO " if (!(privs & PRV$M_WORLD))" $ WO " fatal(JOBS$NOWORLD,"""");" $ WO "}" $ WO "" $ WO "" $ WO "" $ WO "/************************************************************************" $ WO " * fatal: signal an error condition. *" $ WO " ************************************************************************/" $ WO "void fatal (error_type, string)" $ WO "unsigned long error_type;" $ WO "char *string;" $ WO "{" $ WO " struct dsc$descriptor string_desc;" $ WO "" $ WO " string_desc.dsc$w_length = strlen(string);" $ WO " string_desc.dsc$b_dtype = DSC$K_DTYPE_T;" $ WO " string_desc.dsc$b_class = DSC$K_CLASS_S;" $ WO " string_desc.dsc$a_pointer = string;" $ WO " if (strlen (string) > 0)" $ WO " lib$signal (error_type,1,&string_desc);" $ WO " else" $ WO " lib$signal (error_type);" $ WO " exit (1);" $ WO "}" $ WO " $ Close/NoLog OutFile $ Exit $ EndSubRoutine ! Extract_UTILS_C $! $ Extract_UTILS_H: SubRoutine $ Write SYS$OUTPUT "Extracting UTILS.H..." $ WO := Write OutFile $ SQ = "'" $ SQ2 = SQ + SQ $ Close/NoLog OutFile $ Open/Write/Share OutFile UTILS.H $ WO "/************************************************************************" $ WO " * *" $ WO " * JOBS *" $ WO " * version 1.2 *" $ WO " * *" $ WO " * This software has been released into public domain and may be *" $ WO " * freely copied, distributed, and modified. This software is *" $ WO " * provided AS IS, free of charge. The author assumes no *" $ WO " * responsibility or liability for the use of this software. *" $ WO " * *" $ WO " ************************************************************************" $ WO " * Project: JOBS012 *" $ WO " * Module: UTILS *" $ WO " ************************************************************************" $ WO " * Revision History *" $ WO " * *" $ WO " * 3-APR-2000 RDJ Module creation. *" $ WO " ************************************************************************/" $ WO "" $ WO "#define ever (;;) /* indefinite loop */" $ WO "" $ WO "struct option_struct { /* command options */" $ WO " char username[13]; /* username to search */" $ WO " boolean cluster; /* show all processes in cluster*/" $ WO " boolean mode_interactive; /* show interactive processes */" $ WO " boolean mode_batch; /* show batch processes */" $ WO " boolean mode_network; /* show network processes */" $ WO " boolean mode_other; /* show other/detached processes*/" $ WO "};" $ WO "" $ WO "typedef struct {" $ WO " long pid; /* process id */" $ WO " char process_name[16]; /* process name */" $ WO " char image[256]; /* current image */" $ WO " char login_time[25]; /* login time */" $ WO " long priority; /* cpu priority */" $ WO " char state[9]; /* process state */" $ WO " char nodename[7]; /* executing node */" $ WO " char mode; /* process mode */" $ WO "} process;" $ WO "" $ WO "typedef struct { /* item list 2 */" $ WO " short buffer_length; /* length of input buffer */" $ WO " short item_code; /* input/output item code */" $ WO " long buffer_address; /* address of buffer; */" $ WO "} item_list_2;" $ WO "" $ WO "typedef struct { /* item list 3 */" $ WO " short buffer_length; /* length of input buffer */" $ WO " short item_code; /* input/output item code */" $ WO " long buffer_address; /* address of buffer */" $ WO " long return_length_address; /* length of output buffer */" $ WO "} item_list_3;" $ WO "" $ WO "" $ WO "extern void parse();" $ WO "extern void display_process();" $ WO "extern void fatal();" $ WO "extern void get_node_name();" $ WO "extern void get_state_string();" $ WO "extern void get_short_image();" $ WO "extern void get_login_time();" $ WO "extern void check_privs();" $ WO "extern unsigned long pscan_setup();" $ WO "extern process *get_next_process();" $ WO " $ Close/NoLog OutFile $ Exit $ EndSubRoutine ! Extract_UTILS_H