#! /usr/bin/awk -f
#
# A diff canonifier that removes all MIME types because libmagic output
# can differ between installations.

BEGIN { FS="\t"; OFS="\t"; type_col = -1; desc_col = -1 }

/^#fields/ {
    for ( i = 2; i < NF; ++i )
        {
        if ( $i == "mime_type" )
            type_col = i-1;
        if ( $i == "mime_desc" )
            desc_col = i-1;
        }
}

function remove_mime (n) {
    if ( n >= 0 && $n != "-" )
        # Mark that it's set, but ignore content.
        $n = "+"
}

remove_mime(type_col)
remove_mime(desc_col)

{
    print;
}
