Disable atimes on macOS.
[rsync.git] / help-from-md.awk
blob190079749687a396306be9b59892805b310842ad
1 #!/usr/bin/awk -f
3 # The caller must pass args: -v hfile=help-NAME.h NAME.NUM.md
5 BEGIN {
6 heading = "/* DO NOT EDIT THIS FILE! It is auto-generated from the option list in " ARGV[1] "! */"
7 findcomment = hfile
8 sub("\\.", "\\.", findcomment)
9 findcomment = "\\[comment\\].*" findcomment
10 backtick_cnt = 0
11 prints = ""
14 /^```/ {
15 backtick_cnt++
16 next
19 foundcomment {
20 if (backtick_cnt > 1) exit
21 if (backtick_cnt == 1) {
22 gsub(/"/, "\\\"")
23 prints = prints "\n rprintf(F,\"" $0 "\\n\");"
25 next
28 $0 ~ findcomment {
29 foundcomment = 1
30 backtick_cnt = 0
33 END {
34 if (foundcomment && backtick_cnt > 1)
35 print heading "\n" prints > hfile
36 else {
37 print "Failed to find " hfile " section in " ARGV[1]
38 exit 1