home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / cstepm.zip / custepm.e < prev    next >
Text File  |  1995-01-16  |  18KB  |  371 lines

  1. ; This is included as a site version of MYEXTRA.E (and so part of EXTRA.EX)
  2. ; if EXTRA.EX = 1, or as a site version of MYSTUFF.E (and so part of EPM.EX)
  3. ; if EXTRA.EX = 0.
  4. ; Or, as of March 29, 1993, this can be compiled as a stand-alone module which
  5. ; is linked from one of the above.
  6.  
  7. compile if not defined(SMALL)  -- If SMALL not defined, then being separately compiled
  8.  define INCLUDING_FILE = 'CUSTEPM.E'
  9. const
  10.    tryinclude 'MYCNF.E'        -- the user's configuration customizations.
  11.  
  12.  compile if not defined(SITE_CONFIG)
  13.     const SITE_CONFIG = 'SITECNF.E'
  14.  compile endif
  15.  compile if SITE_CONFIG
  16.     tryinclude SITE_CONFIG
  17.  compile endif
  18.  
  19. const
  20.  compile if not defined(WANT_BRACKET_MATCHING)
  21.    WANT_BRACKET_MATCHING = 0
  22.  compile endif
  23.  compile if not defined(WANT_DYNAMIC_PROMPTS)  -- This must appear *before* ENGLISH.E.
  24.    WANT_DYNAMIC_PROMPTS = 1
  25.  compile endif
  26.  compile if not defined(NLS_LANGUAGE)
  27.    NLS_LANGUAGE = 'ENGLISH'
  28.  compile endif
  29. include NLS_LANGUAGE'.e'
  30.  
  31. define                     -- We're being compiled standalone, so we know we must want the rest.
  32.    SKIP_REST_OF_FILE = 0
  33. compile else   -- not defined(SMALL)   else being included from MYSTUFF or MYEXTRA
  34. define                 -- so if we should link separately, then only define the stub here.
  35.    SKIP_REST_OF_FILE = LINK_CUSTEPM_SEPARATELY
  36.  
  37.  compile if LINK_CUSTEPM_SEPARATELY
  38. definit
  39.    'linkverify custepm'
  40.  compile endif
  41. compile endif  -- not defined(SMALL)
  42.  
  43. compile if not SKIP_REST_OF_FILE
  44. const  -- Text defined separately, for easier NLS translation
  45.    ACTIONS_BAR__MSG =      TILDE_CHAR'Actions '  -- See also ACTIONS_ACCEL__L in CUSTEPM.CFG
  46.      BOX_MENU__MSG =         '~Box'
  47.        BOX_1_MENU__MSG =       'Box ~1 - │'
  48.        BOX_2_MENU__MSG =       'Box ~2 - ║'
  49.        BOX_3_MENU__MSG =       'Box ~3 - |'
  50.        BOX_4_MENU__MSG =       'Box ~4 - █'
  51.        BOX_5_MENU__MSG =       'Box ~5 - ╤'
  52.        BOX_6_MENU__MSG =       'Box ~6 - ╥'
  53.        BOX_A_MENU__MSG =       'Box ~Asm'
  54.        BOX_B_MENU__MSG =       'Box ~Blanks'
  55.        BOX_C_MENU__MSG =       'Box ~C'
  56.        BOX_E_MENU__MSG =       'Box ~E'
  57.        BOX_P_MENU__MSG =       'Box ~Pascal'
  58.        BOX_R_MENU__MSG =       'Box ~Remove'
  59.        BOX_S_MENU__MSG =       'Box ~Script'
  60.      DRAW_MENU__MSG =        '~Draw'
  61.        DRAW_1_MENU__MSG =      'Draw ~1 - │'
  62.        DRAW_2_MENU__MSG =      'Draw ~2 - ║'
  63.        DRAW_3_MENU__MSG =      'Draw ~3 - |'
  64.        DRAW_4_MENU__MSG =      'Draw ~4 - █'
  65.        DRAW_5_MENU__MSG =      'Draw ~5 - ╤'
  66.        DRAW_6_MENU__MSG =      'Draw ~6 - ╥'
  67.        DRAW_B_MENU__MSG =      'Draw ~Blanks'
  68.      HOST_SCREEN_MENU__MSG = '~Host screen'
  69.        SCREEN_A_MENU__MSG =    'Screen ~A'
  70.        SCREEN_B_MENU__MSG =    'Screen ~B'
  71.        SCREEN_C_MENU__MSG =    'Screen ~C'
  72.        SCREEN_D_MENU__MSG =    'Screen ~D'
  73.        SCREEN_E_MENU__MSG =    'Screen ~E'
  74.        SCREEN_F_MENU__MSG =    'Screen ~F'
  75.        SCREEN_G_MENU__MSG =    'Screen ~G'
  76.        SCREEN_H_MENU__MSG =    'Screen ~H'
  77.        SCREEN_I_MENU__MSG =    'Screen ~I'
  78.        SCREEN_J_MENU__MSG =    'Screen ~J'
  79.      SCAN_TEXT_MENU__MSG =   'Scan for ~text...'
  80.      GREP_TEXT_MENU__MSG =   'G~REP for text...'
  81.      SORT_LINES_MENU__MSG =  '~Sort lines'
  82.        SORT_ASCENDING__MSG =   'Sort ~ascending'
  83.        SORT_DESCENDING__MSG =  'Sort ~descending'
  84. compile if EVERSION >= 5.50  -- GPI version required for code folding
  85.      FOLD_CODE_MENU__MSG =   '~Fold code'
  86.      EXPAND_CODE_MENU__MSG = '~Expand code'
  87. compile endif
  88. compile if WANT_BRACKET_MATCHING
  89.      MATCH_BRACKET_MENU__MSG='~Match bracket'
  90. compile endif
  91.      GML_TAGS_MENU__MSG =    '~GML tags'
  92.      SGML_TAGS_MENU__MSG =   'SGM~L tags'
  93.      HTML_TAGS_MENU__MSG =   'HTML t~ags'
  94.      LATEX_CMDS_MENU__MSG =  '~LaTeX commands'
  95.      PRINTER_CODES_MENU__MSG='~Printer codes'
  96.  
  97. compile if WANT_DYNAMIC_PROMPTS
  98.    ACTIONS_BARP__MSG =      \1'Additional actions that can be taken with text regions'
  99.      BOX_MENUP__MSG =         \1'Draw box around marked block'
  100.        BOX_x_MENUP__MSG =       \1'Draw a box using line style shown'
  101.        BOX_A_MENUP__MSG =       \1'Draw a box using Assembler comments'
  102.        BOX_B_MENUP__MSG =       \1'Draw a box using blanks'
  103.        BOX_C_MENUP__MSG =       \1'Draw a box using C comments'
  104.        BOX_E_MENUP__MSG =       \1'Draw a box using E comments'
  105.        BOX_P_MENUP__MSG =       \1'Draw a box using Pascal comments'
  106.        BOX_R_MENUP__MSG =       \1'Reflow the text in the block'
  107.        BOX_S_MENUP__MSG =       \1'Draw a box using Script comments'
  108.      DRAW_MENUP__MSG =        \1'Draw lines; press Esc to stop'
  109.        DRAW_x_MENUP__MSG =      \1'Draw lines using line style shown'
  110.        DRAW_B_MENUP__MSG =      \1'Draw lines using blanks'
  111.      HOST_SCREEN_MENUP__MSG = \1'Capture the host screen'
  112.        SCREEN_A_MENUP__MSG =    \1'Capture host screen - session A'
  113.        SCREEN_B_MENUP__MSG =    \1'Capture host screen - session B'
  114.        SCREEN_C_MENUP__MSG =    \1'Capture host screen - session C'
  115.        SCREEN_D_MENUP__MSG =    \1'Capture host screen - session D'
  116.        SCREEN_E_MENUP__MSG =    \1'Capture host screen - session E'
  117.        SCREEN_F_MENUP__MSG =    \1'Capture host screen - session F'
  118.        SCREEN_G_MENUP__MSG =    \1'Capture host screen - session G'
  119.        SCREEN_H_MENUP__MSG =    \1'Capture host screen - session H'
  120.        SCREEN_I_MENUP__MSG =    \1'Capture host screen - session I'
  121.        SCREEN_J_MENUP__MSG =    \1'Capture host screen - session J'
  122.      SCAN_TEXT_MENUP__MSG =   \1'Search for text in external files'
  123.      GREP_TEXT_MENUP__MSG =   \1'Search for text in external files using GREP algorithm'
  124.      SORT_LINES_MENUP__MSG =  \1'Sort lines in ascending or descending order'
  125.        SORT_ASCENDINGP__MSG =   \1'Sort lines in ascending order'
  126.        SORT_DESCENDINGP__MSG =  \1'Sort lines in descending order'
  127.  compile if EVERSION >= 5.50  -- GPI version required for code folding
  128.      FOLD_CODE_MENUP__MSG =   \1'Place cursor on bracket & select to fold bracketed code'
  129.      EXPAND_CODE_MENUP__MSG = \1'Place cursor inside folded code & select to expand code'
  130.  compile endif
  131.  compile if WANT_BRACKET_MATCHING
  132.      MATCH_BRACKET_MENUP__MSG=\1'Place cursor on bracket & select to find match'
  133.  compile endif
  134.      GML_TAGS_MENUP__MSG =    \1'Add/remove GML Tag menu to/from the action bar'
  135.      SGML_TAGS_MENUP__MSG =   \1'Add/remove SGML Tag menu to/from the action bar'
  136.      HTML_TAGS_MENUP__MSG =   \1'Add/remove HTML Tag menu to/from the action bar'
  137.      LATEX_CMDS_MENUP__MSG =  \1'Add/remove LaTeX menu to/from the action bar'
  138.      PRINTER_CODES_MENUP__MSG=\1'Add/remove Printer Codes menu to/from the action bar'
  139. compile else
  140.    ACTIONS_BARP__MSG =      ''
  141.      BOX_MENUP__MSG =         ''
  142.        BOX_x_MENUP__MSG =       ''
  143.        BOX_A_MENUP__MSG =       ''
  144.        BOX_B_MENUP__MSG =       ''
  145.        BOX_C_MENUP__MSG =       ''
  146.        BOX_E_MENUP__MSG =       ''
  147.        BOX_P_MENUP__MSG =       ''
  148.        BOX_R_MENUP__MSG =       ''
  149.        BOX_S_MENUP__MSG =       ''
  150.      DRAW_MENUP__MSG =        ''
  151.        DRAW_x_MENUP__MSG =      ''
  152.        DRAW_B_MENUP__MSG =      ''
  153.      HOST_SCREEN_MENUP__MSG = ''
  154.        SCREEN_A_MENUP__MSG =    ''
  155.        SCREEN_B_MENUP__MSG =    ''
  156.        SCREEN_C_MENUP__MSG =    ''
  157.        SCREEN_D_MENUP__MSG =    ''
  158.        SCREEN_E_MENUP__MSG =    ''
  159.        SCREEN_F_MENUP__MSG =    ''
  160.        SCREEN_G_MENUP__MSG =    ''
  161.        SCREEN_H_MENUP__MSG =    ''
  162.        SCREEN_I_MENUP__MSG =    ''
  163.        SCREEN_J_MENUP__MSG =    ''
  164.      SCAN_TEXT_MENUP__MSG =   ''
  165.      GREP_TEXT_MENUP__MSG =   ''
  166.      SORT_LINES_MENUP__MSG =  ''
  167.        SORT_ASCENDINGP__MSG =   ''
  168.        SORT_DESCENDINGP__MSG =  ''
  169.  compile if EVERSION >= 5.50  -- GPI version required for code folding
  170.      FOLD_CODE_MENUP__MSG =   ''
  171.      EXPAND_CODE_MENUP__MSG = ''
  172.  compile endif
  173.  compile if WANT_BRACKET_MATCHING
  174.      MATCH_BRACKET_MENUP__MSG=''
  175.  compile endif
  176.      GML_TAGS_MENUP__MSG =    ''
  177.      SGML_TAGS_MENUP__MSG =   ''
  178.      HTML_TAGS_MENUP__MSG =   ''
  179.      LATEX_CMDS_MENUP__MSG =  ''
  180.      PRINTER_CODES_MENUP__MSG=''
  181. compile endif  -- WANT_DYNAMIC_PROMPTS
  182.  
  183.    SCAN_TITLE__MSG =  'Scan for text in files'
  184.    SCAN_PROMPT__MSG = 'Enter string (in quotes if it contains spaces) and file spec.'
  185.    OK__MSG =          '~OK'
  186.    GREP_WARNING__MSG = 'No filespec given - select OK if you really want to search all files.  (Specify *.* to avoid this warning.)'
  187.  
  188. definit
  189.  compile if EVERSION < 6
  190.    'postme add_actions_menu'  -- Make this happen *after* menus are built.
  191.  compile else
  192.    'postme postme add_actions_menu'  -- Need to delay it longer, since EPM32 does a postme of its menu creation.
  193.  compile endif
  194.  
  195. defc add_actions_menu
  196.    universal defaultmenu, activemenu
  197.    universal GML_tags_menu_flag, SGML_tags_menu_flag, HTML_tags_menu_flag, printer_codes_menu_flag
  198.    deletemenu defaultmenu, 6, 0, 0  -- delete the existing Help menu (we want it to stay at the right)
  199.  
  200.    buildsubmenu defaultmenu, 37, ACTIONS_BAR__MSG, ACTIONS_BARP__MSG, 0, 0
  201.      buildmenuitem defaultmenu,   37, 3760, BOX_MENU__MSG,           BOX_MENUP__MSG, 17, 0
  202.        buildmenuitem defaultmenu, 37, 3761, BOX_1_MENU__MSG,         'box 1'BOX_x_MENUP__MSG, 0, 0
  203.        buildmenuitem defaultmenu, 37, 3762, BOX_2_MENU__MSG,         'box 2'BOX_x_MENUP__MSG, 0, 0
  204.        buildmenuitem defaultmenu, 37, 3763, BOX_3_MENU__MSG,         'box 3'BOX_x_MENUP__MSG, 0, 0
  205.        buildmenuitem defaultmenu, 37, 3764, BOX_4_MENU__MSG,         'box 4'BOX_x_MENUP__MSG, 0, 0
  206.        buildmenuitem defaultmenu, 37, 3765, BOX_5_MENU__MSG,         'box 5'BOX_x_MENUP__MSG, 0, 0
  207.        buildmenuitem defaultmenu, 37, 3766, BOX_6_MENU__MSG,         'box 6'BOX_x_MENUP__MSG, 0, 0
  208.        buildmenuitem defaultmenu, 37, 3767, BOX_A_MENU__MSG,         'box A'BOX_A_MENUP__MSG, 0, 0
  209.        buildmenuitem defaultmenu, 37, 3768, BOX_B_MENU__MSG,         'box B'BOX_B_MENUP__MSG, 0, 0
  210.        buildmenuitem defaultmenu, 37, 3769, BOX_C_MENU__MSG,         'box C'BOX_C_MENUP__MSG, 0, 0
  211.        buildmenuitem defaultmenu, 37, 3770, BOX_E_MENU__MSG,         'box E'BOX_E_MENUP__MSG, 0, 0
  212.        buildmenuitem defaultmenu, 37, 3771, BOX_P_MENU__MSG,         'box P'BOX_P_MENUP__MSG, 0, 0
  213.        buildmenuitem defaultmenu, 37, 3772, BOX_R_MENU__MSG,         'box R'BOX_R_MENUP__MSG, 0, 0
  214.        buildmenuitem defaultmenu, 37, 3773, BOX_S_MENU__MSG,         'box S'BOX_S_MENUP__MSG, 32769, 0
  215.      buildmenuitem defaultmenu,   37, 3780, DRAW_MENU__MSG,          DRAW_MENUP__MSG, 17, 0
  216.        buildmenuitem defaultmenu, 37, 3781, DRAW_1_MENU__MSG,        'draw 1'DRAW_x_MENUP__MSG, 0, 0
  217.        buildmenuitem defaultmenu, 37, 3782, DRAW_2_MENU__MSG,        'draw 2'DRAW_x_MENUP__MSG, 0, 0
  218.        buildmenuitem defaultmenu, 37, 3783, DRAW_3_MENU__MSG,        'draw 3'DRAW_x_MENUP__MSG, 0, 0
  219.        buildmenuitem defaultmenu, 37, 3784, DRAW_4_MENU__MSG,        'draw 4'DRAW_x_MENUP__MSG, 0, 0
  220.        buildmenuitem defaultmenu, 37, 3785, DRAW_5_MENU__MSG,        'draw 5'DRAW_x_MENUP__MSG, 0, 0
  221.        buildmenuitem defaultmenu, 37, 3786, DRAW_6_MENU__MSG,        'draw 6'DRAW_x_MENUP__MSG, 0, 0
  222.        buildmenuitem defaultmenu, 37, 3787, DRAW_B_MENU__MSG,        'draw B'DRAW_B_MENUP__MSG, 32769, 0
  223.      buildmenuitem defaultmenu,   37, 3788, \0,                      '',      4, 0
  224.      buildmenuitem defaultmenu,   37, 3700, HOST_SCREEN_MENU__MSG,   HOST_SCREEN_MENUP__MSG, 17, 0
  225.        buildmenuitem defaultmenu, 37, 3701, SCREEN_A_MENU__MSG,      'gethost A'SCREEN_A_MENUP__MSG, 0, 0
  226.        buildmenuitem defaultmenu, 37, 3702, SCREEN_B_MENU__MSG,      'gethost B'SCREEN_B_MENUP__MSG, 0, 0
  227.        buildmenuitem defaultmenu, 37, 3703, SCREEN_C_MENU__MSG,      'gethost C'SCREEN_C_MENUP__MSG, 0, 0
  228.        buildmenuitem defaultmenu, 37, 3704, SCREEN_D_MENU__MSG,      'gethost D'SCREEN_D_MENUP__MSG, 0, 0
  229.        buildmenuitem defaultmenu, 37, 3705, SCREEN_E_MENU__MSG,      'gethost E'SCREEN_E_MENUP__MSG, 0, 0
  230.        buildmenuitem defaultmenu, 37, 3706, SCREEN_F_MENU__MSG,      'gethost F'SCREEN_F_MENUP__MSG, 0, 0
  231.        buildmenuitem defaultmenu, 37, 3707, SCREEN_G_MENU__MSG,      'gethost G'SCREEN_G_MENUP__MSG, 0, 0
  232.        buildmenuitem defaultmenu, 37, 3708, SCREEN_H_MENU__MSG,      'gethost H'SCREEN_H_MENUP__MSG, 0, 0
  233.        buildmenuitem defaultmenu, 37, 3709, SCREEN_I_MENU__MSG,      'gethost I'SCREEN_I_MENUP__MSG, 0, 0
  234.        buildmenuitem defaultmenu, 37, 3710, SCREEN_J_MENU__MSG,      'gethost J'SCREEN_J_MENUP__MSG, 32769, 0
  235.      buildmenuitem defaultmenu,   37, 3711, \0,                      '',      4, 0
  236.      buildmenuitem defaultmenu,   37, 3720, SCAN_TEXT_MENU__MSG,     'Scan'SCAN_TEXT_MENUP__MSG, 0, 0
  237.      buildmenuitem defaultmenu,   37, 3721, GREP_TEXT_MENU__MSG,     'GREP'GREP_TEXT_MENUP__MSG, 0, 0
  238.      buildmenuitem defaultmenu,   37, 3730, SORT_LINES_MENU__MSG,    SORT_LINES_MENUP__MSG, 17, 0
  239.        buildmenuitem defaultmenu, 37, 3731, SORT_ASCENDING__MSG,     'sort'SORT_ASCENDINGP__MSG, 0, 0
  240.        buildmenuitem defaultmenu, 37, 3732, SORT_DESCENDING__MSG,    'sort R'SORT_DESCENDINGP__MSG, 32769, 0
  241.      buildmenuitem defaultmenu,   37, 3733, \0,                      '',      4, 0
  242. compile if EVERSION >= 5.50  -- GPI version required for code folding
  243.      buildmenuitem defaultmenu,   37, 3735, FOLD_CODE_MENU__MSG,     'fold'FOLD_CODE_MENUP__MSG, 0, 0
  244.      buildmenuitem defaultmenu,   37, 3736, EXPAND_CODE_MENU__MSG,   'fold 0'EXPAND_CODE_MENUP__MSG, 0, 0
  245. compile endif
  246. compile if WANT_BRACKET_MATCHING
  247.      buildmenuitem defaultmenu,   37, 3737, MATCH_BRACKET_MENU__MSG, 'match_bracket'MATCH_BRACKET_MENUP__MSG, 0, 0
  248. compile endif
  249. compile if EVERSION >= 5.50  or WANT_BRACKET_MATCHING
  250.      buildmenuitem defaultmenu,   37, 3738, \0,                      '',      4, 0
  251. compile endif
  252.      buildmenuitem defaultmenu,   37, 3740, GML_TAGS_MENU__MSG,      'link_gmltags'GML_TAGS_MENUP__MSG, 0, 0
  253.      buildmenuitem defaultmenu,   37, 3742, SGML_TAGS_MENU__MSG,     'link_sgmltags'SGML_TAGS_MENUP__MSG, 0, 0
  254.      buildmenuitem defaultmenu,   37, 3743, HTML_TAGS_MENU__MSG,     'link_htmltags'HTML_TAGS_MENUP__MSG, 0, 0
  255.      buildmenuitem defaultmenu,   37, 3745, LATEX_CMDS_MENU__MSG,    'link_LaTeX'LATEX_CMDS_MENUP__MSG, 0, 0
  256.      buildmenuitem defaultmenu,   37, 3750, PRINTER_CODES_MENU__MSG, 'epmprt'PRINTER_CODES_MENUP__MSG, 0, 0
  257.  
  258.    call readd_help_menu()
  259.    if printer_codes_menu_flag='' then printer_codes_menu_flag=0; endif
  260.  
  261. defc menuinit_37
  262.    universal GML_tags_menu_flag, SGML_tags_menu_flag, HTML_tags_menu_flag, printer_codes_menu_flag, LaTeX_cmds_menu_flag
  263.    SetMenuAttribute( 3740, 8192, not GML_tags_menu_flag)
  264.    SetMenuAttribute( 3742, 8192, not SGML_tags_menu_flag)
  265.    SetMenuAttribute( 3743, 8192, not HTML_tags_menu_flag)
  266.    SetMenuAttribute( 3745, 8192, not LaTeX_cmds_menu_flag)
  267.    SetMenuAttribute( 3750, 8192, not printer_codes_menu_flag)
  268.  
  269. compile if WANT_BRACKET_MATCHING
  270. defc match_bracket = call passist()
  271. compile endif
  272.  
  273. defc link_gmltags
  274.    universal GML_tags_menu_flag
  275.    universal defaultmenu, activemenu
  276.    if GML_tags_menu_flag then
  277.       deletemenu defaultmenu, 38, 0, 0
  278.       call maybe_show_menu()
  279.       GML_tags_menu_flag = 0
  280.       unlink 'gmltags'
  281.       return
  282.    endif
  283.    'linkverify gmltags'
  284.  
  285. defc link_sgmltags
  286.    universal SGML_tags_menu_flag
  287.    universal defaultmenu, activemenu
  288.    if SGML_tags_menu_flag then
  289.       deletemenu defaultmenu, 40, 0, 0
  290.       call maybe_show_menu()
  291.       SGML_tags_menu_flag = 0
  292.       unlink 'sgmltags'
  293.       return
  294.    endif
  295.    'linkverify sgmltags'
  296.  
  297. defc link_htmltags
  298.    universal HTML_tags_menu_flag
  299.    universal defaultmenu, activemenu
  300.    if HTML_tags_menu_flag then
  301.       deletemenu defaultmenu, 41, 0, 0
  302.       call maybe_show_menu()
  303.       HTML_tags_menu_flag = 0
  304.       unlink 'htmltags'
  305.       return
  306.    endif
  307.    'linkverify htmltags'
  308.  
  309. defc link_LaTeX
  310.    universal LaTeX_cmds_menu_flag
  311.    universal defaultmenu, activemenu
  312.    if LaTeX_cmds_menu_flag then
  313.       deletemenu defaultmenu, 39, 0, 0
  314.       call maybe_show_menu()
  315.       LaTeX_cmds_menu_flag = 0
  316.       unlink 'latexmnu'
  317.       return
  318.    endif
  319.    'linkverify latexmnu'
  320.  
  321. defc scan
  322.    call grep_common(arg(1), '/a')
  323.  
  324. defc grep =
  325.    call grep_common(arg(1))
  326.  
  327. defproc grep_common(search_arg)
  328.    if search_arg='' then
  329.       parse value entrybox(SCAN_TITLE__MSG,'/'OK__MSG'/'Cancel__MSG'/',\0,'',200,
  330.              atoi(1) || atoi(0) || gethwndc(APP_HANDLE) ||
  331.              SCAN_PROMPT__MSG) with button 2 search_arg \0
  332.       if button<>\1 then return; endif
  333.    endif
  334.    temp = strip(search_arg)
  335.    do while temp <> ''
  336.       if pos(leftstr(temp, 1), '-/') then
  337.          parse value temp with . temp
  338.       else
  339.          leave
  340.       endif
  341.    enddo
  342.    if leftstr(temp, 1)='"' then
  343.       parse value temp with 2 '"' temp
  344.    else
  345.       parse value temp with . temp
  346.    endif
  347.    if temp='' then
  348.       if 1<> winmessagebox(sayerrortext(-275), GREP_WARNING__MSG, 16673 ) -- MB_OKCANCEL + MB_CUAWARNING + MB_DEFBUTTON2 + MB_MOVEABLE)
  349.       then
  350.          return
  351.       endif
  352.    endif
  353.    sayerror 'Scanning files...'
  354.    call redirect('grep', arg(2) '/y /q /l' search_arg)
  355.    if not .last | (.last=1 & leftstr(textline(.last), 7) = 'SEARCH:') then
  356.       'q'
  357.       sayerror 'No hits.'
  358.    endif
  359.  
  360. defproc redirect(cmd)
  361.    universal vTEMP_PATH
  362.    outfile=vTEMP_PATH || substr(cmd'_______',1,8) || '.out'
  363.    quietshell cmd arg(2) '>'outfile '2>&1'
  364.    if RC = sayerror('Insufficient memory') or
  365.       RC = sayerror('File Not found')      then stop; endif
  366.    'e /u /d' outfile
  367.    .filename='.Output from' cmd arg(2)
  368.    call erasetemp(outfile)
  369.  
  370. compile endif -- not SKIP_REST_OF_FILE
  371.