Permalink
Browse files

export phase 1 on Sat Aug 22 17:48:21 CEST 2009

  • Loading branch information...
1 parent 8a94c56 commit f6788c2853a11983a16f8d79c66586315bd94159 @jakobi committed Aug 22, 2009
Showing with 27,915 additions and 60 deletions.
  1. +58 −0 admin.misc/tracefacility-example.aixtrace.pl
  2. +1 −0 admin.misc/tracefacility-example.aixtrace.pl.name
  3. +64 −0 admin.text/00_ADMIN_TEXT.phtml
  4. +1 −0 admin.text/00_ADMIN_TEXT.phtml.name
  5. 0 admin.text/@freshmeat.skip
  6. +109 −0 admin.text/selectlines
  7. +1 −0 admin.text/selectlines.name
  8. +1,213 −0 admin.text/sfre
  9. +1 −0 admin.text/sfre.name
  10. +58 −0 admin.text/sfre.sfrerc
  11. +400 −0 admin.text/unescape.pl
  12. +1 −0 admin.text/unescape.pl.name
  13. +29 −10 cli.backup/00_BACKUP.phtml
  14. +1 −1 cli.backup/00_BACKUP.phtml.name
  15. +1 −0 cli.backup/@incomplete.skip
  16. +345 −0 cli.backup/expanfind
  17. +1 −0 cli.backup/expanfind.name
  18. +3 −2 cli.conf/00_EXAMPLE_CONFIGURATIONS.phtml
  19. +1 −0 cli.conf/mc.name
  20. +22 −0 cli.conf/mc/bashrc
  21. +827 −0 cli.conf/mc/bindings
  22. +131 −0 cli.conf/mc/ini
  23. +37 −3 cli.firefox/00_FIREFOX.phtml
  24. +300 −0 cli.firefox/firefox
  25. +3 −0 cli.firefox/firefox.-example
  26. +1 −0 cli.firefox/firefox.-example.name
  27. +1 −0 cli.firefox/firefox.name
  28. +123 −0 cli.firefox/firefoxcookies
  29. +1 −0 cli.firefox/firefoxcookies.name
  30. +35 −0 cli.firefox/firefoxdelta
  31. +1 −0 cli.firefox/firefoxdelta.name
  32. +251 −0 cli.firefox/firefoxgrep
  33. +1 −0 cli.firefox/firefoxgrep.name
  34. +111 −0 cli.firefox/firefoxgrephtml
  35. +1 −0 cli.firefox/firefoxgrephtml.name
  36. +248 −0 cli.firefox/firefoxgrepsqlite
  37. +1 −0 cli.firefox/firefoxgrepsqlite.name
  38. +223 −0 cli.firefox/firefoxsessionlist
  39. +1 −0 cli.firefox/firefoxsessionlist.name
  40. +257 −0 cli.firefox/firefoxstdin
  41. +1 −0 cli.firefox/firefoxstdin.name
  42. +125 −0 cli.firefox/userChrome.css
  43. +1 −0 cli.firefox/userChrome.css.name
  44. +10 −5 cli.html/00_HTML-PROCESSING.phtml
  45. +1 −1 cli.html/00_HTML-PROCESSING.phtml.name
  46. +594 −0 cli.html/COLLECT
  47. +1 −0 cli.html/COLLECT.name
  48. +401 −0 cli.html/DIFF
  49. +1 −0 cli.html/DIFF.name
  50. +307 −0 cli.html/DIFFTREE
  51. +1 −0 cli.html/DIFFTREE.name
  52. +195 −0 cli.html/LINKS
  53. +1 −0 cli.html/LINKS.name
  54. +178 −0 cli.html/XLINKS
  55. +1 −0 cli.html/XLINKS.name
  56. +901 −0 cli.html/db_cgi.p
  57. +1 −0 cli.html/db_cgi.p.name
  58. +1 −0 cli.html/dir2html-modern-day-version.name
  59. +56 −0 cli.html/dir2html-modern-day-version/base.epl.raw
  60. +1 −0 cli.html/dir2html-modern-day-version/base.epl.raw.name
  61. +71 −0 cli.html/dir2html-modern-day-version/dir2array.pl
  62. +165 −0 cli.html/dir2html-modern-day-version/exportscript
  63. +1 −0 cli.html/dir2html-modern-day-version/exportscript.name
  64. +60 −0 cli.html/dir2html-modern-day-version/gitfilelist.epl.raw
  65. +1 −0 cli.html/dir2html-modern-day-version/gitfilelist.epl.raw.name
  66. +7 −0 cli.html/dir2html-modern-day-version/gitfilelist.head.epl.raw
  67. +1 −0 cli.html/dir2html-modern-day-version/gitfilelist.head.epl.raw.name
  68. +68 −0 cli.html/dir2html-modern-day-version/index.phtml.raw
  69. +1 −0 cli.html/dir2html-modern-day-version/index.phtml.raw.name
  70. +644 −0 cli.html/dir2html.pl
  71. +1 −0 cli.html/dir2html.pl.name
  72. +248 −0 cli.html/domain.codes.txt
  73. +1 −0 cli.html/domain.codes.txt.name
  74. +35 −0 cli.html/htmlcheck
  75. +1 −0 cli.html/htmlcheck.name
  76. +8 −0 cli.html/htmlcheck.tum.cfg
  77. +908 −0 cli.html/htmlchek.awk
  78. +1,505 −0 cli.html/htmlchek.pl
  79. +55 −0 cli.html/htmlchek.sh
  80. +47 −0 cli.html/htmlchkp.sh
  81. +29 −0 cli.html/remcr
  82. +1 −0 cli.html/remcr.name
  83. +347 −0 cli.html/sub.mime
  84. +1 −0 cli.html/sub.mime.name
  85. +10 −2 cli.list.grep/00_LISTPROCESSING.phtml
  86. 0 cli.list.grep/@freshmeat.skip
  87. +1 −1 cli.list.grep/Compact_pm/Grep.pm.name
  88. +111 −0 cli.list.grep/cat0
  89. +1 −0 cli.list.grep/cat0.name
  90. +307 −0 cli.list.grep/cat0par
  91. +1 −0 cli.list.grep/cat0par.name
  92. +307 −0 cli.list.grep/expansyn
  93. +7 −0 cli.list.grep/expansyn.cfg
  94. +1 −0 cli.list.grep/expansyn.cfg.name
  95. +1 −0 cli.list.grep/expansyn.name
  96. +101 −0 cli.list.grep/hlgrep
  97. +1 −0 cli.list.grep/hlgrep.name
  98. +11 −0 cli.list.grep/nl0
  99. +1 −0 cli.list.grep/nl0.name
  100. +12 −0 cli.list.grep/xargs0
  101. +1 −0 cli.list.grep/xargs0.name
  102. +15 −13 cli.list.rename/00_MASS-RENAME.phtml
  103. 0 cli.list.rename/@freshmeat.skip
  104. +1 −1 cli.list.rename/emv.name
  105. +9 −0 cli.list.rename/emvp
  106. +1 −0 cli.list.rename/emvp.name
  107. +41 −0 cli.list.rename/emvp0
  108. +1 −0 cli.list.rename/emvp0.name
  109. +38 −0 cli.list.rename/emvs
  110. +1 −0 cli.list.rename/emvs.name
  111. +50 −0 cli.list.rename/emvx
  112. +1 −0 cli.list.rename/emvx.name
  113. +1,132 −0 cli.list.rename/myrename
  114. +178 −0 cli.list.rename/myrename.mangle
  115. +1 −0 cli.list.rename/myrename.mangle.name
  116. +1 −0 cli.list.rename/myrename.name
  117. +65 −0 cli.list.rename/myrename.quote
  118. +1 −0 cli.list.rename/myrename.quote.name
  119. +1 −1 cli.list.tagls/00_TAGS_AND_COMMANDLINE.phtml
  120. 0 cli.list.tagls/@freshmeat.skip
  121. +905 −0 cli.list.tagls/tagls
  122. +1 −0 cli.list.tagls/tagls.name
  123. +87 −0 cli.list.tagls/taglsc
  124. +42 −0 cli.list.tagls/taglsc.cfg
  125. +1 −0 cli.list.tagls/taglsc.name
  126. +15 −0 cli.list.tagls/taglsgrep
  127. +1 −0 cli.list.tagls/taglsgrep.name
  128. +2 −5 cli.list.various/00_LISTPROCESSING2.phtml
  129. +92 −0 cli.list.various/USR1tail
  130. +1 −0 cli.list.various/USR1tail.name
  131. +8 −0 cli.list.various/args
  132. +1 −0 cli.list.various/args.name
  133. +99 −0 cli.list.various/busythreadtail.p
  134. +1 −0 cli.list.various/busythreadtail.p.name
  135. +78 −0 cli.list.various/ddnonblock
  136. +1 −0 cli.list.various/ddnonblock.name
  137. +12 −0 cli.list.various/ddsponge
  138. +1 −0 cli.list.various/ddsponge.name
  139. +2 −0 cli.list.various/echo2cat
  140. +1 −0 cli.list.various/echo2cat.name
  141. +132 −0 cli.list.various/line.print
  142. +1 −0 cli.list.various/line.print.name
  143. +179 −0 cli.list.various/line.replace
  144. +1 −0 cli.list.various/line.replace.name
  145. +250 −0 cli.list.various/pfind
  146. +1 −0 cli.list.various/pfind.name
  147. +19 −0 cli.list.various/pipe.filerequest.gtk2
  148. +1 −0 cli.list.various/pipe.filerequest.gtk2.name
  149. +92 −0 cli.list.various/pipe.select.curses
  150. +1 −0 cli.list.various/pipe.select.curses.name
  151. +84 −0 cli.list.various/pipe.select.gtk2
  152. +1 −0 cli.list.various/pipe.select.gtk2.name
  153. +68 −0 cli.list.various/randomcat
  154. +1 −0 cli.list.various/randomcat.name
  155. +2 −0 cli.list.various/randomecho
  156. +1 −0 cli.list.various/randomecho.name
  157. +154 −0 cli.list.various/range
  158. +1 −0 cli.list.various/range.name
  159. +37 −0 cli.list.various/revdatesort
  160. +1 −0 cli.list.various/revdatesort.name
  161. +37 −0 cli.list.various/sort.ip4
  162. +1 −0 cli.list.various/sort.ip4.name
  163. +217 −0 cli.list.various/teefork
  164. +1 −0 cli.list.various/teefork.name
  165. +276 −0 cli.list.various/xchange.pl
  166. +1 −0 cli.list.various/xchange.pl.name
  167. +5 −4 cli.mail/00_MAIL_SUPPORTSCRIPTS.phtml
  168. +3,025 −0 cli.mail/mygrepmail
  169. +1 −0 cli.mail/mygrepmail.name
  170. +9 −7 cli.processes/00_PROCESS+EVENT-HANDLING.phtml
  171. +1 −1 cli.processes/00_PROCESS+EVENT-HANDLING.phtml.name
  172. 0 cli.processes/@freshmeat.skip
  173. +134 −0 cli.processes/fwait
  174. +1 −0 cli.processes/fwait.name
  175. +12 −0 cli.processes/pwait
  176. +447 −0 cli.processes/waitcond
  177. +1 −0 cli.processes/waitcond.name
  178. +358 −0 cli.processes/waitcond.timeout
  179. +1 −0 cli.processes/waitcond.timeout.name
  180. +350 −0 cli.processes/zap
  181. +1 −0 cli.processes/zap.name
  182. +66 −0 cli.shell.functions/shell/00_ksh.func
  183. +127 −0 cli.shell.functions/shell/00_lib.func
  184. +1 −0 cli.shell.functions/shell/00_lib.func.name
  185. +67 −0 cli.shell.functions/shell/01_initialize.func
  186. +29 −0 cli.shell.functions/shell/02_customize.func
  187. +62 −0 cli.shell.functions/shell/LOAD
  188. +1 −0 cli.shell.functions/shell/LOAD.name
  189. +44 −0 cli.shell.functions/shell/auth.func
  190. +303 −0 cli.shell.functions/shell/cd.dyndirstack_bash.func
  191. +1 −0 cli.shell.functions/shell/cd.dyndirstack_bash.func.name
  192. +67 −0 cli.shell.functions/shell/cd.func
  193. +569 −0 cli.shell.functions/shell/cd.nico_cd_for_bash_and_ksh.func
  194. +1 −0 cli.shell.functions/shell/cd.nico_cd_for_bash_and_ksh.func.name
  195. +52 −0 cli.shell.functions/shell/color.func
  196. +81 −0 cli.shell.functions/shell/dict.func
  197. +53 −0 cli.shell.functions/shell/grep.func
  198. +9 −0 cli.shell.functions/shell/mail.func
  199. +29 −0 cli.shell.functions/shell/media.func
  200. +13 −0 cli.shell.functions/shell/misc.func
  201. +61 −0 cli.shell.functions/shell/promptcdtitledisplay.func
  202. +57 −0 cli.shell.functions/shell/text.func
  203. +21 −0 cli.shell.functions/shell/zz_finalize.func
  204. +40 −0 cli.various/00_VARIOUS.phtml
  205. +1 −0 cli.various/00_VARIOUS.phtml.name
  206. +91 −0 cli.various/ALARM
  207. +1 −0 cli.various/ALARM.name
  208. +4 −0 cli.various/ALERTCLR
  209. +1 −0 cli.various/ALERTCLR.name
  210. +47 −0 cli.various/ALERTOSD
  211. +1 −0 cli.various/ALERTOSD.name
  212. +40 −0 cli.various/date.before
  213. +1 −0 cli.various/date.before.name
  214. +11 −0 cli.various/df.minfree
  215. +1 −0 cli.various/df.minfree.name
  216. +54 −0 cli.various/diff.p
  217. +1 −0 cli.various/diff.p.name
  218. +67 −0 cli.various/fdupes/NOTES
  219. +1 −0 cli.various/fdupes/NOTES.name
  220. +30 −0 cli.various/fdupes/fdupes.expand
  221. +27 −0 cli.various/fdupes/fdupes.grepv
  222. +23 −0 cli.various/fdupes/fdupes.head
  223. +35 −0 cli.various/fdupes/fdupes.relink
  224. +15 −0 cli.various/fdupes/fdupes.size
  225. +7 −0 cli.various/fdupes/fdupes.sort.lex
  226. +7 −0 cli.various/fdupes/fdupes.sort.size
  227. +67 −0 cli.various/gunzipmemberextract
  228. +1 −0 cli.various/gunzipmemberextract.name
  229. +92 −0 cli.various/gzip.rfix
  230. +1 −0 cli.various/gzip.rfix.name
  231. +159 −0 cli.various/mt_dir
  232. +12 −0 cli.various/mt_dir.cfg
  233. +1 −0 cli.various/mt_dir.name
  234. +395 −0 cli.various/paradj
  235. +1 −0 cli.various/paradj.name
  236. +51 −0 cli.various/printing/lpr
  237. +1 −0 cli.various/printing/lpr.name
  238. +67 −0 cli.various/printing/myenscript
  239. +1 −0 cli.various/printing/myenscript.name
  240. +110 −0 cli.various/printing/mypsnup
  241. +1 −0 cli.various/printing/mypsnup.name
  242. +47 −0 cli.various/repeat
  243. +1 −0 cli.various/repeat.name
  244. +90 −0 cli.various/sanitize_filenames
  245. +1 −0 cli.various/sanitize_filenames.name
  246. +4 −0 cli.various/sleep.pl
  247. +1 −0 cli.various/sleep.pl.name
  248. +125 −0 cli.various/sleepuntil
  249. +1 −0 cli.various/sleepuntil.name
  250. +2,046 −0 cli.various/term.reset
  251. +1 −0 cli.various/term.reset.name
  252. +247 −0 cli.various/watchfloat
  253. +1 −0 cli.various/watchfloat.name
  254. +195 −0 cli.various/zappend.p
  255. +1 −0 cli.various/zappend.p.name
  256. +96 −0 hw.tablet/rotate.sh
  257. +1 −0 hw.tablet/rotate.sh.name
  258. +3 −2 vim/00_VIM.phtml
  259. +1 −1 vim/00_VIM.phtml.name
  260. +1 −0 vim/@incomplete.skip
  261. +102 −0 vim/pipe.vim
  262. +1 −0 vim/pipe.vim.name
  263. +31 −0 vim/vimless
  264. +208 −0 vim/vimscript
  265. +1 −0 vim/vimscript.name
  266. +13 −0 vim/vimscript.range
@@ -0,0 +1,58 @@
+#!/usr/bin/perl
+
+# trace one command (assuming sufficently large trace buffer, etc)
+# USAGE: $0 [-e PERLREGEX] [-E PERLEXPR] /ABSOLUTE/PATH/TO/COMMAND COMMAND/ARGUMENTS
+
+# PJ20020128, roughly based on AIX Survivalguide p345.
+
+# BUGS:
+# - does not add -f/-F options to automatically select/follow forks
+# - does not do concurrent tracing
+# - does not do -p PID (use /usr/bin/sleep instead and grep for
+# processes of interest)
+
+$|=1;
+args: while (1) {
+ if ($ARGV[0] eq '-') { shift; last args}
+ elsif ($ARGV[0] eq '-E'){ shift; do "$ARGV[0]"; die "$@" if $@; shift}
+ elsif ($ARGV[0] eq '-e'){ shift; $REGEX=$ARGV[0]; eval{/$REGEX/}; die "$@" if $@; shift}
+ elsif ($ARGV[0] eq '-h'){ shift; &help; exit 1}
+ else{ last args; }
+}
+
+ $FILE_HOOKS="107,12E,130,15B,163,19C";
+$SYSCALL_HOOKS="101";
+ $KERNEL_HOOKS="134,135,139";
+ $HOOKS=join(",", $FILE_HOOKS, $SYSCALL_HOOKS, $KERNEL_HOOKS);
+ $REPORT_OPTS="ids=off,exec=on,pid=on,svc=on,pagesize=0,timestamp=3";
+ $REPORT_FLAGS="-v -x";
+
+# default, unless -e: look for lines starting with basename of program
+$REGEX="^".quotemeta($1) if not $REGEX and $ARGV[0]=~m@.*/(.*)@;
+
+$date=`date +%Y%m%d%H%M%S`; chomp $date;
+$TMP="/tmp/tracelog.$date";
+print "LOG: $TMP\n";
+print "\n";
+
+system("trace -a -d -j $HOOKS; trcon");
+system @ARGV; # tough, I am just too lazy to requote the args we got...
+system("trcstop");
+system("echo; trcrpt $REPORT_FLAGS -O $REPORT_OPTS > $TMP");
+
+system("head -12 $TMP");
+open(FH, "<$TMP") or die "no trace file";
+while(<FH>) {
+ next if /^trace/o;
+ next if /^trcstop/o;
+ next if $REGEX and not /$REGEX/o;
+ print
+}
+close FH;
+
+exit 0;
+
+########################################
+sub help { system "grep US"."AGE $0"; exit 1}
+
+
@@ -0,0 +1 @@
+experimental - restricting aix tracefacility (AIX5+: use strace instead)
@@ -0,0 +1,64 @@
+[*
+ $ENV{__EMB_EXTRATITLE}="System-Administration / Editing";
+ $ENV{__EMB_COUNT}++;
+ if (1==$ENV{__EMB_COUNT}) {
+ Execute('base.epl');
+ } else {
+*]
+
+<p>Most of the stuff is too specific. Otherwise the stuff's waiting
+for a rewrite before being again (while hoping to stay retired, when a
+suitable group-maintained pendant is can be found).</p>
+
+<p>sfre is a slightly different case, it's an itch from previous
+projects, where being unable to ask (night-time, holidays, whatever)
+lead to time-consuming double-checks. Now wouldn't it be nice to find
+such information about already execute tasks, changes and
+modifications in a single location on the system in question? Note
+that sfre substitutes for a versioning system or a tool like cfengine
+only in the most trivial of cases, it's real purpose is to complement
+proper system management tools, and in addition provide a fail-safe
+for those dusty corners where use of proper tools like cfengine hasn't
+been implemented yet.</p>
+
+<p><i>I'm currently using sfre as $EDITOR, $VISUAL
+and as a replacement for vi (albeit with a call to the real vi later
+on); it's quite painful to be asked all the time for sane log messages
+when opening a vi without files or doing a git commit. This translates
+into a growing list of changes like implementing a command blacklist
+for file locking and journaling. For now it's still a bit too annoying
+to be used for accounts other than root.</i></p>
+
+
+<H3>Commands</H3>
+
+<ul>
+ <li><b>selectlines</b> , a version of the classic to select/deselect lines according
+ to embedded directives, while copying the sourcefile. Useful for trivial cases,
+ provided you switch to more suitable tools for heavier lifting.
+ <li><B>systemflightrecorderedit (sfre)</B> - sfre tries to sequence file
+ edits and augment group memory in concurrent file change scenarios like
+ multiple root users plus cron jobs. For each edit (or more generally
+ any arbitrary command given with the -e option) sfre logs a description
+ to a journal, f-locks the plain file arguments of the command and uses
+ changetrack to backup changes. It also supports lookup/diff of files
+ from a changetrack backupdir by date, revision number or symbolic name
+ allowing all options of the cat or diff commands (e.g. all GNU diff
+ options instead of just the small subset of options available via rcsdiff).<BR>
+ Dependencies: changetrack (changetrack.sf.net) and lock.pl/Flock.pm.
+ <li><B>unescape.pl</b> strips some of the line noise from script typescripts.
+ Modified version with prompt guessing, tries to remove e.g. vim session.
+ Using a tool like this may make typescripts somewhat more usable as a base
+ for documentation.
+</ul>
+
+<p>See also:</p>
+<ul>
+ <li>vimsh as helper for system documentation / documentation creation taken
+ from session transcripts: see the vimsh script from vim.org for a non-typescript
+ approach (non-interactive commands only, unless you use some kind
+ of pty splitter in combination with say urxvt -pty or screen; I've a demo
+ of both, but first I want to patch some more comfort into vimsh for this kind of usage).
+</ul>
+
+[*}*][# MUST BE AT EOF! #]
@@ -0,0 +1 @@
+introduction to sfre and other tools for config file 'editing'
No changes.
View
@@ -0,0 +1,109 @@
+#!/usr/bin/perl
+
+# 1999XXXX PJ 0.1 jakobi@acm.org initial version
+# 20090729 PJ 0.2
+#
+# copyright: (c) 1999-2009 jakobi@acm.org, placed under GPL v3 or later
+my $version="0.2";
+
+# just a quick hack to select lines acc. to argument settings,
+# e.g. for extracting a specific configuration from a multi
+# configuration master file.
+
+# example data file X
+# alpha
+# beta ##SELECT!charly:$delta:echo
+# gamma
+# bravo ##SELECT:a ##select b
+# example usage:
+# ./selectlines -e '$delta="foxtrott"' charly X # deselects and does not print beta
+# ./selectlines -e '$delta="foxtrott"' not_matched X # does not print beta
+# ./selectlines -e '$delta="foxtrott"' foxtrott X # selects and does print beta
+# ./selectlines 'PATTERN|a|b' X # selects bravo (both a and b must be
+# # a part of selectlines argument)
+#
+# this line is true unless gamma ##SELECT!gamma:ALWAYS: - always is REQUIRED
+# whitespace is kept if SELECT ends with a :, otherwise trailing or leading whitespace is removed
+
+$VARCHAR='[a-z0-9A-Z_{}]'; # lower AND uppercase, allow {} to access ENV
+
+args: while (1) {
+ if ($ARGV[0] eq '-') { shift; last args; }
+ elsif ($ARGV[0] eq '-e'){ shift; $_=shift; eval($_); warn $@ if $@; }
+ elsif ($ARGV[0] eq '-c'){ shift; $_=shift; do $_; warn $@ if $@;}
+ elsif ($ARGV[0] eq '-v'){ shift; $verbose++; }
+ elsif ($ARGV[0] eq '-h'){ shift; &help; exit 1; }
+ elsif ($ARGV[0] eq '-o'){ shift; $outputfile=shift; }
+ else { last args; }
+}
+$select=shift;
+die "$0: no pattern??" if not $select=~/\S/;
+
+while(<>) {
+ # expand variables outside of the tags themselves.
+ while(s@##SELECTVAR:(\$$VARCHAR+)##@$1@gmee){;}
+ # expand any variables in SELECT TAGS
+ while(s@(##SELECT(?:(?:[!:]$VARCHAR*)*))([!:])\$($VARCHAR+)((?:(?:[!:][$]?$VARCHAR*)*)(?:$|\s))@do{"$1$2${$3}$4"}@gme){;}
+ $output.="# // $_" if $verbose;
+ # and print the line
+ while(s@(##SELECT(?:(?:[!:]$VARCHAR*)*))@@) {
+ $m=$1;
+ (not $m=~m@##SELECT((?:[!:]$VARCHAR*)*?)+($|\s)@m or # 1. print line if no selector
+ ( $m=~m@##SELECT((?:[!:]$VARCHAR*)*?):(?:$select)(:|!|\s|$)@m or # 2a. line is selected and
+ $m=~m@##SELECT((?:[!:]$VARCHAR*)*?):ALWAYS(:|!|\s|$)@m
+ ) and not
+ ( $m=~m@##SELECT((?:[!:]$VARCHAR*)*?)!(?:$select)(:|!|\s|$)@m or # 2b. selected line from 2a
+ $m=~m@##SELECT((?:[!:]$VARCHAR*)*?):NEVER(:|!|\s|$)@m # is not deselected
+ ) # success
+ ) or $_=""; # or failure
+ }
+ $output.=$_;
+}
+
+if ($outputfile) {
+ if ($output!~/\S/) {
+ die "$0: no output??"
+ } else {
+ open(FH, ">$outputfile") || die "$0: cannot open $outputfile";
+ print FH $output;
+ }
+ exit 0;
+} else {
+ print $output;
+ exit 0;
+}
+
+sub help {
+ print <<'EOF';
+selectlines [OPTIONS] PATTERN FILE ... > FILE
+
+selectlines copies input to output while selecting or deselecting
+lines containing a special PATTERN of the form ##SELECT([:!]STRING)+,
+where ! deselects a line if !PATTERN matches !STRING: for example
+:STRING1!STRING3!STRING4:STRING2 corresponds to (:STRING1 OR :STRING2)
+AND NOT !STRING3 AND NOT !STRING4) - we select the line if one of
+strings 1 or 2 occurs but neither strings 3 nor 4.
+
+:ALWAYS is always selected unless deselected. :NEVER is always
+deselected, regardless of other values. A line with multiple
+##SELECTs is only printed if all select. WARNING: negation is NOT
+boolean but rather a final grep -v! (see e.g. resolv.conf.master.pj)
+
+STRING must be a (possibly empty) alpha-numeric string or a
+alpha-numeric variable name beginning with $ ($ENV{LOGNAME} et al is
+also ok).
+
+Perl variables can also be used outside of the SELECT tags: e.g.
+##SELECTVAR:$ENV{LOGNAME}##.
+
+[does this need to be expanded to be able to invoke shell commands,
+too??]
+
+Options:
+ -c F load config file F
+ -e E eval expression E
+ -h help
+ -o F output to file F instead of STDOUT
+ -v verbosity
+EOF
+}
@@ -0,0 +1 @@
+copy config files from templates, with line(de)selection
Oops, something went wrong.

0 comments on commit f6788c2

Please sign in to comment.