Remove getstr.
[gnulib.git] / MODULES.html.sh
1 #!/bin/sh
2 #
3 # Copyright (C) 2002, 2003 Free Software Foundation, Inc.
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
8 # any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 #
19
20 # Usage: MODULES.html.sh > MODULES.html
21
22 PATH=`dirname $0`:$PATH; export PATH
23
24 sed_lt='s,<,\&lt;,g'
25 sed_gt='s,>,\&gt;,g'
26 sed_escape_dot='s,\.,\\.,g'
27 sed_escape_slash='s,/,\\/,g'
28 trnl='\012'
29
30 indent=""
31 missed_modules=`gnulib-tool --list`
32 missed_files=`ls -d lib/* m4/* | sed -e /CVS/d -e /README/d -e /ChangeLog/d -e /Makefile/d -e /TODO/d -e '/~$/d'`
33
34 # func_echo line
35 # outputs line with indentation.
36 func_echo ()
37 {
38   echo "${indent}$*"
39 }
40
41 # func_indent
42 # increases the indentation.
43 func_indent ()
44 {
45   indent="$indent  "
46 }
47
48 # func_unindent
49 # decreases the indentation.
50 func_unindent ()
51 {
52   indent=`echo "$indent" | sed -e 's/  $//'`
53 }
54
55 # func_begin tag [attribute...]
56 # opens a HTML tag.
57 func_begin ()
58 {
59   func_echo "<$*>"
60   func_indent
61 }
62
63 # func_end tag
64 # closes a HTML tag.
65 func_end ()
66 {
67   func_unindent
68   func_echo "</$1>"
69 }
70
71 # func_wrap tag [attribute...]
72 # encloses $element in a HTML tag, without line breaks.
73 func_wrap ()
74 {
75   element="<$*>${element}</$1>"
76 }
77
78 # func_begin_table
79 func_begin_table ()
80 {
81   func_begin TABLE
82   func_begin TR
83   func_echo "<TH ALIGN=LEFT>lib/"
84   func_echo "<TH ALIGN=LEFT>lib/"
85   func_echo "<TH ALIGN=LEFT>m4/"
86   func_echo "<TH ALIGN=LEFT>&nbsp;"
87   func_end TR
88   func_begin TR
89   func_echo "<TH ALIGN=LEFT>Header"
90   func_echo "<TH ALIGN=LEFT>Implementation"
91   func_echo "<TH ALIGN=LEFT>Autoconf macro"
92   func_echo "<TH ALIGN=LEFT>Depends on"
93   func_end TR
94 }
95
96 # func_module module
97 func_module ()
98 {
99   func_begin TR
100
101   sed_remove_trailing_empty_line='${
102 /^$/d
103 }'
104
105   element=`gnulib-tool --extract-include-directive $1 | sed -e "$sed_lt" -e "$sed_gt" -e "$sed_remove_trailing_empty_line" | sed -e 's/$/<BR>/' | tr -d "$trnl" | sed -e 's/<BR>$//'`
106   test -n "$element" || element='---'
107   func_echo "<TD ALIGN=LEFT VALIGN=TOP>$element"
108
109   sed_choose_unconditional_nonstandard_include='s,^#include "\(.*\)"$,\1,p'
110   includefile=`gnulib-tool --extract-include-directive $1 | sed -n -e "$sed_choose_unconditional_nonstandard_include" | sed -e "$sed_escape_dot" | tr -d "$trnl"`
111   sed_choose_lib_files='s,^lib/\(.*\)$,\1,p'
112   element=`gnulib-tool --extract-filelist $1 | sed -e '/^$/d' | sed -n -e "$sed_choose_lib_files" | sed -e '/^'"${includefile}"'$/d' | sed -e 's/$/<BR>/' | tr -d "$trnl" | sed -e 's/<BR>$//'`
113   test -n "$element" || element='---'
114   func_echo "<TD ALIGN=LEFT VALIGN=TOP>$element"
115
116   sed_choose_m4_files='s,^m4/\(.*\)$,\1,p'
117   element=`(gnulib-tool --extract-filelist $1 | sed -e "$sed_remove_trailing_empty_line" | sed -n -e "$sed_choose_m4_files" | sed -e '/^onceonly/d'; gnulib-tool --extract-autoconf-snippet $1 | sed -e "$sed_remove_trailing_empty_line") | sed -e 's/$/<BR>/' | tr -d "$trnl" | sed -e 's/<BR>$//'`
118   test -n "$element" || element='---'
119   func_echo "<TD ALIGN=LEFT VALIGN=TOP>$element"
120
121   element=`gnulib-tool --extract-dependencies $1 | sed -e "$sed_remove_trailing_empty_line" | sed -e 's/$/<BR>/' | tr -d "$trnl" | sed -e 's/<BR>$//'`
122   test -n "$element" || element='---'
123   func_echo "<TD ALIGN=LEFT VALIGN=TOP>$element"
124
125   func_end TR
126
127   missed_modules=`echo "$missed_modules" | sed -e '/^'"$1"'$/d'`
128
129   files=`gnulib-tool --extract-filelist $1`
130   sed_removal_prefix='s,^,/^,'
131   sed_removal_suffix='s,$,\$/d,'
132   sed_remove_files=`echo '{'; for file in $files; do echo $file | sed -e "$sed_escape_dot" -e "$sed_escape_slash" | sed -e "$sed_removal_prefix" -e "$sed_removal_suffix"; done; echo '}'`
133   missed_files=`echo "$missed_files" | sed -e "$sed_remove_files"`
134 }
135
136 # func_end_table
137 func_end_table ()
138 {
139   func_end TABLE
140 }
141
142
143 echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">'
144 func_begin HTML
145
146 func_begin HEAD
147
148 element="Gnulib Module List"
149 func_wrap TITLE
150 func_echo "$element"
151
152 modules=`gnulib-tool --list`
153 modules=`for m in $modules; do printf "%s, " $m; done | sed -e 's/, $//'`
154 func_echo '<META NAME="keywords" CONTENT="'"${modules}"'">'
155
156 func_end HEAD
157
158 func_begin BODY
159
160 func_end BODY
161
162 element="Gnulib Module List"
163 func_wrap H1
164 func_echo "$element"
165
166 func_echo 'This is a list of the modules which make up gnulib, with dependencies.'
167
168 element="Support for systems lacking ANSI C 89"
169 func_wrap H2
170 func_echo "$element"
171
172 func_begin_table
173 func_module c-bs-a
174 func_module assert
175 func_module atexit
176 func_module strtod
177 func_module strtol
178 func_module strtoul
179 func_module memchr
180 func_module memcmp
181 func_module memcpy
182 func_module memmove
183 func_module memset
184 func_module strcspn
185 func_module strpbrk
186 func_module strstr
187 func_module strerror
188 func_module mktime
189 func_end_table
190
191 func_echo 'These modules are not listed among dependencies below, for simplicity.'
192
193 element="Enhancements for ANSI C 89 functions"
194 func_wrap H2
195 func_echo "$element"
196
197 element="Memory management functions <stdlib.h>"
198 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
199 func_wrap H3
200 func_echo "$element"
201
202 func_begin_table
203 func_module malloc
204 func_module realloc
205 func_end_table
206
207 element="Date and time <time.h>"
208 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
209 func_wrap H3
210 func_echo "$element"
211
212 func_begin_table
213 func_module strftime
214 func_end_table
215
216 element="Extra functions based on ANSI C 89"
217 func_wrap H2
218 func_echo "$element"
219
220 element="Memory management functions <stdlib.h>"
221 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
222 func_wrap H3
223 func_echo "$element"
224
225 func_begin_table
226 func_module xalloc
227 func_module alloca
228 func_module bumpalloc
229 func_end_table
230
231 element="Integer arithmetic functions <stdlib.h>"
232 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
233 func_wrap H3
234 func_echo "$element"
235
236 func_begin_table
237 func_module gcd
238 func_end_table
239
240 element="Environment variables <stdlib.h>"
241 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
242 func_wrap H3
243 func_echo "$element"
244
245 func_begin_table
246 func_module putenv
247 func_module setenv
248 func_end_table
249
250 element="Character handling <ctype.h>"
251 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
252 func_wrap H3
253 func_echo "$element"
254
255 element="String handling <string.h>"
256 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
257 func_wrap H3
258 func_echo "$element"
259
260 func_begin_table
261 func_module bcopy
262 func_module memrchr
263 func_module stpcpy
264 func_module strcase
265 func_module strdup
266 func_module strnlen
267 func_module strndup
268 func_end_table
269
270 element="Numeric conversion functions <stdlib.h>"
271 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
272 func_wrap H3
273 func_echo "$element"
274
275 func_begin_table
276 func_module xstrtod
277 func_module xstrtol
278 func_end_table
279
280 element="Date and time <time.h>"
281 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
282 func_wrap H3
283 func_echo "$element"
284
285 func_begin_table
286 func_module getdate
287 func_end_table
288
289 element="Input/Output <stdio.h>"
290 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
291 func_wrap H3
292 func_echo "$element"
293
294 func_begin_table
295 func_module unlocked-io
296 func_end_table
297
298 element="Command-line arguments"
299 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
300 func_wrap H3
301 func_echo "$element"
302
303 func_begin_table
304 func_module argmatch
305 func_module version-etc
306 func_module long-options
307 func_end_table
308
309 element="Cryptographic computations"
310 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
311 func_wrap H3
312 func_echo "$element"
313
314 func_begin_table
315 func_module md5
316 func_module sha
317 func_end_table
318
319 element="Misc"
320 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
321 func_wrap H3
322 func_echo "$element"
323
324 func_begin_table
325 func_module diacrit
326 func_module getline
327 func_module linebuffer
328 func_module obstack
329 func_module hash-pjw
330 func_module hash
331 func_module readtokens
332 func_module strverscmp
333 func_end_table
334
335 element="Support for systems lacking ISO C 99"
336 func_wrap H2
337 func_echo "$element"
338
339 element="Boolean type and values <stdbool.h>"
340 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
341 func_wrap H3
342 func_echo "$element"
343
344 func_begin_table
345 func_module stdbool
346 func_end_table
347
348 element="Numeric conversion functions <stdlib.h>"
349 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
350 func_wrap H3
351 func_echo "$element"
352
353 func_begin_table
354 func_module strtoll
355 func_module strtoull
356 func_end_table
357
358 element="Functions for greatest-width integer types <inttypes.h>"
359 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
360 func_wrap H3
361 func_echo "$element"
362
363 func_begin_table
364 func_module strtoimax
365 func_module strtoumax
366 func_end_table
367
368 element="Enhancements for ISO C 99 functions"
369 func_wrap H2
370 func_echo "$element"
371
372 func_begin_table
373 func_end_table
374
375 element="Extra functions based on ISO C 99"
376 func_wrap H2
377 func_echo "$element"
378
379 element="Numeric conversion functions <stdlib.h>"
380 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
381 func_wrap H3
382 func_echo "$element"
383
384 func_begin_table
385 func_module xstrtoimax
386 func_module xstrtoumax
387 func_end_table
388
389 element="Support for systems lacking POSIX:2001"
390 func_wrap H2
391 func_echo "$element"
392
393 func_begin_table
394 func_module chown
395 func_module dup2
396 func_module ftruncate
397 func_module getgroups
398 func_module gettimeofday
399 func_module mkdir
400 func_module mkstemp
401 func_module stat
402 func_module lstat
403 func_module timespec
404 func_module nanosleep
405 func_module regex
406 func_module rename
407 func_module rmdir
408 func_module utime
409 func_end_table
410
411 element="Enhancements for POSIX:2001 functions"
412 func_wrap H2
413 func_echo "$element"
414
415 func_begin_table
416 func_module dirname
417 func_module getopt
418 func_module unistd-safer
419 func_module fnmatch
420 func_module fnmatch-posix
421 func_module fnmatch-gnu
422 func_module exclude
423 func_end_table
424
425 element="Extra functions based on POSIX:2001"
426 func_wrap H2
427 func_echo "$element"
428
429 element="Numeric conversion functions"
430 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
431 func_wrap H3
432 func_echo "$element"
433
434 func_begin_table
435 func_module human
436 func_end_table
437
438 element="File system functions"
439 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
440 func_wrap H3
441 func_echo "$element"
442
443 func_begin_table
444 func_module acl
445 func_module backupfile
446 func_module fsusage
447 func_module dirfd
448 func_module euidaccess
449 func_module file-type
450 func_module fileblocks
451 func_module filemode
452 func_module isdir
453 func_module lchown
454 func_module makepath
455 func_module modechange
456 func_module mountlist
457 func_module path-concat
458 func_module pathmax
459 func_module same
460 func_module save-cwd
461 func_module savedir
462 func_module xgetcwd
463 func_module xreadlink
464 func_end_table
465
466 element="File descriptor based Input/Output"
467 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
468 func_wrap H3
469 func_echo "$element"
470
471 func_begin_table
472 func_module safe-read
473 func_module safe-write
474 func_module full-read
475 func_module full-write
476 func_end_table
477
478 element="File stream based Input/Output"
479 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
480 func_wrap H3
481 func_echo "$element"
482
483 func_begin_table
484 func_module fpending
485 func_module closeout
486 func_module stdio-safer
487 func_module getpass
488 func_end_table
489
490 element="Users and groups"
491 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
492 func_wrap H3
493 func_echo "$element"
494
495 func_begin_table
496 func_module getugroups
497 func_module group-member
498 func_module idcache
499 func_module userspec
500 func_end_table
501
502 element="Date and time"
503 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
504 func_wrap H3
505 func_echo "$element"
506
507 func_begin_table
508 func_module gettime
509 func_module settime
510 func_module posixtm
511 func_end_table
512
513 element="Networking functions"
514 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
515 func_wrap H3
516 func_echo "$element"
517
518 func_begin_table
519 func_module gethostname
520 func_module xgethostname
521 func_module canon-host
522 func_end_table
523
524 element="Internationalization functions"
525 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
526 func_wrap H3
527 func_echo "$element"
528
529 func_begin_table
530 func_module gettext
531 func_module iconv
532 func_module localcharset
533 func_module hard-locale
534 func_module mbswidth
535 func_module memcasecmp
536 func_module memcoll
537 func_module xmemcoll
538 func_module unicodeio
539 func_module rpmatch
540 func_module yesno
541 func_end_table
542
543 element="Executing programs"
544 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
545 func_wrap H3
546 func_echo "$element"
547
548 element="Java"
549 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
550 func_wrap H3
551 func_echo "$element"
552
553 element="Misc"
554 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
555 func_wrap H3
556 func_echo "$element"
557
558 func_begin_table
559 func_module exitfail
560 func_module c-stack
561 func_module error
562 func_module fatal
563 func_module getloadavg
564 func_module getpagesize
565 func_module getusershell
566 func_module physmem
567 func_module posixver
568 func_module quotearg
569 func_module quote
570 func_module readutmp
571 func_module sig2str
572 func_end_table
573
574 if test -n "$missed_modules"; then
575
576   element="Unclassified modules - please update MODULES.html.sh"
577   element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
578   func_wrap H2
579   func_echo "$element"
580
581   func_begin_table
582   for module in $missed_modules; do
583     func_module $module
584   done
585   func_end_table
586
587 fi
588
589 if test -n "$missed_files"; then
590
591   element="Lone files - please create new modules containing them"
592   element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
593   func_wrap H2
594   func_echo "$element"
595
596   func_echo '<PRE>'
597   echo "$missed_files"
598   echo '</PRE>'
599
600 fi
601
602 element="Future developments"
603 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
604 func_wrap H2
605 func_echo "$element"
606
607 func_echo 'Ideally a module could consist of:'
608 func_begin UL
609 func_echo '<LI>A header file: lib/<VAR>module</VAR>.h'
610 func_echo '<LI>One or more implementation files: lib/<VAR>module</VAR>.c et al.'
611 func_echo '<LI>One or more autoconf macro files: m4/<VAR>module</VAR>.m4 et al.'
612 func_echo '<LI>A configure.ac fragment, Makefile.am fragment, dependency list: modules/<VAR>module</VAR>'
613 func_echo '<LI>Some documentation'
614 func_echo '<LI>A POT file and some PO files'
615 func_echo '<LI>A testsuite'
616 func_end UL
617
618 func_echo '<HR>'
619 func_echo 'Generated from <CODE>MODULES.html.sh</CODE> on '`LC_ALL=C date +"%e %B %Y"`.
620
621 func_end HTML