home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cvs1929.zip / cvs / bin / tokenize.cmd < prev   
Encoding:
Text File  |  1998-08-02  |  2.3 KB  |  87 lines

  1. /*
  2. ** $Id: tokenize.cmd,v 1.1.2.1 1998/06/23 12:32:41 ahuber Exp $
  3. **
  4. ** Copyright (C) 1998  Andreas Huber <ahuber@ping.at>
  5. **
  6. ** This program is free software; you can redistribute it and/or
  7. ** modify it under the terms of the GNU General Public License
  8. ** as published by the Free Software Foundation; either version 2
  9. ** of the License, or (at your option) any later version.
  10. **
  11. ** This program is distributed in the hope that it will be useful,
  12. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. ** GNU General Public License for more details.
  15. **
  16. ** You should have received a copy of the GNU General Public License
  17. ** along with this program; see the file COPYING. If not, write to
  18. ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19. ** Boston, MA 02111-1307, USA.
  20. */
  21. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  22. call SysLoadFuncs
  23.  
  24. /*
  25. ** Constants.
  26. */
  27. EXIT_SUCCESS    = 0
  28. EXIT_FAILURE    = 1
  29. EXIT_SIGNAL        = 3
  30.  
  31. FALSE            = 0
  32. TRUE            = \FALSE
  33.  
  34. CVSROOT            = get_repository()
  35.  
  36. /*
  37. ** Global names known to all procedures.
  38. */
  39. globals = 'EXIT_SUCCESS EXIT_FAILURE EXIT_SIGNAL',
  40.     'FALSE TRUE argc argv. CVSROOT'
  41.  
  42. /*
  43. ** Main body.
  44. */
  45. main:
  46. /*
  47. ** Initialize basic variables.
  48. */
  49.     argc = 1; argv. = ''; argv.0 = 'tokenize'
  50.     signal on halt name signal_handler
  51.     if CVSROOT = '' then
  52.         call die 'Cannot tokenize in non-local repository (see CVSROOT).'
  53.     filemask = CVSROOT||'/CVSROOT/*.cmd'
  54.     call SysFileTree translate(filemask, '\', '/'),,
  55.         'files.', 'fo', '*--+-'
  56.     do i = 1 to files.0
  57.         if left(filespec('n', files.i), 2) \= '.#' then do
  58.             say 'Tokenizing' files.i
  59.             '@attrib -r' files.i '>nul 2>&1'
  60.             '@'||files.i '//t'
  61.             '@attrib +r' files.i '>nul 2>&1'
  62.         end
  63.     end
  64.     exit EXIT_SUCCESS
  65.  
  66. /*
  67. ** Subroutines.
  68. */
  69. die: procedure expose (globals)
  70.     parse arg text
  71.     call lineout 'stderr:', argv.0||': '||text
  72.     exit EXIT_FAILURE
  73.  
  74. get_repository: procedure
  75.     cvsroot = value('CVSROOT',, 'OS2ENVIRONMENT')
  76.     method = 'local'
  77.     if left(cvsroot, 1) = ':' then
  78.         parse var cvsroot ':' method ':' cvsroot
  79.     if method \= 'local' then
  80.         return ''
  81.     return cvsroot
  82.  
  83. signal_handler:
  84.     call lineout 'stderr:', argv.0||': terminated by SIGINT.'
  85.     exit EXIT_SIGNAL
  86.  
  87.