#!/bin/sh # # Messy script to convert all of the given .po files to a single C file on # stdout. cat < struct msgtable_s { char *msgid; char *msgstr; }; struct msgtable_s *minigettext__gettable(char *lang) { if (0 == lang) return 0; EOF for POFILE in $*; do LANG=`basename "$POFILE" | sed 's/.po$//'` echo " if (strncmp(lang, \"$LANG\", 2) == 0) {" echo " static struct msgtable_s data[] = {"; awk 'BEGIN{i=0;s=0;} /^msgid[ ]+/ { if (s) print " }, "; print " {"; print " " substr($0,7); i=1; s=0; } /^msgstr[ ]+/ { print " ,"; i=0;s=1; print " " substr($0,8); } /^[ ]*"/ { if (i||s) print " " $0; } END {if (i||s) print " }\n";} ' < "$POFILE" echo ' , { 0, 0 } };' echo " return data;" echo " }" done cat <