d0811f
#!/bin/bash
d0811f
d0811f
parse() {
d0811f
    while read line; do
d0811f
        [ "${line:0:1}" = '#' -o "${line:0:1}" = ';' ] && continue
d0811f
        line="${line## *}"
d0811f
        [ -z "$line" ] && continue
d0811f
        set -- $line
d0811f
        case "$1" in
d0811f
            ('u')
d0811f
                echo "user($2)"
d0811f
                echo "group($2)"
d0811f
                # TODO: user:group support
d0811f
                ;;
d0811f
            ('g')
d0811f
                echo "group($2)"
d0811f
                ;;
d0811f
            ('m')
d0811f
                echo "user($2)"
d0811f
                echo "group($3)"
d0811f
                ;;
d0811f
        esac
d0811f
    done
d0811f
}
d0811f
d0811f
while read fn; do
d0811f
    parse < "$fn"
d0811f
done