mk_cfgrpt.sh 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/bin/sh
  2. # Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
  3. #
  4. # Permission to use, copy, modify, and/or distribute this software for any
  5. # purpose with or without fee is hereby granted, provided that the above
  6. # copyright notice and this permission notice appear in all copies.
  7. #
  8. # THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
  9. # REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  10. # AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
  11. # INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  12. # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  13. # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  14. # PERFORMANCE OF THIS SOFTWARE.
  15. #
  16. # This script embeds config.report into src/bin/cfgrpt/config_report.cc
  17. # Called by configure
  18. #
  19. dest=$1
  20. # Initializes
  21. cat > $dest
  22. # Header
  23. cat >> $dest << END
  24. // config_report.cc. Generated from config.report by tools/mk_cfgrpt_header.sh
  25. namespace isc {
  26. namespace detail {
  27. extern const char* const config_report[] = {
  28. END
  29. # Body: escape '\'s and '"'s, preprend ' ";;;; ' and append '",'
  30. sed -e 's/\\/\\\\/g' -e 's/"/\\"/g' -e 's/^/ ";;;; /' -e 's/$/",/' \
  31. < config.report >> $dest
  32. # Trailer
  33. cat >> $dest <<END
  34. ""
  35. };
  36. }
  37. }
  38. END