.title WHAT_PARSEIMAGE ; .psect what_parseimage_data, noexe, pic, noshr, lcl, wrt, rd, rel, con ; FSCN$_NAME = 6 ; Code for the name FSCN$_VERSION = 8 ; Code for the version itemlist: ; Item list for SYS$FILESCAN ; name_len: .word 0 ; How long the name is namecode: .word FSCN$_NAME ; We want the name name_adr: .long 1 ; Where the name is ; vers_len: .word 0 ; How long the version is verscode: .word FSCN$_VERSION ; We want the version vers_adr: .long 1 ; Where the version is ; end_list: .long 0 ; End of our list ; ; ; ;******************************************************************************* ;* What_parseimage * ;* This procedure is intended to parse out the the name of the image * ;* from imag field returned by SYS$GETJPIW. Known images have $ in front. * ;* For those system managers who like to catch sneaky people passing off the * ;* name programs $.EXE, the real $ which stands for DCL will be pulled back a * ;* character, whereas $.EXE will show up one space over. * ;******************************************************************************* ; .psect what_parseimage_code, con, exe, lcl, shr, nowrt, pic, rel ; .entry what_parseimage, ^m ; movl 4(ap), r9 ; Descriptor of string to parse movl 8(ap), r10 ; Descriptor of string to return movl 12(ap), r11 ; Length of string returned ; movl 4(r10), r8 ; Get address of string to ret movc5 #0,#0,#32,(r10),(r8) ; Blank out return string ; $filescan_s - srcstr = (r9), - ; Give the address of our string valuelst = itemlist ; Item list of what we want ; blbc r0, trim_name ; Error, just put a "$" ; tstw name_len ; Was there anything at all beql known_imag ; No image, just at DCL prompt ; tstw vers_len ; Have we found a version beql known_imag ; If not, we know the image ; movb #^a/ /, (r8)+ ; Move the name to the string brb move_name ; Now move the name ; known_imag: movb #^a/$/, (r8)+ ; We know the image ; move_name: movl name_adr, r7 movc3 name_len, (r7), (r8) ; Move the name to the string ; trim_name: pushl r11 ; Address of return length pushl r10 ; Address of string to trim pushl r10 ; Address to put trimmed string calls #3, g^str$trim ; Trim the string ; end: movl #1, r0 ret ; End of What_parseimage ; .end