def escape_filename_sh_ansic(name):
    """Return an ansi-c shell-escaped version of a filename."""
    out = []
    for ch in name:
        if ord(ch) < 32:
            out.append('\\x%02x' % ord(ch))
        elif ch == '\\':
            out.append('\\\\')
        else:
            out.append(ch)
    return "$'" + ''.join(out) + "'"
