1#!/bin/sh 2 3function dump_mime () { 4 while [ ! -z "$1" ]; do 5 case "$1" in 6 -set) 7 shift; 8 mime="$1" 9 ;; 10 -extension) 11 shift 12 extension="$1" 13 echo " { \"$extension\", \"$mime\" }," 14 ;; 15 esac 16 shift 17 done 18} 19 20# header 21echo "struct ext_mime mimes[] = {" 22 23setmime -dump | grep extension | sed 's/^[^ ]*setmime /dump_mime /' | while read L; do 24 eval $L 25done 26 27#footer 28echo "" 29echo " { 0, 0 }" 30echo "};" 31 32