Annotation of embedaddon/rsync/define-from-md.awk, revision 1.1
1.1 ! misho 1: #!/usr/bin/awk -f
! 2:
! 3: # The caller must pass args: -v hfile=NAME rsync.1.md
! 4:
! 5: BEGIN {
! 6: heading = "/* DO NOT EDIT THIS FILE! It is auto-generated from a list of values in " ARGV[1] "! */"
! 7: if (hfile ~ /compress/) {
! 8: define = "#define DEFAULT_DONT_COMPRESS"
! 9: prefix = "*."
! 10: } else {
! 11: define = "#define DEFAULT_CVSIGNORE"
! 12: prefix = ""
! 13: }
! 14: value_list = ""
! 15: }
! 16:
! 17: /^ > [^ ]+$/ {
! 18: gsub(/`/, "")
! 19: if (value_list != "") value_list = value_list " "
! 20: value_list = value_list prefix $2
! 21: next
! 22: }
! 23:
! 24: value_list ~ /\.gz / && hfile ~ /compress/ {
! 25: exit
! 26: }
! 27:
! 28: value_list ~ /SCCS / && hfile ~ /cvsignore/ {
! 29: exit
! 30: }
! 31:
! 32: value_list = ""
! 33:
! 34: END {
! 35: if (value_list != "")
! 36: print heading "\n\n" define " \"" value_list "\"" > hfile
! 37: else {
! 38: print "Failed to find a value list in " ARGV[1] " for " hfile
! 39: exit 1
! 40: }
! 41: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>