File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / rsync / define-from-md.awk
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Wed Mar 17 00:32:36 2021 UTC (3 years, 3 months ago) by misho
Branches: rsync, MAIN
CVS tags: v3_2_3, HEAD
rsync 3.2.3

    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>