home *** CD-ROM | disk | FTP | other *** search
/ H4CK3R 15 / hacker15 / 15_H4CK3R#15.ISO / linux_security / engarde / ENGARDE_COMMUNITY_FEINT.ISO / usr / bin / setfont < prev    next >
Encoding:
Text File  |  2002-05-30  |  2.0 KB  |  128 lines

  1. #! /bin/sh
  2.  
  3. # wrapper around consolechars(8), 
  4. # expanding arguments just in case abreviated args get changed.
  5.  
  6. usage ()
  7. {
  8.     echo >&2 "Usage: `basename $0` [<fontfile>] [-m <mapfile>] [-u <unimapfile>]"
  9.     echo >&2 "          [-o <oldfontfile>] [-om <oldmapfile>] [-ou <oldunimapfile>]"
  10.     echo >&2 "          [-h] [-v] [-V] [-<N>]"
  11.     exit 1
  12. }
  13.  
  14. warning ()
  15. {
  16.     echo >&2 'Warning: this is a shell wrapper; consider using consolechars(8)'
  17. }
  18.  
  19. OPTIONS=""
  20. QUIET=0
  21.  
  22. if [ $# = 0 ] ; then
  23.     OPTIONS="--default-font"
  24. fi
  25.  
  26. while [ $# -gt 0 ] ; do
  27.     case $1 in
  28. #     --quiet)
  29. #         QUIET=1
  30. #         shift
  31. #         ;;
  32.     -v)
  33.         OPTIONS="$OPTIONS --verbose"
  34.         shift
  35.         ;;
  36.     -h)
  37.         warning
  38.         usage
  39.         exit 0
  40.         ;;
  41.     -V)
  42.         OPTIONS="$OPTIONS --version"
  43.         shift
  44.         ;;
  45.  
  46.     -m)
  47.         if [ "$NEWMAP" = "" ]; then
  48.         if [ "$2" = "none" ]; then
  49.             echo >&2 'Warning: "-m none" does nothing; ignored.'
  50.         else
  51.             NEWMAP="--acm $2"
  52.         shift
  53.         shift
  54.         fi
  55.         else
  56.         usage
  57.         fi
  58.         ;;
  59.       
  60.     -u)
  61.         if [ "$NEWUNIMAP" = "" ]; then
  62.         if [ "$2" = "none" ]; then
  63.             NEWUNIMAP="--force-no-sfm"
  64.         else
  65.             NEWUNIMAP="--sfm $2"
  66.             shift
  67.             shift
  68.         fi
  69.         else
  70.         usage
  71.         fi
  72.         ;;
  73.       
  74.     -o)
  75.         if [ "$OLDFONT" = "" ]; then
  76.         OLDFONT="--old-font-raw $2"
  77.         shift
  78.         shift
  79.         else
  80.         usage
  81.         fi
  82.         ;;
  83.       
  84.     -om)
  85.         if [ "$OLDMAP" = "" ]; then
  86.         OLDMAP="-old-acm $2"
  87.         shift
  88.         shift
  89.         else
  90.         usage
  91.         fi
  92.         ;;
  93.       
  94.     -ou)
  95.         if [ "$OLDUNIMAP" = "" ]; then
  96.         OLDUNIMAP="-old-sfm $2"
  97.         shift
  98.         shift
  99.         else
  100.         usage
  101.         fi
  102.         ;;
  103.       
  104.     -*)
  105.         # redirect to /dev/null to prevent test barfing on non-numeric args
  106.         if [ "$CHARSIZE" = "" -a "${1#-}" -gt 0 -a "${1#-}" -lt 32 ] 2>/dev/null; then
  107.         CHARSIZE="--char-height ${1#-}"
  108.         shift
  109.         else
  110.         usage
  111.         fi
  112.         ;;
  113.       
  114.     *)
  115.         if [ "$NEWFONT" = "" ]; then
  116.         NEWFONT="--font $1"
  117.         shift
  118.         else
  119.         usage
  120.         fi
  121.     ;;
  122.     esac
  123. done
  124.  
  125. test $QUIET = 1 || warning
  126.  
  127. consolechars $OPTIONS $CHARSIZE $NEWFONT $NEWUNIMAP $NEWMAP $OLDFONT $OLDUNIMAP $OLDMAP
  128.