Fix a compiler warning
[amule.git] / src / pixmaps / flags_xpm / makeflags.sh
blobb962535024e8709601d2a416aab48198c59360d7
1 #!/bin/sh
3 # Create Makefile.am
4 echo > Makefile.am
5 echo 'EXTRA_DIST = \' >> Makefile.am
6 ls *.xpm | sed -e 's/^/ /' -e 's/$/ \\/' >> Makefile.am
7 echo ' makeflags.sh' >> Makefile.am
9 # Create CountryFlags.h and header
10 echo > CountryFlags.h
11 echo >> CountryFlags.h
12 echo '#ifndef COUNTRY_FLAGS_H' >> CountryFlags.h
13 echo '#define COUNTRY_FLAGS_H' >> CountryFlags.h
14 echo >> CountryFlags.h
15 echo 'namespace flags {' >> CountryFlags.h
16 echo >> CountryFlags.h
18 # Create include directives
19 ls *.xpm | sed -e 's/^/#include "/' -e 's/$/"/' >> CountryFlags.h
20 echo >> CountryFlags.h
21 echo >> CountryFlags.h
23 # Define the struct
24 echo 'struct FlagXPMCode' >> CountryFlags.h
25 echo '{' >> CountryFlags.h
26 echo ' const char **xpm;' >> CountryFlags.h
27 echo ' const char *code;' >> CountryFlags.h
28 echo '};' >> CountryFlags.h
29 echo >> CountryFlags.h
30 echo >> CountryFlags.h
32 # "do" is a reserved word, we can't use it
33 #sed -i -e 's/do\[\]/do_\[\]/' do.xpm
35 # Create the flag/Code vector
36 echo 'static struct FlagXPMCode flagXPMCodeVector[] = {'>> CountryFlags.h
37 ls *.xpm | sed -e 's/\.xpm$//;/\//s:.*/\([^/][^/]*\):\1:' | \
38 sed -e 's/[A-Za-z]*/ {&, "&"},/' | \
39 sed -e 's/do/do_/1' \
40 >> CountryFlags.h
41 echo '};'>> CountryFlags.h
42 echo >> CountryFlags.h
43 echo >> CountryFlags.h
45 # Calculate the vector size
46 echo 'static const int FLAGS_XPM_SIZE = (sizeof flagXPMCodeVector) / (sizeof flagXPMCodeVector[0]);' >> CountryFlags.h
47 echo >> CountryFlags.h
48 echo >> CountryFlags.h
50 # Finish
51 echo '} // namespace flags' >> CountryFlags.h
52 echo '#endif // COUNTRY_FLAGS_H' >> CountryFlags.h