# File lib/rfuse.rb, line 74
    def self.parse_options(argv,*local_opts)
        result = Hash.new(nil)

        first_opt_index = (argv.find_index() { |opt| opt =~ /^-.*/ } || argv.length )

        result[:device] = argv.shift if first_opt_index > 1
        result[:mountpoint] = argv[0] if argv.length > 0

        if argv.include?("-h")
            result[:help]  =  true
        end

        if argv.include?("-d")
            result[:debug] = true
        end

        opt_index = ( argv.find_index("-o") || -1 ) + 1

        if opt_index > 1 && opt_index < argv.length
            options = argv[opt_index].split(",")

            options.delete_if() do |opt|
                opt.strip!

                opt,value = opt.split("=",2)
                value = true unless value
                opt_sym = opt.to_sym
                result[opt_sym] = value

                #result of delete if
                local_opts.include?(opt_sym)
            end

            if options.empty?
                argv.slice!(opt_index - 1,2)
            else
                argv[opt_index] = options.join(",")
            end
        end

        result
    end