This file is indexed.

/usr/bin/chirpw is in chirp 0.3.1-3.

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
#! /usr/bin/python
#
# Copyright 2008 Dan Smith <dsmith@danplanet.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.


from chirp import platform, CHIRP_VERSION
from chirpui import config

# Hack to setup environment
platform.get_platform()

import gtk
import sys
import os
import locale
import gettext

p = platform.get_platform()
if hasattr(sys, "frozen"):
    log = file(p.config_file("debug.log"), "w", 0)
    sys.stderr = log
    sys.stdout = log
elif not os.isatty(0):
    log = file(p.config_file("debug.log"), "w", 0)
    sys.stdout = log
    sys.stderr = log

print "CHIRP %s on %s (Python %s)" % (CHIRP_VERSION,
                                      platform.get_platform().os_version_string(),
                                      sys.version.split()[0])

execpath = platform.get_platform().executable_path()
localepath = os.path.abspath(os.path.join(execpath, "locale"))
if not os.path.exists(localepath):
    localepath = "/usr/share/chirp/locale"

conf = config.get()
manual_language = conf.get("language", "state")
langs = []
if manual_language and manual_language != "Auto":
    lang_codes = { "English"   : "en_US",
                   "Polish"    : "pl",
                   "Italian"   : "it",
                   "Dutch"     : "nl",
                   "German"    : "de",
                   "Hungarian" : "hu",
                   }
    try:
        print lang_codes[manual_language]
        langs = [lang_codes[manual_language]]
    except KeyError:
        print "Unsupported language `%s'" % manual_language
else:
    lc, encoding = locale.getdefaultlocale()
    if (lc):
	langs = [lc]
    try:
        langs += os.getenv("LANG").split(":")
    except:
        pass

path = "locale"
gettext.bindtextdomain("CHIRP", localepath)
gettext.textdomain("CHIRP")
lang = gettext.translation("CHIRP", localepath, languages=langs,
                           fallback=True)

# Python <2.6 does not have str.format(), which chirp uses to make translation
# strings nicer. So, instead of installing the gettext standard "_()" function,
# we can install our own, which returns a string of the following class,
# which emulates the new behavior, thus allowing us to run on older Python
# versions.
class CompatStr(str):
    def format(self, **kwargs):
        base = lang.gettext(self)
        for k,v in kwargs.items():
            base = base.replace("{%s}" % k, str(v))
        return base

pyver = sys.version.split()[0]
vmaj, vmin, vrel = pyver.split(".", 3)
if int(vmaj) < 2 or int(vmin) < 6:
    # Python <2.6, emulate str.format()
    import __builtin__
    def lang_with_format(string):
        return CompatStr(string)
    __builtin__._ = lang_with_format
else:
    # Python >=2.6, use normal gettext behavior
    lang.install()

from chirp import *
from chirpui import mainapp, config

a = mainapp.ChirpMain()

profile = False
if len(sys.argv) > 1:
    arg = sys.argv[1]
    index = 2
    if arg == "--profile":
        profile = True
    elif arg == "--help":
        print "Usage: %s [file...]" % sys.argv[0]
        sys.exit(0)
    else:
        index = 1
else:
    index = 1

for i in sys.argv[index:]:
    print "Opening %s" % i
    a.do_open(i)

a.show()

if profile:
    import cProfile, pstats
    cProfile.run("gtk.main()", "chirpw.stats")
    p = pstats.Stats("chirpw.stats")
    p.sort_stats("cumulative").print_stats(10)
else:
    gtk.main()

if config._CONFIG:
    config._CONFIG.set("last_dir",
                       platform.get_platform().get_last_dir(),
                       "state")
    config._CONFIG.save()