diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/kallsyms.c | 76 | ||||
-rwxr-xr-x | scripts/kernel-doc | 49 | ||||
-rwxr-xr-x | scripts/makeman | 185 | ||||
-rwxr-xr-x | scripts/split-man | 112 |
4 files changed, 96 insertions, 326 deletions
diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 090ffda4adbc..fe11df83d1fc 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c | |||
@@ -69,6 +69,7 @@ static struct sym_entry *table; | |||
69 | static int size, cnt; | 69 | static int size, cnt; |
70 | static unsigned long long _stext, _etext, _sinittext, _einittext; | 70 | static unsigned long long _stext, _etext, _sinittext, _einittext; |
71 | static int all_symbols = 0; | 71 | static int all_symbols = 0; |
72 | static char symbol_prefix_char = '\0'; | ||
72 | 73 | ||
73 | struct token { | 74 | struct token { |
74 | unsigned char data[MAX_TOK_SIZE]; | 75 | unsigned char data[MAX_TOK_SIZE]; |
@@ -93,7 +94,7 @@ unsigned char best_table_len[256]; | |||
93 | static void | 94 | static void |
94 | usage(void) | 95 | usage(void) |
95 | { | 96 | { |
96 | fprintf(stderr, "Usage: kallsyms [--all-symbols] < in.map > out.S\n"); | 97 | fprintf(stderr, "Usage: kallsyms [--all-symbols] [--symbol-prefix=<prefix char>] < in.map > out.S\n"); |
97 | exit(1); | 98 | exit(1); |
98 | } | 99 | } |
99 | 100 | ||
@@ -112,6 +113,7 @@ static int | |||
112 | read_symbol(FILE *in, struct sym_entry *s) | 113 | read_symbol(FILE *in, struct sym_entry *s) |
113 | { | 114 | { |
114 | char str[500]; | 115 | char str[500]; |
116 | char *sym; | ||
115 | int rc; | 117 | int rc; |
116 | 118 | ||
117 | rc = fscanf(in, "%llx %c %499s\n", &s->addr, &s->type, str); | 119 | rc = fscanf(in, "%llx %c %499s\n", &s->addr, &s->type, str); |
@@ -123,27 +125,32 @@ read_symbol(FILE *in, struct sym_entry *s) | |||
123 | return -1; | 125 | return -1; |
124 | } | 126 | } |
125 | 127 | ||
128 | sym = str; | ||
129 | /* skip prefix char */ | ||
130 | if (symbol_prefix_char && str[0] == symbol_prefix_char) | ||
131 | sym++; | ||
132 | |||
126 | /* Ignore most absolute/undefined (?) symbols. */ | 133 | /* Ignore most absolute/undefined (?) symbols. */ |
127 | if (strcmp(str, "_stext") == 0) | 134 | if (strcmp(sym, "_stext") == 0) |
128 | _stext = s->addr; | 135 | _stext = s->addr; |
129 | else if (strcmp(str, "_etext") == 0) | 136 | else if (strcmp(sym, "_etext") == 0) |
130 | _etext = s->addr; | 137 | _etext = s->addr; |
131 | else if (strcmp(str, "_sinittext") == 0) | 138 | else if (strcmp(sym, "_sinittext") == 0) |
132 | _sinittext = s->addr; | 139 | _sinittext = s->addr; |
133 | else if (strcmp(str, "_einittext") == 0) | 140 | else if (strcmp(sym, "_einittext") == 0) |
134 | _einittext = s->addr; | 141 | _einittext = s->addr; |
135 | else if (toupper(s->type) == 'A') | 142 | else if (toupper(s->type) == 'A') |
136 | { | 143 | { |
137 | /* Keep these useful absolute symbols */ | 144 | /* Keep these useful absolute symbols */ |
138 | if (strcmp(str, "__kernel_syscall_via_break") && | 145 | if (strcmp(sym, "__kernel_syscall_via_break") && |
139 | strcmp(str, "__kernel_syscall_via_epc") && | 146 | strcmp(sym, "__kernel_syscall_via_epc") && |
140 | strcmp(str, "__kernel_sigtramp") && | 147 | strcmp(sym, "__kernel_sigtramp") && |
141 | strcmp(str, "__gp")) | 148 | strcmp(sym, "__gp")) |
142 | return -1; | 149 | return -1; |
143 | 150 | ||
144 | } | 151 | } |
145 | else if (toupper(s->type) == 'U' || | 152 | else if (toupper(s->type) == 'U' || |
146 | is_arm_mapping_symbol(str)) | 153 | is_arm_mapping_symbol(sym)) |
147 | return -1; | 154 | return -1; |
148 | 155 | ||
149 | /* include the type field in the symbol name, so that it gets | 156 | /* include the type field in the symbol name, so that it gets |
@@ -177,6 +184,11 @@ symbol_valid(struct sym_entry *s) | |||
177 | "_SDA2_BASE_", /* ppc */ | 184 | "_SDA2_BASE_", /* ppc */ |
178 | NULL }; | 185 | NULL }; |
179 | int i; | 186 | int i; |
187 | int offset = 1; | ||
188 | |||
189 | /* skip prefix char */ | ||
190 | if (symbol_prefix_char && *(s->sym + 1) == symbol_prefix_char) | ||
191 | offset++; | ||
180 | 192 | ||
181 | /* if --all-symbols is not specified, then symbols outside the text | 193 | /* if --all-symbols is not specified, then symbols outside the text |
182 | * and inittext sections are discarded */ | 194 | * and inittext sections are discarded */ |
@@ -190,17 +202,17 @@ symbol_valid(struct sym_entry *s) | |||
190 | * they may get dropped in pass 2, which breaks the kallsyms | 202 | * they may get dropped in pass 2, which breaks the kallsyms |
191 | * rules. | 203 | * rules. |
192 | */ | 204 | */ |
193 | if ((s->addr == _etext && strcmp(s->sym + 1, "_etext")) || | 205 | if ((s->addr == _etext && strcmp(s->sym + offset, "_etext")) || |
194 | (s->addr == _einittext && strcmp(s->sym + 1, "_einittext"))) | 206 | (s->addr == _einittext && strcmp(s->sym + offset, "_einittext"))) |
195 | return 0; | 207 | return 0; |
196 | } | 208 | } |
197 | 209 | ||
198 | /* Exclude symbols which vary between passes. */ | 210 | /* Exclude symbols which vary between passes. */ |
199 | if (strstr(s->sym + 1, "_compiled.")) | 211 | if (strstr(s->sym + offset, "_compiled.")) |
200 | return 0; | 212 | return 0; |
201 | 213 | ||
202 | for (i = 0; special_symbols[i]; i++) | 214 | for (i = 0; special_symbols[i]; i++) |
203 | if( strcmp(s->sym + 1, special_symbols[i]) == 0 ) | 215 | if( strcmp(s->sym + offset, special_symbols[i]) == 0 ) |
204 | return 0; | 216 | return 0; |
205 | 217 | ||
206 | return 1; | 218 | return 1; |
@@ -225,9 +237,15 @@ read_map(FILE *in) | |||
225 | 237 | ||
226 | static void output_label(char *label) | 238 | static void output_label(char *label) |
227 | { | 239 | { |
228 | printf(".globl %s\n",label); | 240 | if (symbol_prefix_char) |
241 | printf(".globl %c%s\n", symbol_prefix_char, label); | ||
242 | else | ||
243 | printf(".globl %s\n", label); | ||
229 | printf("\tALGN\n"); | 244 | printf("\tALGN\n"); |
230 | printf("%s:\n",label); | 245 | if (symbol_prefix_char) |
246 | printf("%c%s:\n", symbol_prefix_char, label); | ||
247 | else | ||
248 | printf("%s:\n", label); | ||
231 | } | 249 | } |
232 | 250 | ||
233 | /* uncompress a compressed symbol. When this function is called, the best table | 251 | /* uncompress a compressed symbol. When this function is called, the best table |
@@ -665,6 +683,13 @@ static void optimize_token_table(void) | |||
665 | 683 | ||
666 | insert_real_symbols_in_table(); | 684 | insert_real_symbols_in_table(); |
667 | 685 | ||
686 | /* When valid symbol is not registered, exit to error */ | ||
687 | if (good_head.left == good_head.right && | ||
688 | bad_head.left == bad_head.right) { | ||
689 | fprintf(stderr, "No valid symbol.\n"); | ||
690 | exit(1); | ||
691 | } | ||
692 | |||
668 | optimize_result(); | 693 | optimize_result(); |
669 | } | 694 | } |
670 | 695 | ||
@@ -672,9 +697,21 @@ static void optimize_token_table(void) | |||
672 | int | 697 | int |
673 | main(int argc, char **argv) | 698 | main(int argc, char **argv) |
674 | { | 699 | { |
675 | if (argc == 2 && strcmp(argv[1], "--all-symbols") == 0) | 700 | if (argc >= 2) { |
676 | all_symbols = 1; | 701 | int i; |
677 | else if (argc != 1) | 702 | for (i = 1; i < argc; i++) { |
703 | if(strcmp(argv[i], "--all-symbols") == 0) | ||
704 | all_symbols = 1; | ||
705 | else if (strncmp(argv[i], "--symbol-prefix=", 16) == 0) { | ||
706 | char *p = &argv[i][16]; | ||
707 | /* skip quote */ | ||
708 | if ((*p == '"' && *(p+2) == '"') || (*p == '\'' && *(p+2) == '\'')) | ||
709 | p++; | ||
710 | symbol_prefix_char = *p; | ||
711 | } else | ||
712 | usage(); | ||
713 | } | ||
714 | } else if (argc != 1) | ||
678 | usage(); | 715 | usage(); |
679 | 716 | ||
680 | read_map(stdin); | 717 | read_map(stdin); |
@@ -683,4 +720,3 @@ main(int argc, char **argv) | |||
683 | 720 | ||
684 | return 0; | 721 | return 0; |
685 | } | 722 | } |
686 | |||
diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 8b1dab63f11c..0835dc2a8aa9 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc | |||
@@ -553,15 +553,20 @@ sub output_section_xml(%) { | |||
553 | # print out each section | 553 | # print out each section |
554 | $lineprefix=" "; | 554 | $lineprefix=" "; |
555 | foreach $section (@{$args{'sectionlist'}}) { | 555 | foreach $section (@{$args{'sectionlist'}}) { |
556 | print "<refsect1>\n <title>$section</title>\n <para>\n"; | 556 | print "<refsect1>\n"; |
557 | print "<title>$section</title>\n"; | ||
557 | if ($section =~ m/EXAMPLE/i) { | 558 | if ($section =~ m/EXAMPLE/i) { |
558 | print "<example><para>\n"; | 559 | print "<informalexample><programlisting>\n"; |
560 | } else { | ||
561 | print "<para>\n"; | ||
559 | } | 562 | } |
560 | output_highlight($args{'sections'}{$section}); | 563 | output_highlight($args{'sections'}{$section}); |
561 | if ($section =~ m/EXAMPLE/i) { | 564 | if ($section =~ m/EXAMPLE/i) { |
562 | print "</para></example>\n"; | 565 | print "</programlisting></informalexample>\n"; |
566 | } else { | ||
567 | print "</para>\n"; | ||
563 | } | 568 | } |
564 | print " </para>\n</refsect1>\n"; | 569 | print "</refsect1>\n"; |
565 | } | 570 | } |
566 | } | 571 | } |
567 | 572 | ||
@@ -576,8 +581,14 @@ sub output_function_xml(%) { | |||
576 | $id =~ s/[^A-Za-z0-9]/-/g; | 581 | $id =~ s/[^A-Za-z0-9]/-/g; |
577 | 582 | ||
578 | print "<refentry>\n"; | 583 | print "<refentry>\n"; |
584 | print "<refentryinfo>\n"; | ||
585 | print " <title>LINUX</title>\n"; | ||
586 | print " <productname>Kernel Hackers Manual</productname>\n"; | ||
587 | print " <date>$man_date</date>\n"; | ||
588 | print "</refentryinfo>\n"; | ||
579 | print "<refmeta>\n"; | 589 | print "<refmeta>\n"; |
580 | print "<refentrytitle><phrase id=\"$id\">".$args{'function'}."</phrase></refentrytitle>\n"; | 590 | print " <refentrytitle><phrase id=\"$id\">".$args{'function'}."</phrase></refentrytitle>\n"; |
591 | print " <manvolnum>9</manvolnum>\n"; | ||
581 | print "</refmeta>\n"; | 592 | print "</refmeta>\n"; |
582 | print "<refnamediv>\n"; | 593 | print "<refnamediv>\n"; |
583 | print " <refname>".$args{'function'}."</refname>\n"; | 594 | print " <refname>".$args{'function'}."</refname>\n"; |
@@ -607,7 +618,7 @@ sub output_function_xml(%) { | |||
607 | } | 618 | } |
608 | } | 619 | } |
609 | } else { | 620 | } else { |
610 | print " <void>\n"; | 621 | print " <void/>\n"; |
611 | } | 622 | } |
612 | print " </funcprototype></funcsynopsis>\n"; | 623 | print " </funcprototype></funcsynopsis>\n"; |
613 | print "</refsynopsisdiv>\n"; | 624 | print "</refsynopsisdiv>\n"; |
@@ -646,8 +657,14 @@ sub output_struct_xml(%) { | |||
646 | $id =~ s/[^A-Za-z0-9]/-/g; | 657 | $id =~ s/[^A-Za-z0-9]/-/g; |
647 | 658 | ||
648 | print "<refentry>\n"; | 659 | print "<refentry>\n"; |
660 | print "<refentryinfo>\n"; | ||
661 | print " <title>LINUX</title>\n"; | ||
662 | print " <productname>Kernel Hackers Manual</productname>\n"; | ||
663 | print " <date>$man_date</date>\n"; | ||
664 | print "</refentryinfo>\n"; | ||
649 | print "<refmeta>\n"; | 665 | print "<refmeta>\n"; |
650 | print "<refentrytitle><phrase id=\"$id\">".$args{'type'}." ".$args{'struct'}."</phrase></refentrytitle>\n"; | 666 | print " <refentrytitle><phrase id=\"$id\">".$args{'type'}." ".$args{'struct'}."</phrase></refentrytitle>\n"; |
667 | print " <manvolnum>9</manvolnum>\n"; | ||
651 | print "</refmeta>\n"; | 668 | print "</refmeta>\n"; |
652 | print "<refnamediv>\n"; | 669 | print "<refnamediv>\n"; |
653 | print " <refname>".$args{'type'}." ".$args{'struct'}."</refname>\n"; | 670 | print " <refname>".$args{'type'}." ".$args{'struct'}."</refname>\n"; |
@@ -724,8 +741,14 @@ sub output_enum_xml(%) { | |||
724 | $id =~ s/[^A-Za-z0-9]/-/g; | 741 | $id =~ s/[^A-Za-z0-9]/-/g; |
725 | 742 | ||
726 | print "<refentry>\n"; | 743 | print "<refentry>\n"; |
744 | print "<refentryinfo>\n"; | ||
745 | print " <title>LINUX</title>\n"; | ||
746 | print " <productname>Kernel Hackers Manual</productname>\n"; | ||
747 | print " <date>$man_date</date>\n"; | ||
748 | print "</refentryinfo>\n"; | ||
727 | print "<refmeta>\n"; | 749 | print "<refmeta>\n"; |
728 | print "<refentrytitle><phrase id=\"$id\">enum ".$args{'enum'}."</phrase></refentrytitle>\n"; | 750 | print " <refentrytitle><phrase id=\"$id\">enum ".$args{'enum'}."</phrase></refentrytitle>\n"; |
751 | print " <manvolnum>9</manvolnum>\n"; | ||
729 | print "</refmeta>\n"; | 752 | print "</refmeta>\n"; |
730 | print "<refnamediv>\n"; | 753 | print "<refnamediv>\n"; |
731 | print " <refname>enum ".$args{'enum'}."</refname>\n"; | 754 | print " <refname>enum ".$args{'enum'}."</refname>\n"; |
@@ -784,8 +807,14 @@ sub output_typedef_xml(%) { | |||
784 | $id =~ s/[^A-Za-z0-9]/-/g; | 807 | $id =~ s/[^A-Za-z0-9]/-/g; |
785 | 808 | ||
786 | print "<refentry>\n"; | 809 | print "<refentry>\n"; |
810 | print "<refentryinfo>\n"; | ||
811 | print " <title>LINUX</title>\n"; | ||
812 | print " <productname>Kernel Hackers Manual</productname>\n"; | ||
813 | print " <date>$man_date</date>\n"; | ||
814 | print "</refentryinfo>\n"; | ||
787 | print "<refmeta>\n"; | 815 | print "<refmeta>\n"; |
788 | print "<refentrytitle><phrase id=\"$id\">typedef ".$args{'typedef'}."</phrase></refentrytitle>\n"; | 816 | print " <refentrytitle><phrase id=\"$id\">typedef ".$args{'typedef'}."</phrase></refentrytitle>\n"; |
817 | print " <manvolnum>9</manvolnum>\n"; | ||
789 | print "</refmeta>\n"; | 818 | print "</refmeta>\n"; |
790 | print "<refnamediv>\n"; | 819 | print "<refnamediv>\n"; |
791 | print " <refname>typedef ".$args{'typedef'}."</refname>\n"; | 820 | print " <refname>typedef ".$args{'typedef'}."</refname>\n"; |
@@ -1465,6 +1494,8 @@ sub dump_function($$) { | |||
1465 | 1494 | ||
1466 | $prototype =~ s/^static +//; | 1495 | $prototype =~ s/^static +//; |
1467 | $prototype =~ s/^extern +//; | 1496 | $prototype =~ s/^extern +//; |
1497 | $prototype =~ s/^fastcall +//; | ||
1498 | $prototype =~ s/^asmlinkage +//; | ||
1468 | $prototype =~ s/^inline +//; | 1499 | $prototype =~ s/^inline +//; |
1469 | $prototype =~ s/^__inline__ +//; | 1500 | $prototype =~ s/^__inline__ +//; |
1470 | $prototype =~ s/^#define +//; #ak added | 1501 | $prototype =~ s/^#define +//; #ak added |
diff --git a/scripts/makeman b/scripts/makeman deleted file mode 100755 index db3af647ee17..000000000000 --- a/scripts/makeman +++ /dev/null | |||
@@ -1,185 +0,0 @@ | |||
1 | #!/usr/bin/perl | ||
2 | |||
3 | use strict; | ||
4 | |||
5 | ## Copyright (C) Michael Still (mikal@stillhq.com) | ||
6 | ## Released under the terms of the GNU GPL | ||
7 | ## | ||
8 | ## A script to make or install the manpages extracted by split-man | ||
9 | ## | ||
10 | ## Arguements: $1 -- the word "convert" or "install" | ||
11 | ## $2 -- the directory containing the SGML files for the manpages | ||
12 | ## $3 -- the filename which contained the sgmldoc output | ||
13 | ## (I need this so I know which manpages to convert) | ||
14 | |||
15 | my($LISTING, $GENERATED, $INPUT, $OUTPUT, $front, $mode, $filename, $tmpdir); | ||
16 | |||
17 | if($ARGV[0] eq ""){ | ||
18 | die "Usage: makeman [convert | install] <dir> <file>\n"; | ||
19 | } | ||
20 | |||
21 | if( ! -d "$ARGV[1]" ){ | ||
22 | die "Output directory \"$ARGV[1]\" does not exist\n"; | ||
23 | } | ||
24 | |||
25 | if($ENV{"TMPDIR"} ne ""){ | ||
26 | $tmpdir = $ENV{"TMPDIR"}; | ||
27 | } | ||
28 | else{ | ||
29 | $tmpdir = "/tmp"; | ||
30 | } | ||
31 | |||
32 | if($ARGV[0] eq "convert"){ | ||
33 | open LISTING, "grep \"<refentrytitle>\" $ARGV[2] |"; | ||
34 | while(<LISTING>){ | ||
35 | s/<\/.*$//; | ||
36 | s/^.*>//; | ||
37 | s/\.sgml//; | ||
38 | s/struct //; | ||
39 | s/typedef //; | ||
40 | |||
41 | chomp; | ||
42 | $filename = $_; | ||
43 | print "Processing $filename\n"; | ||
44 | |||
45 | # Open the input file to extract the front matter, generate the man page, | ||
46 | # and open it, and the rearrange everything until it is happy | ||
47 | open INPUT, "< $ARGV[1]/$filename.sgml"; | ||
48 | $front = ""; | ||
49 | $mode = 0; | ||
50 | |||
51 | # The modes used here are: | ||
52 | # mode = 0 | ||
53 | # <!-- BEGINFRONTTAG --> | ||
54 | # <!-- <bookinfo> mode = 1 | ||
55 | # <!-- <legalnotice> mode = 2 | ||
56 | # <!-- ...GPL or whatever... | ||
57 | # <!-- </legalnotice> mode = 4 | ||
58 | # <!-- </bookinfo> mode = 3 | ||
59 | # <!-- ENDFRONTTAG --> | ||
60 | # | ||
61 | # ...doco... | ||
62 | |||
63 | # I know that some of the if statements in this while loop are in a funny | ||
64 | # order, but that is deliberate... | ||
65 | while(<INPUT>){ | ||
66 | if($mode > 0){ | ||
67 | s/<!-- //; | ||
68 | s/ -->//; | ||
69 | s/<docinfo>//i; | ||
70 | s<\/docinfo>//i; | ||
71 | s/^[ \t]*//i; | ||
72 | } | ||
73 | |||
74 | if($mode == 2){ | ||
75 | if(/<para>/i){ | ||
76 | } | ||
77 | elsif(/<\/para>/i){ | ||
78 | $front = "$front.\\\" \n"; | ||
79 | } | ||
80 | elsif(/<\/legalnotice>/i){ | ||
81 | $mode = 4; | ||
82 | } | ||
83 | elsif(/^[ \t]*$/){ | ||
84 | } | ||
85 | else{ | ||
86 | $front = "$front.\\\" $_"; | ||
87 | } | ||
88 | } | ||
89 | |||
90 | if($mode == 1){ | ||
91 | if(/<title>(.*)<\/title>/i){ | ||
92 | $front = "$front.\\\" This documentation was generated from the book titled \"$1\", which is part of the Linux kernel source.\n.\\\" \n"; | ||
93 | } | ||
94 | elsif(/<legalnotice>/i){ | ||
95 | $front = "$front.\\\" This documentation comes with the following legal notice:\n.\\\" \n"; | ||
96 | $mode = 2; | ||
97 | } | ||
98 | |||
99 | elsif(/<author>/i){ | ||
100 | $front = "$front.\\\" Documentation by: "; | ||
101 | } | ||
102 | elsif(/<firstname>(.*)<\/firstname>/i){ | ||
103 | $front = "$front$1 "; | ||
104 | } | ||
105 | elsif(/<surname>(.*)<\/surname>/i){ | ||
106 | $front = "$front$1 "; | ||
107 | } | ||
108 | elsif(/<email>(.*)<\/email>/i){ | ||
109 | $front = "$front($1)"; | ||
110 | } | ||
111 | elsif(/\/author>/i){ | ||
112 | $front = "$front\n"; | ||
113 | } | ||
114 | |||
115 | elsif(/<copyright>/i){ | ||
116 | $front = "$front.\\\" Documentation copyright: "; | ||
117 | } | ||
118 | elsif(/<holder>(.*)<\/holder>/i){ | ||
119 | $front = "$front$1 "; | ||
120 | } | ||
121 | elsif(/<year>(.*)<\/year>/i){ | ||
122 | $front = "$front$1 "; | ||
123 | } | ||
124 | elsif(/\/copyright>/i){ | ||
125 | $front = "$front\n"; | ||
126 | } | ||
127 | |||
128 | elsif(/^[ \t]*$/ | ||
129 | || /<affiliation>/i | ||
130 | || /<\/affiliation>/i | ||
131 | || /<address>/i | ||
132 | || /<\/address>/i | ||
133 | || /<authorgroup>/i | ||
134 | || /<\/authorgroup>/i | ||
135 | || /<\/legalnotice>/i | ||
136 | || /<date>/i | ||
137 | || /<\/date>/i | ||
138 | || /<edition>/i | ||
139 | || /<\/edition>/i | ||
140 | || /<pubdate>/i | ||
141 | || /<\/pubdate>/i){ | ||
142 | } | ||
143 | else{ | ||
144 | print "Unknown tag in manpage conversion: $_"; | ||
145 | } | ||
146 | } | ||
147 | |||
148 | if($mode == 0){ | ||
149 | if(/<bookinfo>/i){ | ||
150 | $mode = 1; | ||
151 | } | ||
152 | } | ||
153 | |||
154 | if($mode == 4){ | ||
155 | if(/<\/bookinfo>/i){ | ||
156 | $mode = 3; | ||
157 | } | ||
158 | } | ||
159 | } | ||
160 | close INPUT; | ||
161 | |||
162 | system("cd $ARGV[1]; docbook2man $filename.sgml; mv $filename.9 $tmpdir/$$.9\n"); | ||
163 | open GENERATED, "< $tmpdir/$$.9"; | ||
164 | open OUTPUT, "> $ARGV[1]/$filename.9"; | ||
165 | |||
166 | print OUTPUT "$front"; | ||
167 | print OUTPUT ".\\\" For comments on the formatting of this manpage, please contact Michael Still <mikal\@stillhq.com>\n\n"; | ||
168 | while(<GENERATED>){ | ||
169 | print OUTPUT "$_"; | ||
170 | } | ||
171 | close OUTPUT; | ||
172 | close GENERATED; | ||
173 | |||
174 | system("gzip -f $ARGV[1]/$filename.9\n"); | ||
175 | unlink("$tmpdir/$$.9"); | ||
176 | } | ||
177 | } | ||
178 | elsif($ARGV[0] eq "install"){ | ||
179 | system("mkdir -p /usr/local/man/man9/; install $ARGV[1]/*.9.gz /usr/local/man/man9/"); | ||
180 | } | ||
181 | else{ | ||
182 | die "Usage: makeman [convert | install] <dir> <file>\n"; | ||
183 | } | ||
184 | |||
185 | print "Done\n"; | ||
diff --git a/scripts/split-man b/scripts/split-man deleted file mode 100755 index 03897fe6a75d..000000000000 --- a/scripts/split-man +++ /dev/null | |||
@@ -1,112 +0,0 @@ | |||
1 | #!/usr/bin/perl | ||
2 | |||
3 | use strict; | ||
4 | |||
5 | ## Copyright (C) Michael Still (mikal@stillhq.com) | ||
6 | ## Released under the terms of the GNU GPL | ||
7 | ## | ||
8 | ## Hoon through the specified DocBook SGML file, and split out the | ||
9 | ## man pages. These can then be processed into groff format, and | ||
10 | ## installed if desired... | ||
11 | ## | ||
12 | ## Arguements: $1 -- the name of the sgml file | ||
13 | ## $2 -- the directory to put the generated SGML files in | ||
14 | ## $3 -- kernel version | ||
15 | |||
16 | my($SGML, $REF, $front, $refdata, $mode, $filename); | ||
17 | |||
18 | if(($ARGV[0] eq "") || ($ARGV[1] eq "") || ($ARGV[2] eq "")){ | ||
19 | die "Usage: split-man <sgml file> <output dir> <kernel version>\n"; | ||
20 | } | ||
21 | |||
22 | open SGML, "< $ARGV[0]" or die "Could not open input file \"$ARGV[0]\"\n"; | ||
23 | if( ! -d "$ARGV[1]" ){ | ||
24 | die "Output directory \"$ARGV[1]\" does not exist\n"; | ||
25 | } | ||
26 | |||
27 | # Possible modes: | ||
28 | # 0: Looking for input I care about | ||
29 | # 1: Inside book front matter | ||
30 | # 2: Inside a refentry | ||
31 | # 3: Inside a refentry, and we know the filename | ||
32 | |||
33 | $mode = 0; | ||
34 | $refdata = ""; | ||
35 | $front = ""; | ||
36 | while(<SGML>){ | ||
37 | # Starting modes | ||
38 | if(/<bookinfo>/ || /<docinfo>/){ | ||
39 | $mode = 1; | ||
40 | } | ||
41 | elsif(/<refentry>/){ | ||
42 | $mode = 2; | ||
43 | } | ||
44 | elsif(/<refentrytitle><phrase[^>]*>([^<]*)<.*$/){ | ||
45 | $mode = 3; | ||
46 | $filename = $1; | ||
47 | |||
48 | $filename =~ s/struct //; | ||
49 | $filename =~ s/typedef //; | ||
50 | |||
51 | print "Found manpage for $filename\n"; | ||
52 | open REF, "> $ARGV[1]/$filename.sgml" or | ||
53 | die "Couldn't open output file \"$ARGV[1]/$filename.sgml\": $!\n"; | ||
54 | print REF <<EOF; | ||
55 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN"> | ||
56 | |||
57 | <!-- BEGINFRONTTAG: The following is front matter for the parent book --> | ||
58 | $front | ||
59 | <!-- ENDFRONTTAG: End front matter --> | ||
60 | |||
61 | $refdata | ||
62 | EOF | ||
63 | $refdata = ""; | ||
64 | } | ||
65 | |||
66 | # Extraction | ||
67 | if($mode == 1){ | ||
68 | chomp $_; | ||
69 | $front = "$front<!-- $_ -->\n"; | ||
70 | } | ||
71 | elsif($mode == 2){ | ||
72 | $refdata = "$refdata$_"; | ||
73 | } | ||
74 | elsif($mode == 3){ | ||
75 | # There are some fixups which need to be applied | ||
76 | if(/<\/refmeta>/){ | ||
77 | print REF "<manvolnum>9</manvolnum>\n"; | ||
78 | } | ||
79 | if(/<\/refentry>/){ | ||
80 | print REF <<EOF; | ||
81 | <refsect1><title>About this document</title> | ||
82 | <para> | ||
83 | This documentation was generated with kernel version $ARGV[2]. | ||
84 | </para> | ||
85 | </refsect1> | ||
86 | EOF | ||
87 | } | ||
88 | |||
89 | # For some reason, we title the synopsis twice in the main DocBook | ||
90 | if(! /<title>Synopsis<\/title>/){ | ||
91 | if(/<refentrytitle>/){ | ||
92 | s/struct //; | ||
93 | s/typedef //; | ||
94 | } | ||
95 | |||
96 | print REF "$_"; | ||
97 | } | ||
98 | } | ||
99 | |||
100 | # Ending modes | ||
101 | if(/<\/bookinfo>/ || /<\/docinfo>/){ | ||
102 | $mode = 0; | ||
103 | } | ||
104 | elsif(/<\/refentry>/){ | ||
105 | $mode = 0; | ||
106 | close REF; | ||
107 | } | ||
108 | } | ||
109 | |||
110 | # And make sure we don't process this unnessesarily | ||
111 | $ARGV[0] =~ s/\.sgml/.9/; | ||
112 | `touch $ARGV[0]`; | ||