$ verify = f$verify(0) $ ! $ ! APLTPUR.COM - Command procedure to invoke APLTPU, the Applicon $ ! Extended EDT Keypad Emulator, in read only mode. $ ! $ ! V1.000 DMC Original version $ ! V2.000 6/02/86 Geoff Bryant Add support for wildcards and $ ! lists of files $ ! V2.001 6/05/86 Geoff Bryant Give a message if no file found. $ ! V2.002 6/10/86 Geoff Bryant Add /NOPARSE switch to allow $ ! user to use search lists. $ ! V2.003 6/12/86 Geoff Bryant Add a check for search lists, so that $ ! /NOPARSE is automatic for search lists. $ ! V2.004 12/29/86 Geoff Bryant Change default file to be last file $ ! edited instead of always .COM. $ ! $ $ ! Merge together p1, p2, p3, etc... $ $ p1 = f$edit(p1+","+p2+","+p3+","+p4+","+p5+","+p6+","+p7+","+p8,- "collapse,upcase") $ $ ! If no file(s) provided, use the file(s) from the last edit session $ $ if (f$type(apltpu_default_file) .eqs. "") then - apltpu_default_file :== ".COM;0" $ if (p1 .nes. ",,,,,,,") then goto GOT_FILE $ if (f$type(apltpu_edit_file) .eqs. "") then - inquire apltpu_edit_file "$_File" $ p1 := 'apltpu_edit_file $ GOT_FILE: $ apltpu_edit_file :== 'p1 $ $ ! Process the file(s) $ $ file_found = 0 $ element_number = 0 $ defdir = f$environment("default") $ default_switch := "" $ $ 10: ! Pick off a list element $ $ element = f$element(element_number,",",p1) $ if element .eqs. "," then goto exit $ if f$length(element) .eqs. 0 then goto exit $ $ ! Get the filename and any switches $ $ switch = f$extract(f$locate("/",element),f$length(element),element) $ if switch .eqs. "" then switch = default_switch $ default_switch = switch $ confirm = f$locate("/CON",switch) .ne. f$length(switch) $ if .not. confirm then goto 15 $ beg = f$extract(0,f$locate("/CON",switch),switch) $ end = f$extract(f$locate("/CON",switch)+4,- f$length(switch),switch) $ end = f$extract(f$locate("/",end),f$length(end),end) $ switch = beg + end $ 15: $ doparse = .not. (f$locate("/NOP",switch) .ne. f$length(switch)) $ if doparse then goto 16 $ beg = f$extract(0,f$locate("/NOP",switch),switch) $ end = f$extract(f$locate("/NOP",switch)+4,- f$length(switch),switch) $ end = f$extract(f$locate("/",end),f$length(end),end) $ switch = beg + end $ 16: $ file = f$extract(0,f$locate("/",element),element) $ if f$trnlnm(f$extract(0,f$locate(":",defdir),defdir),,,,,"max_index") - .ne. 0 then doparse = 0 $ if f$trnlnm(f$extract(0,f$locate(":",file),file),,,,,"max_index") - .ne. 0 then doparse = 0 $ if doparse then file = f$parse(file,apltpu_default_file,,,"syntax_only") $ apltpu_default_file == file $ file_len = f$length(file) $ wild = (f$locate("*",file) .ne. file_len) .or. - (f$locate("%",file) .ne. file_len) .or. - (f$locate("...",file) .ne. file_len) $ $ 20: ! Find the file $ $ this_file = f$search(file,23579) $ if this_file .eqs. "" then goto 40 $ file_found = 1 $ $ ! Edit the file $ $ if confirm then goto 26 $ write sys$output "" $ write sys$output "Reading:  ",this_file," " $ write sys$output "" $ goto 28 $ 26: inquire/nopunc edit_this_one "Read file ''this_file' [Y/N/Q]? " $ if (edit_this_one .eqs. "Q") .or. (edit_this_one .eqs. "q") - then goto exit $ if .not. edit_this_one then goto 30 $ 28: $ edit := "" $ assign/user_mode sys$command: sys$input: $ edit/tpu/read/section=sys$library:apledtsecini 'this_file''switch $ $ 30: ! If wild card specified, try the next one $ $ if wild then goto 20 $ $ 40: ! Process the next list element $ $ element_number = element_number + 1 $ goto 10 $ $ ! All done... $ $ EXIT: $ apltpu_default_file == - f$parse(apltpu_default_file,,,"name","syntax_only") + - f$parse(apltpu_default_file,,,"type","syntax_only") + - ";0" $ if .not. file_found then write sys$output - "%APLTPU-W-NOFILE, no file found" $ verify = f$verify(verify)