home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume14 / sccs_b / part01 / sccs_admin < prev    next >
Encoding:
Text File  |  1990-09-20  |  2.4 KB  |  78 lines

  1. #!/bin/sh
  2. #+++
  3. #    NAME    : sccs_admin
  4. #    PURPOSE : create SCCS files if they do not already exist
  5. #    AUTHOR    :  W. Hatch
  6. #            Coleman Research
  7. #            14504 Greenview Drive Suite 500
  8. #            Laurel, Maryland 20708
  9. #            (301)470-3839
  10. #            uunet!bis!bill
  11. #    DATE    : 7/18/88
  12. #    PROJECT    : WEH SOFTWARE
  13. #    USAGE    : sccs_admin  file1  file2  ....
  14. #    RESTRICTIONS : file name length <= 12 characters for Unix V.3
  15. #---
  16. #------------------------------------------------------------------------
  17. # if no command line arguments then abort with usage instructions
  18. #------------------------------------------------------------------------
  19. usage="  "
  20. case $# in
  21.     0) echo $usage
  22.        exit;;
  23. esac
  24. #------------------------------------------------------------------------
  25. # if project directory is not defined then make it the current directory
  26. #------------------------------------------------------------------------
  27. PROJECTDIR=${PROJECTDIR-.}
  28. #------------------------------------------------------------------------
  29. # define sccs and source backup directories relative to project directory
  30. #------------------------------------------------------------------------
  31. SCCS=$PROJECTDIR/SCCS
  32. BACKUP=$PROJECTDIR/src_backup
  33. export SCCS  PROJECTDIR  BACKUP
  34. #------------------------------------------------------------------------
  35. # make sure sccs and source backup directories exist
  36. #------------------------------------------------------------------------
  37. if test ! -d  $SCCS
  38. then
  39.     mkdir $SCCS
  40. else
  41.     echo "$SCCS directory exists."
  42. fi
  43. if test ! -d $BACKUP
  44. then
  45.     mkdir $BACKUP
  46. else 
  47.     echo "$BACKUP directory exists."
  48. fi
  49. #------------------------------------------------------------------------
  50. # for each source file not already under sccs put it under sccs
  51. #------------------------------------------------------------------------
  52. for i
  53. do
  54.     if test ! -f $SCCS/s.$i
  55.     then
  56.         #-------------------------------------------------------
  57.         # if file $i does not exist then abort
  58.         #-------------------------------------------------------
  59.         if test ! -s $i
  60.         then
  61.             echo "$i does not exist or is zero length; "
  62.             echo "sccs_admin $i aborted"
  63.             echo "look in src_backup or elsewhere for $i source"
  64.             exit 1
  65.         fi
  66.         #-------------------------------------------------------
  67.         # backup before sccs removes original source file
  68.         #-------------------------------------------------------
  69.         cp $i $BACKUP/$i
  70.         admin -i$i $SCCS/s.$i 
  71.         rm $i
  72.         echo "admin of $i OK."
  73.     else
  74.         echo "$SCCS/s.$i exists;  admin for $i aborted"
  75.         echo "$i is already under sccs."
  76.     fi
  77. done
  78.