[SCM] The rsync repository. - branch master updated
Rsync CVS commit messages
rsync-cvs at lists.samba.org
Mon Jun 15 01:54:22 UTC 2020
The branch, master has been updated
via 775f64f4 Add a warning header to the generated help-*.h files.
from 660274bf A few more md -> html improvements
https://git.samba.org/?p=rsync.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 775f64f4b8a9afdd73e1e4e8aba06944e58d1d14
Author: Wayne Davison <wayne at opencoder.net>
Date: Sun Jun 14 18:49:38 2020 -0700
Add a warning header to the generated help-*.h files.
-----------------------------------------------------------------------
Summary of changes:
Makefile.in | 9 +--------
help-from-md | 33 +++++++++++++++++++++++++++++++++
2 files changed, 34 insertions(+), 8 deletions(-)
create mode 100755 help-from-md
Changeset truncated at 500 lines:
diff --git a/Makefile.in b/Makefile.in
index f6dd515b..a0681c89 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -104,14 +104,7 @@ options.o: latest-year.h help-rsync.h help-rsyncd.h
flist.o: rounding.h
help-rsync.h help-rsyncd.h: rsync.1.md
- @sed -e '1,/^\[comment\].*$@/d' \
- -e '1,/^```/d' \
- -e '/^```/,$$d' \
- -e 's/"/\\"/g' \
- -e 's/^/ rprintf(F,"/' \
- -e 's/$$/\\n");/' \
- <"$(srcdir)/$<" >$@
- @if ! test -s $@; then rm -f $@ ; echo "The Makefile generated an empty file: $@" ; exit 1 ; fi
+ ./help-from-md "$(srcdir)/$<" $@
rounding.h: rounding.c rsync.h proto.h
@for r in 0 1 3; do \
diff --git a/help-from-md b/help-from-md
new file mode 100755
index 00000000..21f49cd2
--- /dev/null
+++ b/help-from-md
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+if [[ "$#" != 2 ]]; then
+ echo "Usage: $0 MD_FILE HELP_FILE.h"
+ exit 1
+fi
+
+mdfile="$1"
+helpfile="$2"
+newfile="$helpfile.new"
+findfile="${helpfile/./\\.}"
+
+sed -e '1,/^\[comment\].*'"$findfile"'/d' \
+ -e '1,/^```/d' \
+ -e '/^```/,$d' \
+ -e 's/"/\\"/g' \
+ -e 's/^/ rprintf(F,"/' \
+ -e 's/$/\\n");/' \
+ <"$mdfile" >"$newfile"
+
+if [[ ! -s "$newfile" ]]; then
+ rm "$newfile"
+ echo "Discarding empty output for $helpfile file from $mdfile"
+ exit 1
+fi
+
+(cat <<EOT
+/* DO NOT EDIT THIS FILE! It is auto-generated from the option list in $mdfile! */
+
+EOT
+cat "$newfile"
+) >"$helpfile"
+rm "$newfile"
--
The rsync repository.
More information about the rsync-cvs
mailing list