.title SETUNIQUE - set unique process name .ident /V1.01/ .sbttl documentation ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Find a unique process name and set it, using the same approach ; as the DCL SPAWN command ; ; ; Programmer: Eric F. Richards ; Date: 14-Aug-85 ; System: Gould OSD VAX-11/780, VMS V4.1 ; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; .sbttl Data and Macro definitions ; .macro clrsp space, fill=#0 ; macro for clearing space subl space, sp ; on stack for a data area. movc5 #0, (sp), fill, space, (sp) ; fill ares is init'd, too... .endm clrsp ; ...that's it! ; namlen = 16 ; name descriptor length .enable suppression ; no extra symbols in list .disable traceback, debug ; don't touch with debugger... $ssdef ; need system service offsets... ; .sbttl Main Code .psect $code, nowrt, exe, long, pic, shr .entry setunique, ^m ; entry point movl #ss$_insfarg, r0 ; assume error tstw (ap) ; any args supplied? beql out ; go home w/ above error clrsp #namlen ; clear stack space for name movl 4(ap), r6 ; get address of descriptor addl3 #4, r6, r5 ; get address of text buffer movc5 (r6), @(r5), #^a/ /,#namlen, (sp) ; move data from desc to buff pushl sp ; build decr for the txt buffer pushl (r6) ; make it same length as orig movl sp, r4 ; save pointer to that descr clrl r2 ; init loop counter pushaq #^a/!AS_!UL / ; put FAO ctrstr addr on stack pushl #7 ; build descriptor for string movl sp, r3 ; save address of that, too loop: $setprn_s prcnam=(r4) ; set the process name blbs r0, out ; on sucess, go home cmpl #ss$_duplnam, r0 ; was the error for dup name? bneq out ; if not, then exit w/error incl r2 ; otherwise, increment counter movl #namlen, (r4) ; reset output descriptor $fao_s ctrstr=(r3), - ; format a new name outbuf=(r4), - ; write it to the buffer outlen=(r4), - ; and its length, too p1=r6, - ; need descr of username p2=r2 ; and prc name number blbs r0, loop ; on success try again out: ret ; done (or error), go home .end ; ...all done, no more!