This file is indexed.

/usr/bin/tdiary-convert2 is in tdiary 3.2.2-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
#!/usr/bin/env ruby
# -*- coding: utf-8; -*-
#
# convert2: convert diary data file format tDiary1 to tDiary2.
#
# Copyright (C) 2001,2002, All right reserved by TADA Tadashi <sho@spc.gr.jp>
# You can redistribute it and/or modify it under GPL2.

=begin How to usage
ruby convert2.rb [-p <tDiary path>] [-c <tdiary.conf path>]

-p <tDiary path>     : tDiaryのインストールパス。未指定時はカレントディレクトリ
                       例: -p /usr/local/tdiary
-c <tdiary.conf path>: tdiary.confが存在するパス。未指定時はカレントディレクトリ
                       例: -c /home/hoge/public_html/diary
=end

=begin ChangeLog
2002-10-08 TADA Tadashi <sho@spc.gr.jp>
	* for tDiary 1.5.0.20021003.

2002-08-16 TADA Tadashi <sho@spc.gr.jp>
	* follow new IO classes specification.

2002-07-25 TADA Tadashi <sho@spc.gr.jp>
	* display progress.

2002-07-23 TADA Tadashi <sho@spc.gr.jp>
	* fix some bugs.

2002-05-30 TADA Tadashi <sho@spc.gr.jp>
	* created.
=end

def usage
	puts "convert2: convert diary data file format tDiary1 to tDiary2."
	puts "usage: ruby convert2.rb [-p <tDiary path>] [-c <tdiary.conf path>]"
	exit
end

require 'getoptlong'
parser = GetoptLong::new
tdiary_path = '.'
tdiary_conf = nil
parser.set_options(
	['--path', '-p', GetoptLong::REQUIRED_ARGUMENT],
	['--conf', '-c', GetoptLong::REQUIRED_ARGUMENT]
)
begin
	parser.each do |opt, arg|
		case opt
		when '--path'
			tdiary_path = arg
		when '--conf'
			tdiary_conf = arg
		else
			usage
		end
	end
rescue
	usage
end

tdiary_conf = tdiary_path unless tdiary_conf
Dir::chdir( tdiary_conf )

begin
	ARGV << '' # dummy argument against cgi.rb offline mode.
	$:.unshift tdiary_path
	require "#{tdiary_path}/tdiary"
rescue LoadError
	$stderr.puts 'convert.rb: cannot load tdiary.rb. try -p option.'
	exit
end


module TDiary
	class TDiaryConvert2 < TDiaryBase
		def initialize
			cgi = CGI.new
			super( cgi, 'day.rhtml', Config::new(cgi) )
			require "#{PATH}/tdiary/pstoreio"
			@io_old = PStoreIO::new( self )
			@years = @io_old.calendar
			@years.keys.sort.each do |year|
				@years[year.to_s].sort.each do |month|
					puts "#{year}-#{month}"
					date = Time::local( year.to_i, month.to_i )
					@io_old.transaction( date ) do |diaries|
						@diaries = diaries
						false
					end
	
					require 'tdiary/defaultio'
					DefaultIO::new( self ).transaction( date ) do |diaries|
						diaries.update( @diaries )
						TDiaryBase::DIRTY_DIARY | TDiaryBase::DIRTY_COMMENT | TDiaryBase::DIRTY_REFERER
					end
					clear_parser_cache( date )
				end
			end
		end
	
	protected
		def cookie_name
			''
		end
	
		def cookie_mail
			''
		end
	end
end

TDiary::TDiaryConvert2::new


# Local Variables:
# mode: ruby
# indent-tabs-mode: t
# tab-width: 3
# ruby-indent-level: 3
# End: