home *** CD-ROM | disk | FTP | other *** search
/ PC-Online 1996 May / PCOnline_05_1996.bin / linux / source / contrib / smail / smail-3.1 / smail-3 / smail-3.1.28 / util / mkaliases < prev    next >
Text File  |  1994-05-30  |  2KB  |  56 lines

  1. #!/bin/sh
  2. # @(#)util/mkaliases.sh    1.4 7/11/92 11:40:01
  3. #
  4. #    Copyright (C) 1987, 1988 Ronald S. Karr and Landon Curt Noll
  5. #    Copyright (C) 1992  Ronald S. Karr
  6. # See the file COPYING, distributed with smail, for restriction
  7. # and warranty information.
  8.  
  9. # mkaliases - create an aliases database for a smail aliasfile director
  10. #
  11. # Usage: mkaliases
  12. #
  13. # Rebuilds the aliasfile specified in /root/smail-3.1.28/conf/EDITME.
  14. # Different types for the aliasfile are rebuilt in different ways.
  15. # In the case of lsearch, verification is performed on the file,
  16. # but no other changes are made.
  17.  
  18. PATH='/usr/lib/smail:/usr/bin:/bin:/usr/bin:/usr/local/bin'; export PATH
  19. ALIASES_FILE='/usr/lib/aliases'
  20. ALIASES_TYPE='lsearch'
  21.  
  22. case "$ALIASES_TYPE" in
  23.  
  24. bsearch )
  25.     ALIASES_DIR="`echo "$ALIASES_FILE" | sed 's,/[^/]*$,,'`"
  26.     case "$ALIASES_FILE" in
  27.  
  28.     *.sort)    TEXT_FILE="`basename "$ALIASES_FILE" .sort`" ;;
  29.     * )    TEXT_FILE="`basename "$ALIASES_FILE"`".txt ;;
  30.  
  31.     esac
  32.     if mkline "$ALIASES_DIR/$TEXT_FILE" |
  33.         wc -lc |
  34.         awk '{ print $1 " entries, " $2 " bytes total" }'
  35.     then :; else exit 1; fi
  36.     mkline "$ALIASES_DIR/$TEXT_FILE" |
  37.         mksort -f > "$ALIASES_DIR/.$TEXT_FILE"
  38.     mv -f "$ALIASES_DIR/.$TEXT_FILE" "$ALIASES_FILE"
  39.     ;;
  40.  
  41. dbm )    mkline "$ALIASES_FILE" | mkdbm -f -v -o "$ALIASES_FILE" ;;
  42.  
  43. lsearch ) mkline "$ALIASES_FILE" | wc -lc |
  44.         awk '{ print $1 " entries, " $2 " bytes total" }'
  45.     ;;
  46.  
  47. yp | aliasyp )
  48.     echo "$0: aliases database maintained over YP";;
  49.  
  50. * )    echo "$0: unknown file type, $ALIASES_TYPE, for $ALIASES_FILE" ;;
  51.  
  52. esac
  53.  
  54. exit 0
  55.