home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / os2clu03.zip / BIN / Help.CMD < prev    next >
OS/2 REXX Batch file  |  2001-10-30  |  2KB  |  69 lines

  1. /*
  2.  *  ************************************************************************
  3.  *                          OS/2 Command-Line Utilities
  4.  *  (c) Copyright 1991-2000 Jonathan de Boyne Pollard.  All Rights Reserved.
  5.  *  ************************************************************************
  6.  */
  7.  
  8. /* "@(#)HELP.CMD version 1.1.0" */
  9.  
  10. '@echo off'
  11.  
  12. call RxFuncAdd 'SysGetMessage','RexxUtil','SysGetMessage'
  13.  
  14. usage = "Usage: HELP"||"0D0A"X||"   or: HELP message_number"||"0D0A"X||"   or: HELP [book] command"
  15. copyr = "Copyright (c) 1998-2000 Jonathan de Boyne Pollard.  All Rights Reserved."
  16.  
  17. parse arg first second third
  18.  
  19. select
  20.     when third \== '' then do
  21.         say SysGetMessage(1003)
  22.         say usage
  23.     end
  24.     when second \== '' then do
  25.         cmdline = 'view '||first||' '||second
  26.         '(2>nul 1>nul ? && start /pm /c '||cmdline||') || start /pm '||cmdline
  27.     end
  28.     when translate(first) == "ON" then do
  29.         prompt = value("PROMPT",,"OS2ENVIRONMENT")
  30.         ipos = pos("$i", prompt)
  31.         if ipos < 1 then
  32.             prompt = value("PROMPT","$i"||prompt,"OS2ENVIRONMENT")
  33.     end
  34.     when translate(first) == "OFF" then do
  35.         prompt = value("PROMPT",,"OS2ENVIRONMENT")
  36.         ipos = pos("$i", prompt)
  37.         if ipos > 0 then
  38.             prompt = value("PROMPT",left(prompt,ipos-1)||substr(prompt,ipos+2),"OS2ENVIRONMENT")
  39.     end
  40.     when first == "/?" then do
  41.         say SysGetMessage(190, "CLUH.MSG", copyr, usage)
  42.     end
  43.     when first == '' then do
  44.         say
  45.         say SysGetMessage(1491)
  46.     end
  47.     when datatype(first,"N") then do
  48.         say
  49.         say SysGetMessage(first)
  50.         say SysGetMessage(first, "OSO001H.MSG")
  51.     end
  52.     when datatype(first,"A") & datatype(left(first,3), "M") & datatype(substr(first,4),"N") then do
  53.         file = left(first,3)
  54.         if translate(file) == "SYS" then
  55.             file = "OSO001"
  56.         num = substr(first,4)
  57.         say
  58.         say SysGetMessage(num, file||".MSG")
  59.         say SysGetMessage(num, file||"H.MSG")
  60.     end
  61.     otherwise do
  62.         cmdref = value("CMDREF",,"OS2ENVIRONMENT")
  63.         if cmdref == '' then
  64.             cmdref = 'cmdref'
  65.         cmdline = 'view '||cmdref||' '||first
  66.         '(2>nul 1>nul ? && start /pm /c '||cmdline||') || start /pm '||cmdline
  67.     end
  68. end
  69.