.title MISCQUAL Miscellaneous quals on many commands .ident /V1.00/ .sbttl Documentation ; ; ; This file contains the subroutines IDCONF and IDLOG. ; ; The subroutine IDCONF is given a holder ID, an ID to grant, a ; text buffer length and its address, and with that info ; it will prompt the user (using the text buffer as a FAO ; control string to process the two IDs with) for a yes-no ; answer. Presumably, the text string will ask him if he ; really wants to do something to those IDs. The querstion ; will only be asked if the qualifier CONFIRM is on the line. ; If the CONFIRM switch is absent, this returns a TRUE. ; Otherwise, the return value is a boolean reflecting whether ; the user answered YES or NO to the prompt. If the procedure errors ; out, it will return an error status (which, since it is an ; even number, will be interpreted as a NO). ; ; calling format: ; log = IDCONF(grant-id, holder-id, text-len, text addr) ; ; ; The routine IDLOG will put an error message on the terminal ; telling what happened with the IDs that it got, if the LOG ; switch is on the command line. ; ; calling format: ; log = IDCONF(grant-id, holder-id, error-code) ; ; Eric F. Richards ; 24-Apr-86 ; Gould OSD VAXcluster VMS V4.3 ; .sbttl Macros, constants, and other nonsense .page .enable suppression ; make the list files nice .disable traceback, debug ; hands off w/ de bugger logargs = 3 ; number of arguments to get for IDLOG conargs = 4 ; number of arguments to get for IDCONF grantid = 4 ; grant-id, by value holdid = 8 ; holder-id, by value errcod = 12 ; error code, by value txtdsc = 12 ; you can use the text parms as a descr $ssdef ; define system service codes .macro clrsp space, fill=#0 ; macro for clearing space subl space, sp ; on stack for a data area. movc5 #0, (sp), fill, - ; data area is init'd to space, (sp) ; nulls by this macro .endm clrsp ; that's it! bufsiz = 132 ; buffer size for output line .sbttl Main Code -- IDCONF .page .psect $code, long, pic, shr, exe, nowrt .entry idconf, ^m cmpb (ap), #conargs ; did we get all of the args? bgequ 10$ ; if so, skip error handler movzwl #ss$_insfarg, r0 ; this is the error, ret ; and this is how we handle it! 10$: movl sp, r2 ; save stack pointer pushal w^conf ; build descriptor... pushl s^#conf_len ; ...for CONFIRM switch pushl sp ; put address of descr on stack calls #1, qualifier ; find out if the qualifier is there blbs r0, 15$ ; if TRUE, then it's there mnegl #1, r0 ; set return value as TRUE ret ; ang go back 15$: movl r2, sp ; unwind stack clrsp #bufsiz ; make a string buffer on the stack pushl sp ; build a descriptor for it pushl #bufsiz ; ... so $FAO can use it movl sp, r5 ; r5 = empty string $fao_s ctrstr = txtdsc(ap), - ; format the output line outlen = (r5), - ; write the truncated output outbuf = (r5), - ; ...into the control string p1 = grantid(ap), - ; use this ID as input p2 = holdid(ap) ; this is who would get the input blbc r0, 20$ ; on error go out pushl r5 ; give descr to more general purpose calls #1, w^confirm ; ...confirm routine and use that res. 20$: ret ; all done, get out .sbttl Main Code -- IDLOG .page .align long .entry idlog, 0 ; entry IDLOG, no regs saved cmpb (ap), #logargs ; did we get all of the args? bgequ 10$ ; if so, skip error handler movzwl #ss$_insfarg, r0 ; this is the error, ret ; and this is how we handle it! 10$: pushal w^log ; build descriptor... pushl s^#log_len ; ...for LOG switch pushl sp ; put address of descr on stack calls #1, qualifier ; find out if the qualifier is there blbs r0, 15$ ; if TRUE, then it's there tstl r0 ; did we get a real FALSE? bneq 12$ ; if not, report error movl #ss$_normal, r0 ; else, set success 12$: ret ; and go back 15$: pushl holdid(ap) ; holder ID is here pushl grantid(ap) ; granted ID is here pushl #2 ; number of arguments pushl errcod(ap) ; error code pushl #4 ; four args in vector movl sp, r0 ; save pointer to the vector $putmsg_s msgvec=(r0) ; write out the message 20$: ret ; all done, get out .sbttl Pure data area .psect $pdata, noexe, nowrt, pic, shr, long log: .ascii /LOG/ ; we check for this qualifier log_len = . - log ; this is its length .align long conf: .ascii /CONFIRM/ ; check for this switch on the cmd line conf_len = . - conf ; length, needed to build a descr .end ; ...that's it!