This file is indexed.

/usr/bin/prime-userdict-update is in prime 1.0.0.1-2.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#!/usr/bin/env ruby
#### prime-userdict-update: Command to update a userdict of PRIME.
#### $Id: prime-userdict-update.src,v 1.5 2005/03/07 07:51:34 komatsu Exp $
####
#### Copyright (C) 2003 Hiroyuki Komatsu <komatsu@taiyaki.org>
####     All rights reserved.
####     This is free software with ABSOLUTELY NO WARRANTY.
####
#### You can redistribute it and/or modify it under the terms of 
#### the GNU General Public License version 2.

PRIME_LIBDIR = '/usr/lib/ruby/1.8'
$LOAD_PATH.unshift(PRIME_LIBDIR) unless $LOAD_PATH.member?(PRIME_LIBDIR)

require 'prime/prime-config'
require 'prime/makedict/userdict'
require 'getoptlong'

class PrimeUserdictUpdateCommand
  include Debug

  def initialize (command_name)
    @debug_mode = false

    @indexing   = true
    @conversion = true
    @output_dictname = nil
    @input_dictname  = nil
    @is_interactive  = true

    @command_name = command_name
    @version = '1.0.0.1'
    @usage = <<"EOF"
#{@command_name}:#{@version} -- converts user dictionaries for PRIME.

  Usage: #{@command_name} [options] [output_dictname] [input_dictname] 
  -a,  --all        :  conversion and indexing (default)
  -c,  --conversion :  conversion only
  -i,  --indexing   :  indexing only
       --auto       :  conversion automatically.

  -q,  --quiet      :  show nothing.
  -v,  --version    :  show the version and exit
  -h,  --help       :  show this help and exit
  -d,  --debug      :  run under debug mode
EOF
  end

  def main ()
    parse_options()

    if @conversion then # with --conversion
      if @output_dictname.nil? or @input_dictname.nil? then
	print_usage()
	exit()
      end
      prime_update = PrimeUserdictUpdate.new(@output_dictname, @is_interactive)
      if prime_update.check_necessity(@input_dictname) then
	prime_update.update(@input_dictname)
	prime_update.delete_files(@input_dictname)
      end

      if @indexing then # with --conversion and --indexing
        prime_makeindex =
             PrimeUserdictMakeIndex.new(@output_dictname, @is_interactive)
        prime_makeindex.make_indexes()
      end
    elsif @indexing then # with --indexing
      if @output_dictname.nil? then
	print_usage()
	exit()
      end
      prime_makeindex =
	PrimeUserdictMakeIndex.new(@output_dictname, @is_interactive)
      prime_makeindex.make_indexes()
    end

    system('/usr/bin/prime-refresh')

    $stderr.puts "Done." if @is_interactive
  end

  def print_version ()
    puts "#{@command_name}:#{@version}"
  end
  
  def print_usage ()
    puts @usage
  end

  private
  def parse_options ()
    options = {}
    parser = GetoptLong.new()
    parser.set_options(['--help',       '-h',   GetoptLong::NO_ARGUMENT],
		       ['--version',    '-v',   GetoptLong::NO_ARGUMENT],
		       ['--debug',      '-d',   GetoptLong::NO_ARGUMENT],
		       ['--auto',               GetoptLong::NO_ARGUMENT],
		       ['--quiet',      '-q',   GetoptLong::NO_ARGUMENT],
		       ['--all',        '-a',   GetoptLong::NO_ARGUMENT],
		       ['--conversion', '-c',   GetoptLong::NO_ARGUMENT],
		       ['--indexing',   '-i',   GetoptLong::NO_ARGUMENT]
		       )

    parser.each_option {|option, arg|
      options[option.sub(/^--/, '')] = arg
    }

    if options['version'] then
      print_version()
      exit()
    elsif options['help'] then
      print_usage()
      exit()
    end

    if options['debug'] then
      $DEBUG = true
    end

    if options['quiet'] then
      @is_interactive = false
    else
      @is_interactive = true
    end

    @output_dictname = ARGV[0]
    @input_dictname  = ARGV[1]

    if options['auto'] then
      @indexing   = true
      @conversion = true
      @input_dictname  = (ARGV[0] or (PRIME_USER_DIR + "/userdict_diff"))
      @output_dictname = (ARGV[1] or (PRIME_USER_DIR + "/userdict"))
    elsif options['all'] then
      @indexing   = true
      @conversion = true
    elsif options['indexing'] then
      @indexing   = true
      @conversion = false
    elsif options['conversion'] then
      @indexing   = false
      @conversion = true
    end
  end
end

### FIXME: Check both errors 'file not found' and 'overwriting files'
### FIXME: <komatsu@taiyaki.org> (2003-11-30)

if File::expand_path($0) == File::expand_path(__FILE__) then
  conv_command = PrimeUserdictUpdateCommand.new(File::basename($0))
  conv_command.main()
end