home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / PJ8_3.ZIP / LASTMIN.DOC < prev    next >
Text File  |  1990-04-07  |  2KB  |  64 lines

  1. HERE IS THE OLD ROUTINE - DOESN'T PROPERLY SET UP ES FOR SCASB:
  2. check_command_string proc near        
  3.     push di
  4.     cld                ;Check for first quotation mark -
  5.     mov al,'"'            ; replace with null (20h) if present.
  6.     mov di,82h            ;Command tail starts at 82h.
  7.     xor ch,ch
  8.     mov cl,byte ptr ds:[080h]    ;Length of command tail stored at 80h
  9.     repne scasb
  10.     jcxz end_check
  11.     mov byte ptr [di-1],20h
  12.             
  13.     std                ;Change direction & check for
  14.     add di,cx            ; last quotation mark.
  15.     dec di
  16.     dec di
  17.     repne scasb
  18.     jcxz end_check
  19.     mov byte ptr [di+1],20h
  20.  
  21. end_check:
  22.     cld 
  23.     pop di
  24.     ret
  25. check_command_string endp
  26.  
  27.  
  28.  
  29. HERE IS THE NEW ROUTINE - DOES PROPERLY SET UP ES
  30. ;-------------------------------------------------------------------------------;Check_command_string removes first & last quotation marks from command
  31. ;string.  This lets xcall pass redirection request to COMMAND.COM. This
  32. ;routine saves ES & DI.
  33. ;-------------------------------------------------------------------------------
  34. check_command_string proc near        
  35.     push di
  36.     push es
  37.     mov ax,ds
  38.     mov es,ax
  39.  
  40.     xor ch,ch
  41.     mov cl,byte ptr ds:[080h]    ;Length of command tail stored at 80h
  42.     jcxz end_check            ;All done if no command tail
  43.     cld                ;Check for first quotation mark -
  44.     mov al,'"'            ; replace with null (20h) if present.
  45.     mov di,82h            ;Command tail starts at 82h.
  46.     repne scasb
  47.     jnz end_check
  48.     mov byte ptr [di-1],20h
  49.             
  50.     std                ;Change direction & check for
  51.     add di,cx            ; last quotation mark.
  52.     dec di
  53.     dec di
  54.     repne scasb
  55.     cld 
  56.     jnz end_check
  57.     mov byte ptr [di+1],20h
  58.  
  59. end_check:
  60.     pop es
  61.     pop di
  62.     ret
  63. check_command_string endp
  64.