/contrib/groff/gendef.sh

https://bitbucket.org/freebsd/freebsd-head/ · Shell · 34 lines · 15 code · 8 blank · 11 comment · 3 complexity · 553ee23ed0d4971179895ad453a81050 MD5 · raw file

  1. #
  2. # gendef filename var=val var=val ...
  3. #
  4. # This script is used to generate src/include/defs.h
  5. #
  6. file=$1
  7. shift
  8. defs="#define $1"
  9. shift
  10. for def
  11. do
  12. defs="$defs
  13. #define $def"
  14. done
  15. # Use $TMPDIR if defined. Default to cwd, for non-Unix systems
  16. # which don't have /tmp on each drive (we are going to remove
  17. # the file before we exit anyway). Put the PID in the basename,
  18. # since the extension can only hold 3 characters on MS-DOS.
  19. t=${TMPDIR-.}/gro$$.tmp
  20. sed -e 's/=/ /' >$t <<EOF
  21. $defs
  22. EOF
  23. test -r $file && cmp -s $t $file || cp $t $file
  24. rm -f $t
  25. exit 0
  26. # eof