3 # Extract all examples from the manual source.
4 # Copyright (C) 1992, 2005, 2006, 2007 Free Software Foundation, Inc.
6 # This script is for use with GNU awk.
23 printf(" -- %d file%s", seq, seq == 1 ? "" : "s");
28 node = substr(tmp[1], 7);
29 if (length(node) > 10)
30 printf("Node: %s - truncated", node);
32 printf("Node: %s ", node);
34 node = tolower(substr(node, 1, 10));
45 /^@comment status: / {
49 /^@comment options: / {
51 gsub ("@comment options:", "", options);
54 /^@example$/, /^@end example$/ {
57 if ($0 ~ /^@example$/) {
62 file = sprintf("%03d.%s", count, node);
63 printf("dnl @ %s:%d: Origin of test\n"\
64 "dnl @ expected status: %d\n"\
65 "dnl @ extra options: %s\n"\
66 "dnl @ Copyright (C) 2006, 2007 Free Software Foundation\n"\
67 "dnl @ This file is free software; the Free Software Foundation\n"\
68 "dnl @ gives unlimited permission to copy and/or distribute it\n"\
69 "dnl @ with or without modifications, as long as this notice\n"\
70 "dnl @ is preserved.\n", FILENAME, NR, status, options) > file;
75 if ($0 ~ /^@end example$/) {
82 if ($0 ~ /^@result\{\}/ || $0 ~ /^@error\{\}/)
89 gsub("@w{ }", " ", $0);
90 gsub("@tabchar{}", "\t", $0);
91 printf("%s%s\n", prefix, $0) >> file;