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.
25 printf(" -- %d file%s", seq, seq == 1 ? "" : "s");
30 node = substr(tmp[1], 7);
31 if (length(node) > 10)
32 printf("Node: %s - truncated", node);
34 printf("Node: %s ", node);
36 node = tolower(substr(node, 1, 10));
49 /^@comment status: / {
53 /^@comment options: / {
55 gsub ("@comment options:", "", options);
60 gsub ("@comment xout: ", "", xout);
65 gsub ("@comment xerr: ", "", xerr);
68 /^@example$/, /^@end example$/ {
71 if ($0 ~ /^@example$/) {
76 file = sprintf("%03d.%s", count, node);
77 printf("dnl @ %s:%d: Origin of test\n"\
78 "dnl @ expected status: %d\n"\
79 "dnl @ extra options: %s\n"\
80 "dnl @ Copyright (C) 2006, 2007 Free Software Foundation\n"\
81 "dnl @ This file is free software; the Free Software Foundation\n"\
82 "dnl @ gives unlimited permission to copy and/or distribute it\n"\
83 "dnl @ with or without modifications, as long as this notice\n"\
84 "dnl @ is preserved.\n", FILENAME, NR, status, options) > file;
86 printf("dnl @ expected output: %s\n", xout) > file;
88 printf("dnl @ expected error: %s\n", xerr) > file;
95 if ($0 ~ /^@end example$/) {
102 if ($0 ~ /^@result\{\}/ || $0 ~ /^@error\{\}/)
109 gsub("@w{ }", " ", $0);
110 gsub("@tabchar{}", "\t", $0);
111 printf("%s%s\n", prefix, $0) >> file;