From 542dec4ce18de0b9c3bfe7ea961e49e5fc559d6d Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 14 Feb 2002 22:49:57 +0000 Subject: The following changes are the beginning of the work on #71430. * examples/extract.sh, examples/extract.awk: Make extraction work. * examples/Makefile (SUBDIRS): Remove packer. * examples/packer/pack.c, examples/packer/Makefile: Removed. * docs/tutorial/gtk-tut.sgml: Fix the included examples far enough to make them compile and (mostly) work, remove the packer example. --- examples/extract.awk | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'examples/extract.awk') diff --git a/examples/extract.awk b/examples/extract.awk index a8fcba12db..25025f8e5b 100644 --- a/examples/extract.awk +++ b/examples/extract.awk @@ -6,8 +6,9 @@ # -c : Just do checking rather than output files # -f : Extract a specific file # -d : Extract files to current directory +# -v : Verbose -BEGIN {in_example=0; check=0; spec_example=""; do_output=0; flatten=0 +BEGIN {in_example=0; check=0; spec_example=""; do_output=0; flatten=0; verbose=0; for (i=0 ; i < ARGC ; i++) { if ( ARGV[i] == "-c" ) { check = 1; @@ -23,9 +24,12 @@ BEGIN {in_example=0; check=0; spec_example=""; do_output=0; flatten=0 } else if ( ARGV[i] == "-d" ) { flatten = 1; ARGV[i]=""; + } else if ( ARGV[i] == "-v" ) { + verbose = 1; + ARGV[i] = ""; } } - } +} $2 == "example-start" && in_example == 1 { printf("\nERROR: nested example at line %d\n", NR) > "/dev/stderr"; exit} @@ -43,11 +47,15 @@ $2 == "example-start" && check == 0 \ } else { file_name = $4; } + if (verbose == 1) + printf("%s\n", file_name); do_output=1; } } in_example==1 && check==0 && do_output==1 { gsub(/&/, "\\&", $0); + gsub(/</, "<", $0); + gsub(/>/, ">", $0); print $0 >file_name } $2 == "example-end" && in_example == 0 { printf("\nERROR: multiple ends at line %d\n", NR) > "/dev/stderr"; @@ -57,3 +65,5 @@ $2 == "example-end" { in_example=0; do_output=0 } END {} + + -- cgit v1.2.1