This file is indexed.

/usr/bin/falconeer.fal is in falconpl-dev 0.9.6.9-git20120606-2.1+b1.

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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
#!/usr/bin/env falcon
/*
   FALCON - The Falcon Programming Language.
   FILE: falconeer.fal

   Script that configures module skeleton.
   -------------------------------------------------------------------

   Copyright 2008 Giancarlo Niccolai

   Licensed under the Falcon Programming Language License,
   Version 1.1 (the "License") or GPLv2.0 or following,
   at your choice; you may not use this file except in
   compliance with on of the Licenses. You may obtain
   a copy of the Licenses at

      http://www.falconpl.org/?page_id=license_1_1
      http://www.gnu.org/licenses/old-licenses/gpl-2.0.html

   Unless required by applicable law or agreed to in writing,
   software distributed under the License is distributed on
   an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   KIND, either express or implied. See the License for the
   specific language governing permissions and limitations
   under the License.
*/

load regex

//==========================================
// Global definitions
//

// name used for skeleton files
const skelname = "fmodskel"

// using falcon string concatenation to prevent cmake
// to mangle with this values.
var_prjname = "@{"+skelname+"_PROJECT_NAME}@"
var_desc    = "@{"+skelname+"_DESCRIPTION}@"
var_author  = "@{"+skelname+"_AUTHOR}@"
var_date    = "@{"+skelname+"_DATE}@"
var_year    = "@{"+skelname+"_YEAR}@"
var_copy    = "@{"+skelname+"_COPYRIGHT}@"
var_license = "@{"+skelname+"_LICENSE}@"
var_mainprj = "@{"+skelname+"_MAIN_PRJ}@"

const default_license = '
      Licensed under the Falcon Programming Language License,
      Version 1.1 (the "License"); you may not use this file
      except in compliance with the License. You may obtain
      a copy of the License at

         http://www.falconpl.org/?page_id=license_1_1

      Unless required by applicable law or agreed to in writing,
      software distributed under the License is distributed on
      an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
      KIND, either express or implied. See the License for the
      specific language governing permissions and limitations
      under the License.
'

const default_prj = "FALCON - The Falcon Programming Language."

files = [\
   "src/" + skelname + ".cpp",
   "src/" + skelname + "_ext.cpp",
   "src/" + skelname + "_ext.h",
   "src/" + skelname + "_st.cpp",
   "src/" + skelname + "_st.h",
   "src/" + skelname + "_mod.cpp",
   "src/" + skelname + "_mod.h",
   "src/" + skelname + "_srv.cpp",
   "src/" + skelname + "_srv.h",
   "src/" + skelname + "_CMakeLists.txt:src/CMakeLists.txt",
   "src/" + skelname + "_version.h:src/version.h",
   "templates/"+ skelname + "_cpp_template",
   "templates/" + skelname + "_h_template",
   "docs/" + skelname + "_faldoc.fd.in:docs/faldoc.fd.in",
   "docs/" + skelname + "_CMakeLists.txt:docs/CMakeLists.txt",
   skelname + "_CMakeLists.txt:CMakeLists.txt"
]

chgRegex = Regex( skelname )

variables = [=>]

//==========================================
// Configuration options parser
//

object MyParser from CmdlineParser
   prj_name = nil
   author = "Unknown author"
   description = ""
   date = CurrentTime()
   copyright = "The above AUTHOR"
   licplate = default_license
   mainprj = default_prj

   function onOption( option )
      switch option
         case "?", "help": self.usage()
         case "a", "author", "n", "name", "d", "description", \
              "l", "license", "c", "copyright", "p", "project"
            self.expectValue()
         default
            self.unrecognized( option )
      end
   end

   function onValue( option, value )
      switch option
         case "a", "author": self.author = value
         case "n", "name": self.prj_name = value
         case "d", "description": self.description = value
         case "l", "license": self.loadLicense( value )
         case "c", "copyright": self.copyright = value
         case "p", "project": self.mainprj = value
      end
   end

   function onFree( param )
      self.unrecognized( param )
   end

   function loadLicense( param )
      try
         inf = InputStream( param )
         self.licplate=""
         while ( data = inf.read(2048) )
            self.licplate +=data
         end
         inf.close()
      catch IoError in e
         > "falconeer.fal: FATAL: cannot load license plate file ", param
         > e
         exit(1)
      end
   end

   function unrecognized( option )
      printl( "Unrecognized option \"", option, "\"\n\n" );
      self.usage()
      exit(1)
   end

   function usage()
      >  "Falconeer -- the skeleton module configurator.\n" +
         "  Enter a directory where the Falcon Skeleton Module has been unpacked\n" +
         "  and load this script setting the '-n' option.\n" +
         "  Relevant the files in the skeleton directory will be renamed accordingly\n" +
         "  to your settings, and configurable placeholder variables in each file\n" +
         "  will be overwritten.\n"

      >  "  Options:\n" +
         "     -?,--help               \tPrints this help\n" +
         "     -n/--name <value>       \tName of the project (will affect filenames)\n" +
         "     -a/--author <value>     \tAuthor(s) of the project\n" +
         "     -c/--copyright <value>  \tCopyright owner\n" +
         "     -d/--description <value>\tDescription for the project\n" +
         "     -l/--license <file>     \tPointer to a license plate\n" +
         "     -p/--project <value>    \tMain project to which this module belongs\n\n" +
         "  -n option is mandatory.\n"
   end
end

//==========================================
// Function that does the job
//
function parse_file( fileName, destName )
   global variables

   try
      fin = InputStream( fileName )
   catch IoError in error
      > "Skipping file ", fileName
      return
   end
   
   // convert the name
   if not destName
      foutName = chgRegex.replace( fileName, MyParser.prj_name )
   else
      foutName = destName
   end
   if foutName == fileName: foutName += "_new"

   try
      // open the output file name
      fout = OutputStream( foutName )
      line = ""

      // read the line
      loop
         fin.readLine( line, 512 )

         // scan and substitute the variables
         for key, value in variables
            pos = strFind( line, key )
            // can be more than one per line
            while pos >= 0
               line[pos : pos + key.len()] = value
               pos = strFind( line, key )
            end
         end
         // now we can write the line
         fout.write( line + "\n" )

         if fin.eof(): break
      end

      fin.close()
      fout.close()
   catch in error
      > @"Error while performing change $fileName -> $foutName"
      > error
      return
   end

   // remove the old file
   // TODO: set an option to prevent this
   try
      fileRemove( fileName )
   catch in error
      > @"Error removing $fileName"
      > error
   end
end

//==========================================
// Main program
//

MyParser.parse()
if not MyParser.prj_name
   MyParser.usage()
   exit( 1 )
end

// create the variables
variables[var_prjname] = MyParser.prj_name
variables[var_desc   ] = MyParser.description
variables[var_author ] = MyParser.author
variables[var_date   ] = MyParser.date.toRFC2822()
variables[var_year   ] = MyParser.date.year.toString()
variables[var_copy   ] = MyParser.copyright
variables[var_license] = MyParser.licplate
variables[var_mainprj] = MyParser.mainprj

for file in files

   if ":" in file
      orig, dest = strSplit( file, ":", 2 )
   else
      orig = file
      dest = nil
   end

   > "Examining ", orig, "..."
   parse_file( orig, dest )
end

/* End of falconeer.fal */