home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1680 / ad2c.sed < prev    next >
Encoding:
Text File  |  1990-12-28  |  470 b   |  40 lines

  1. #
  2. #    Convert app-defaults file to C strings decls.
  3. #
  4. #    Invoke by: sed -n -f ad2c.sed
  5. #
  6. : read
  7. # remove comments
  8. /^!/d
  9. # remove blanks
  10. /^$/d
  11. # escape quotes
  12. s/"/\\"/g
  13. # escape backslash
  14. s/\\/\\\\/g
  15. # except the line continuation ones
  16. s/\\$//g
  17. # add leading quote
  18. s/^/"/
  19. #
  20. : test
  21. /\\$/b slash
  22. s/$/",/
  23. p
  24. n
  25. b read
  26. #
  27. : slash
  28. p
  29. n
  30. # just like "read" only doesn't add leading quote
  31. /^!/d
  32. /^$/d
  33. s/"/\\"/g
  34. s/\\\\/\\/g
  35. s/\\n/\\\\n/g
  36. s/\\t/\\\\t/g
  37. s/\\f/\\\\f/g
  38. s/\\b/\\\\b/g
  39. b test
  40.