aboutsummaryrefslogtreecommitdiffstats
path: root/make-faq
blob: 0b16f88f84acaefd86e240cf74debdae05bc6cea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/sh
#
# $Id: make-faq,v 1.4 2003/03/02 17:42:28 jmayer Exp $
#
# Make-faq - Creates a plain text version of the Ethereal FAQ
#	from http://www.ethereal.com/faq

# Split the FAQ every LINECOUNT lines so the strings don't become too long
# for # some compilers.
LINECOUNT=400

rm -f FAQ
cat >FAQ <<EOF

   The Ethereal FAQ

   Note: This is just an ASCII snapshot of the faq and may not be up to
         date. Please go to http://www.ethereal.com/faq for the up to
         date version. The version of this snapshot can be found at the
         end of this document.

   INDEX

EOF

lynx -dump -nolist "http://www.ethereal.com/faq" | sed -e '1,/INDEX/d' >>FAQ

# Create an #include'able version for gtk/help_dlg.c
rm -f FAQ.include FAQTMP*
split -l $LINECOUNT FAQ FAQTMP
NUM=0
echo "const char *faq_part[] = {" >>FAQ.include
for i in FAQTMP*; do
   if [ $NUM -ne 0 ]; then
      echo "," >>FAQ.include
      echo >>FAQ.include
   fi
   sed -e 's/\\/\\\\/g' -e 's/"/\\"/g' -e 's/^/"/' -e 's/$/\\n"/' <$i >>FAQ.include
   NUM=`expr $NUM + 1`
done
echo "};" >>FAQ.include
echo "#define FAQ_PARTS $NUM" >>FAQ.include
SIZE=`wc -c FAQ | tr -d ' A-Za-z'`
echo "#define FAQ_SIZE $SIZE" >>FAQ.include
rm -f FAQTMP*

exit 0