Home | History | Annotate | Download | only in extensions
      1 #!/bin/bash -e
      2 #
      3 # Generate init_extensions* functions to call all the _init functions from
      4 # filter_init
      5 #
      6 # Usage: gen_init <suffix> filename...
      7 #
      8 # Example output:
      9 #
     10 #   void libxt_tcp_init(void);
     11 #   void libxt_udp_init(void);
     12 #   void init_extensions(void);
     13 #   void init_extensions(void) {
     14 #     libxt_tcp_init();
     15 #     libxt_udp_init();
     16 #   }
     17 
     18 EXT=$1
     19 shift
     20 
     21 for i in "$@"; do
     22   f=${i##*/}
     23   f=${f%%.*}
     24   echo "void ${f}_init(void);"
     25 done
     26 
     27 echo "void init_extensions${EXT}(void);"
     28 echo "void init_extensions${EXT}(void) {"
     29 
     30 for i in "$@"; do
     31   f=${i##*/}
     32   f=${f%%.*}
     33   echo "  ${f}_init();"
     34 done
     35 
     36 echo "}"
     37