tvkaista-0.95/Makefile tvkaista-0.961/Makefile
55
6all: tvkaista_gtkui6all: tvkaista_gtkui
77
8tvkaista_gtkui: tvkaista_gtkui.c tvkaista-helper.pl8tvkaista_gtkui: tvkaista_gtkui.c
9 perl -c tvkaista-helper.pl9 perl -c tvkaista-helper.pl
10 sh tvkaista_gtkui.c10 sh tvkaista_gtkui.c
1111
1515
16install: tvkaista_gtkui16install: tvkaista_gtkui
17 test -d "$$HOME"/.tvkaista || mkdir "$$HOME/".tvkaista17 test -d "$$HOME"/.tvkaista || mkdir "$$HOME/".tvkaista
18# cp tvkaista.sh "$$HOME"/.tvkaista18 cp tvkaista.sh "$$HOME"/.tvkaista
19 cp tvkaista_gtkui "$$HOME"/.tvkaista19 cp tvkaista_gtkui "$$HOME"/.tvkaista
20# cp tvkaista-helper.pl "$$HOME"/.tvkaista20 cp tvkaista-helper.pl "$$HOME"/.tvkaista
21 cp tvkaista.png "$$HOME"/.tvkaista21 cp tvkaista.png "$$HOME"/.tvkaista
22 cp tvkaista.menu "$$HOME"/.tvkaista
22 sed 's|$$dest|'"$$HOME/.tvkaista|" tvkaista.desktop \23 sed 's|$$dest|'"$$HOME/.tvkaista|" tvkaista.desktop \
23 > "$$HOME"/.tvkaista/tvkaista.desktop24 > "$$HOME"/.tvkaista/tvkaista.desktop
24 rm -f "$$HOME"/bin/tvkaista_gtk "$$HOME"/.tvkaista/tvkaista_gtk25 rm -f "$$HOME"/bin/tvkaista_gtk "$$HOME"/bin/tvkaista_gtkui \
26 "$$HOME"/.tvkaista/tvkaista_gtk
25 test ! -d "$$HOME"/bin \27 test ! -d "$$HOME"/bin \
26 || ln -sf ../.tvkaista/tvkaista_gtkui "$$HOME"/bin28 || ln -sf ../.tvkaista/tvkaista.sh "$$HOME"/bin
27 test ! -d "$$HOME"/Desktop \29 test ! -d "$$HOME"/Desktop \
28 || ln -sf ../.tvkaista/tvkaista.desktop "$$HOME"/Desktop30 || ln -sf ../.tvkaista/tvkaista.desktop "$$HOME"/Desktop
29 test ! -d "$$HOME"/Työpöytä \31 test ! -d "$$HOME"/Työpöytä \
30 || ln -sf ../.tvkaista/tvkaista.desktop "$$HOME"/Työpöytä32 || ln -sf ../.tvkaista/tvkaista.desktop "$$HOME"/Työpöytä
33 test -d "$$HOME"/.menu || mkdir "$$HOME"/.menu
34 ln -sf ../.tvkaista/tvkaista.menu "$$HOME"/.menu/tvkaista
3135
32gitlog: $(VERSION_CONTROLLED)36gitlog: $(VERSION_CONTROLLED)
33 git log --name-status > $@37 git log --name-status > $@

tvkaista-0.95/gitlog tvkaista-0.961/gitlog
1commit f1dc003e7f99226541007a7824307a54fca9b53d
2Author: Tomi Ollila <too@iki.fi>
3Date: Tue Apr 28 21:00:38 2009 +0300
4
5 split perl code out of tvkaista binary
6 made tvkaista.sh run gui
7 bumped version to 0.961
8
9M Makefile
10M tvkaista-helper.pl
11M tvkaista.desktop
12M tvkaista.sh
13M tvkaista_gtkui.c
14
15commit 084422633415fd64702be0fe5656d4163228679e
16Author: Tomi Ollila <too@koti-lappari.(none)>
17Date: Tue Apr 28 18:40:22 2009 +0300
18
19 lisäsin tvkaista.menu:n
20
21A tvkaista.menu
22
23commit f04634e66a47bce054c5385ca59e3e05d26198ec
24Author: Tomi Ollila <too@iki.fi>
25Date: Mon Apr 27 23:32:06 2009 +0300
26
27 esitä -> katso. tekstitystiedoston nimi "väliaikainen" katsottaessa.
28
29M tvkaista-helper.pl
30M tvkaista_gtkui.c
31
32commit ae2d0d013cea8ffb34052567b737721883f7c6cd
33Author: Tomi Ollila <too@koti-lappari.(none)>
34Date: Sun Apr 26 19:55:09 2009 +0300
35
36 Versio 0.95:
37 Xtermin "lävistusfd vaihdettu 15:sta 8:aa dashin takia
38 Kääntäjävaroituksia poistettu (yksi jää)
39 make distclean:ssa -f -optio rm:lle
40
41M tvkaista.desktop
42
1commit 7bcf15a6c866deecd68f56b45090bf84e0aa96ef43commit 7bcf15a6c866deecd68f56b45090bf84e0aa96ef
2Author: Tomi Ollila <too@koti-lappari.(none)>44Author: Tomi Ollila <too@koti-lappari.(none)>
3Date: Sun Apr 26 19:53:02 2009 +030045Date: Sun Apr 26 19:53:02 2009 +0300

tvkaista-0.95/tvkaista-helper.pl tvkaista-0.961/tvkaista-helper.pl
4# Author: Tomi Ollila -- too ät iki piste fi4# Author: Tomi Ollila -- too ät iki piste fi
5#5#
6# Created: Sat Feb 07 21:29:53 EET 2009 too6# Created: Sat Feb 07 21:29:53 EET 2009 too
7# Last modified: Sun 26 Apr 2009 12:46:56 EEST too7# Last modified: Tue 28 Apr 2009 20:40:41 EEST too
88
9#PERL_UNICODE=SD perl tvkaista-helper.pl 1 update9#PERL_UNICODE=SD perl tvkaista-helper.pl 1 update
10#or perl -CSD perl tvkaista-helper.pl 1 list
1011
11#noupdate: not yes
1212
13use strict;13use strict;
14use warnings;14use warnings;
34 open STDOUT, ">>&$dfd" if ($dfd > 1);34 open STDOUT, ">>&$dfd" if ($dfd > 1);
35}35}
36else { usage; }36else { usage; }
37my $recdir = '../recordings';37
38my $recdir = 'tallenteet';
38if (-e $recdir)39if (-e $recdir)
39{40{
40 die "'$recdir': not a directory.\n" unless -d $recdir;41 die "'$recdir': not a directory.\n" unless -d $recdir;
41}42}
42else { mkdir $recdir or die "Can not create '$recdir': $!\n"; }43else { mkdir $recdir or die "Can not create '$recdir': $!\n"; }
44
45mkdir 2, 0755;
4346
44my ($date, $time);47my ($date, $time);
45sub getdatetime()48sub getdatetime()
51}54}
52getdatetime;55getdatetime;
5356
54unless (-d "logs.$date") {57unless (-d "2/logs.$date") {
55 mkdir "logs.$date";58 mkdir "2/logs.$date";
56 unlink 'today';59 unlink '2/today';
57 symlink "logs.$date", 'today';60 symlink "logs.$date", '2/today';
58}61}
5962
60my ($username, $password, $b64cred) = ('', '', '');63my ($username, $password, $b64cred) = ('', '', '');
81 print "\n";84 print "\n";
82 system 'stty', 'echo';85 system 'stty', 'echo';
8386
84 open O, '>', 'tunnus' or die $!;87 open O, '>', '2/tunnus' or die $!;
85 print O "tunnus = $username\nsalasana = $password\n";88 print O "tunnus = $username\nsalasana = $password\n";
86 close O;89 close O;
87 $b64cred = encode_base64 "$username:$password", '';90 $b64cred = encode_base64 "$username:$password", '';
161164
162sub update ()165sub update ()
163{166{
164 feedwget "today/channels-$time.rss", 'http://www.tvkaista.fi/feed/';167 feedwget "2/today/channels-$time.rss", 'http://www.tvkaista.fi/feed/';
165 return 0 if -z "today/channels-$time.rss";168 return 0 if -z "2/today/channels-$time.rss";
166 open I, '<', "today/channels-$time.rss" or die $!;169 open I, '<', "2/today/channels-$time.rss" or die $!;
167 my (@channels, $linktail, $c);170 my (@channels, $linktail, $c);
168 while (<I>) { last if /<ttl>/; }171 while (<I>) { last if /<ttl>/; }
169 while (<I>) {172 while (<I>) {
178 push @urls, "http://www.tvkaista.fi/feed/channels/$_/flv.rss"181 push @urls, "http://www.tvkaista.fi/feed/channels/$_/flv.rss"
179 foreach (@channels);182 foreach (@channels);
180183
181 feedwget "today/a-$time-now.rss", @urls;184 feedwget "2/today/a-$time-now.rss", @urls;
182185
183 open I, '<', "today/a-$time-now.rss" or die $!;186 open I, '<', "2/today/a-$time-now.rss" or die $!;
184 fillprograms;187 fillprograms;
185 close I;188 close I;
186189
188 my @sorted = sort { $a->[0] <=> $b->[0] } @programs;191 my @sorted = sort { $a->[0] <=> $b->[0] } @programs;
189 @programs = ();192 @programs = ();
190 my @di = dateinfo $daysecs;193 my @di = dateinfo $daysecs;
191 my $outputfile = sprintf("program_%d-%02d-%02d",194 my $outputfile = sprintf("2/program_%d-%02d-%02d",
192 $di[4] + 1900, $di[3] + 1, $di[2]);195 $di[4] + 1900, $di[3] + 1, $di[2]);
193196
194 open O, '>', $outputfile or die $!;197 open O, '>', $outputfile or die $!;
198 @di = dateinfo $_->[0];201 @di = dateinfo $_->[0];
199 if ($fnd && $di[0] ge "0500") {202 if ($fnd && $di[0] ge "0500") {
200 close O;203 close O;
201 open O, '>', sprintf("program_%d-%02d-%02d",204 open O, '>', sprintf("2/program_%d-%02d-%02d",
202 $di[4] + 1900, $di[3] + 1, $di[2]) or die $!;205 $di[4] + 1900, $di[3] + 1, $di[2]) or die $!;
203 $fnd = 0;206 $fnd = 0;
204 $pday = '';207 $pday = '';
220 @urls = ();223 @urls = ();
221 @di = dateinfo $daysecs; $di[4] += 1900; $di[3]++;224 @di = dateinfo $daysecs; $di[4] += 1900; $di[3]++;
222225
223 $outputfile = sprintf("program_%d-%02d-%02d",$di[4],$di[3],$di[2]);226 $outputfile = sprintf("2/program_%d-%02d-%02d",$di[4],$di[3],$di[2]);
224 my @fst = stat $outputfile;227 my @fst = stat $outputfile;
225 next if (defined $fst[9] &&$fst[9] > $daysecs); # recent enough.228 next if (defined $fst[9] &&$fst[9] > $daysecs); # recent enough.
226229
228 . "/channels/$_/flv.rss" foreach (@channels);231 . "/channels/$_/flv.rss" foreach (@channels);
229232
230 getdatetime;233 getdatetime;
231 feedwget "today/a-$di[3]-$di[2]-$time.rss", @urls;234 feedwget "2/today/a-$di[3]-$di[2]-$time.rss", @urls;
232 last WHILE unless -s "today/a-$di[3]-$di[2]-$time.rss";235 last WHILE unless -s "2/today/a-$di[3]-$di[2]-$time.rss";
233236
234 open I, '<', "today/a-$di[3]-$di[2]-$time.rss" or die $!;237 open I, '<', "2/today/a-$di[3]-$di[2]-$time.rss" or die $!;
235 fillprograms;238 fillprograms;
236 close I;239 close I;
237240
260{263{
261 mkpw 1 if ($username eq '' or $password eq '');264 mkpw 1 if ($username eq '' or $password eq '');
262 getdatetime;265 getdatetime;
263 recwget "today/login-$time.html", 'http://www.tvkaista.fi/netpvr/Login',266 recwget "2/today/login-$time.html", 'http://www.tvkaista.fi/netpvr/Login',
264 '--save-cookies', "cookies-$date-$time.txt", '--keep-session-cookies',267 '--save-cookies', "cookies-$date-$time.txt", '--keep-session-cookies',
265 '--max-redirect=0',268 '--max-redirect=0',
266 '--post-data',269 '--post-data',
268 unlink 'cookies.txt';271 unlink 'cookies.txt';
269 symlink "cookies-$date-$time.txt", 'cookies.txt';272 symlink "cookies-$date-$time.txt", 'cookies.txt';
270273
271 return -z "today/login-$time.html";274 return -z "2/today/login-$time.html";
272}275}
273276
274sub getpw ()277sub getpw ()
275{278{
276 if (-f 'tunnus') {279 if (-f '2/tunnus') {
277 open I, '<', 'tunnus';280 open I, '<', '2/tunnus';
278 while (<I>) {281 while (<I>) {
279 $username = $1 if /^\s*tunnus\s*=\s*(\S+)/;282 $username = $1 if /^\s*tunnus\s*=\s*(\S+)/;
280 $password = $1 if /^\s*salasana\s*=\s*(\S+)/;283 $password = $1 if /^\s*salasana\s*=\s*(\S+)/;
288 }291 }
289}292}
290293
291sub getsrt($)294sub getsrt($$)
292{295{
293 #http://www.tvkaista.fi/netpvr/Download/774338.srt296 #http://www.tvkaista.fi/netpvr/Download/774338.srt
294297
295 my $tof = "../recordings/$ARGV[3].srt.wip";298 my $tof = "$_[0].srt";
296299
297 recwget $tof, "http://www.tvkaista.fi/netpvr/Download/$ARGV[3].srt",300 recwget $tof, "http://www.tvkaista.fi/netpvr/Download/$_[0].srt",
298 '--load-cookies', 'cookies.txt';301 '--load-cookies', '2/cookies.txt';
299302
300 open I, '<', $tof or return ( $ARGV[3], 0 );303 open I, '<', $tof or return ( $_[0], 0 );
301304
302 my ($namepfx, $haveit, $conlen) = ($ARGV[3], 0, -1);305 my ($namepfx, $haveit, $conlen) = ($_[0], 0, -1);
303 while (<I>) {306 while (<I>) {
304 $namepfx = $1, $haveit = 1 if /^Content-Disp.*filename=(.*).srt\s*$/;307 $namepfx = $1, $haveit = 1 if /^Content-Disp.*filename=(.*).srt\s*$/;
305 $conlen = $1 if /^Content-Length:\s+(\d+)/;308 $conlen = $1 if /^Content-Length:\s+(\d+)/;
307 }310 }
308 close I;311 close I;
309 if ($conlen > 0) {312 if ($conlen > 0) {
313 $namepfx = 'tekstitys' if $_[1] ne 'wget';
310 rename $tof, "../recordings/$namepfx.srt"; }314 rename $tof, "$namepfx.srt"; }
311 else {315 else {
312 unlink $tof; }316 unlink $tof; }
313317
322326
323 getpw;327 getpw;
324328
325 my $pagename = "today/play-$time.html";329 my $pagename = "2/today/play-$time.html";
326330
327 my $format = $speeds{$ARGV[4]};331 my $format = $speeds{$ARGV[4]};
328 recwget $pagename,332 recwget $pagename,
329 "http://www.tvkaista.fi/netpvr/VLC?id=$ARGV[3]&format=$format",333 "http://www.tvkaista.fi/netpvr/VLC?id=$ARGV[3]&format=$format",
330 '--load-cookies', 'cookies.txt';334 '--load-cookies', '2/cookies.txt';
331335
332 open I, '<', $pagename or die "Can not open '$pagename': $!\n";336 open I, '<', $pagename or die "Can not open '$pagename': $!\n";
333 my $url;337 my $url;
340 die "No content found!\n";344 die "No content found!\n";
341 }345 }
342346
343 my ($namepfx, $srtflen) = getsrt($ARGV[3]);
344 chdir $recdir;347 chdir $recdir;
348 my ($namepfx, $srtflen) = getsrt($ARGV[3], $ARGV[2]);
345349
346 my @list = ( $ARGV[2] );350 my @list = ( $ARGV[2] );
347 if ($ARGV[2] eq 'wget') {351 if ($ARGV[2] eq 'wget') {
363 system @list or warn "system(): $!\n";367 system @list or warn "system(): $!\n";
364 print "Executed @list\n";368 print "Executed @list\n";
365369
366 unlink "$namepfx.srt" if $srtflen > 0 && ($ARGV[2] ne 'wget');370 unlink "$namepfx.srt" if $srtflen > 0 && $ARGV[2] ne 'wget';
367371
368 # add more checks & cleanups372 # add more checks & cleanups
369 exit 0;373 exit 0;
401# "list" (and "update" too)405# "list" (and "update" too)
402select STDOUT;406select STDOUT;
403407
404my @prgfiles = <program_*[0-9]>;408my @prgfiles = <2/program_*[0-9]>;
405unlink shift @prgfiles while defined $prgfiles[15];409unlink shift @prgfiles while defined $prgfiles[15];
406foreach (@prgfiles)410foreach (@prgfiles)
407{411{

tvkaista-0.95/tvkaista.desktop tvkaista-0.961/tvkaista.desktop
1[Desktop Entry]1[Desktop Entry]
2Encoding=UTF-82Encoding=UTF-8
3Version=0.953Version=0.961
4Name=tvkaista4Name=tvkaista
5Comment=gui-kilentti tvkaistalle5Comment=gui-kilentti tvkaistalle
6GenericName=tvkaista-kilentti6GenericName=tvkaista-kilentti

tvkaista-0.95/tvkaista.sh tvkaista-0.961/tvkaista.sh
9# All rights reserved9# All rights reserved
10#10#
11# Created: Sat Jan 30 18:41:21 EET 2009 too11# Created: Sat Jan 30 18:41:21 EET 2009 too
12# Last modified: Wed Feb 25 19:35:02 EET 2009 too12# Last modified: Tue 28 Apr 2009 20:58:20 EEST too
1313
14LANG=fi_FI.utf8 LC_ALL=fi_FI.utf8; export LANG LC_ALL14LANG=fi_FI.utf8 LC_ALL=fi_FI.utf8; export LANG LC_ALL
15LESS= LESSCHARSET=utf-8; export LESS LESSCHARSET15LESS= LESSCHARSET=utf-8; export LESS LESSCHARSET
91EOF91EOF
92}92}
9393
94
95cmd_source () # katso annetun '$0' -komennon lähdekoodia94cmd_source () # katso annetun '$0' -komennon lähdekoodia
96{95{
97 set +x96 set +x
98 case $1 in '') die $0 $cm cmd-prefix ;; esac97 case $1 in '') die $0 $cm cmd-prefix ;; esac
99 echo98 echo
100 sed -n "/cmd_$1/,/^}/p" "$0"99 sed -n "/cmd_$1/,/^}/p" "$0"
100}
101
102cmd_gui () # start tvkaista gui
103{
104 c=$0
105 while
106 cd `dirname "$c"`
107 f=`basename "$c"`
108 test -h "$f"
109 do
110 c=`LC_ALL=C LANG=C /bin/ls -l "$f" | awk '{ print $11 }'`
111 done
112
113 exec ./tvkaista_gtkui
101}114}
102115
103# ad hoc hack #1116# ad hoc hack #1

tvkaista-0.95/tvkaista_gtkui.c tvkaista-0.961/tvkaista_gtkui.c
1#if 0 /* -*- mode: c; c-file-style: "stroustrup"; tab-width: 8; -*-1#if 0 /* -*- mode: c; c-file-style: "stroustrup"; tab-width: 8; -*-
2
2 set -e; TRG=`basename $0 .c`; rm -f "$TRG"3set -e; TRG=`basename $0 .c`; rm -f "$TRG"
3 WARN="-Wall -Wno-long-long -Wstrict-prototypes -pedantic"4WARN="-Wall -Wno-long-long -Wstrict-prototypes -pedantic"
4 WARN="$WARN -Wcast-align -Wpointer-arith " # -Wfloat-equal #-Werror5WARN="$WARN -Wcast-align -Wpointer-arith " # -Wfloat-equal #-Werror
5 WARN="$WARN -W -Wwrite-strings -Wcast-qual -Wshadow" # -Wconversion6WARN="$WARN -W -Wwrite-strings -Wcast-qual -Wshadow" # -Wconversion
6 X=`pkg-config --cflags --libs gtk+-2.0`7X=`pkg-config --cflags --libs gtk+-2.0`
7 gzip -9 -c < tvkaista-helper.pl > helper.gz
8 { echo 'const unsigned char helpercode[] = {'
9 perl -e 'printf("0x%x,\n", ord $_) while read STDIN, $_, 1' < helper.gz
10 #perl -pe 's/./sprintf"0x%x,\n",ord $&/ge' helper.gz
11 echo '}; const unsigned int helpercode_size = sizeof helpercode;';
12 echo const unsigned int helpercode_full_size = `stat -c %s tvkaista-helper.pl`\;
13 } > helper.c
14 case $1 in '') set x -O2 ### set x -ggdb;8case $1 in '') set x -O2 ### set x -ggdb;
15 shift ;; esac;9 shift ;; esac;
16 set -x; ${CC:-gcc} -std=gnu99 $WARN "$@" helper.c -o "$TRG" "$0" \10set -x; ${CC:-gcc} -std=gnu99 $WARN "$@" -o "$TRG" "$0" -DCDATE="\"`date`\"" $X
17 -DCDATE="\"`date`\"" $X
18 exit $?11exit $?
12
19 */13 */
20#endif14#endif
21/*15/*
24 * Author: Tomi Ollila -- too ät iki piste fi18 * Author: Tomi Ollila -- too ät iki piste fi
25 *19 *
26 * Copyright (c) 2009 Tomi Ollila20 * Copyright (c) 2009 Tomi Ollila
27 * Copyright (c) 2009
28 * All rights reserved21 * All rights reserved
29 *22 *
30 * Created: Tue Feb 03 19:04:43 EET 2009 too23 * Created: Tue Feb 03 19:04:43 EET 2009 too
4740
48#include <signal.h>41#include <signal.h>
49#include <errno.h>42#include <errno.h>
50
51extern const unsigned char helpercode[];
52extern const unsigned int helpercode_size;
53extern const unsigned int helpercode_full_size;
5443
55#define null ((void*)0)44#define null ((void*)0)
5645
118 char * path;107 char * path;
119 char compare[MAXSEARCHLEN + 2];108 char compare[MAXSEARCHLEN + 2];
120 // max 32 for now (14 is current maximum in tvkaista).109 // max 32 for now (14 is current maximum in tvkaista).
121 char prgfile[32][sizeof "program_2009-mm-dd"];110 char prgfile[32][sizeof "2/program_2009-mm-dd"];
122 int prgfd[32];111 int prgfd[32];
123 PrgInfo * prgbuffers[100]; // up to 100 000 programs.112 PrgInfo * prgbuffers[100]; // up to 100 000 programs.
124 int previndx;113 int previndx;
135} W;124} W;
136125
137// XXX make better later...126// XXX make better later...
138const char G_helper[] = "./tvkaista-helper02.pl";127const char G_helper[] = "./tvkaista-helper.pl";
139128
140void init_G(void)129void init_G(void)
141{130{
796 aHBox(/* <- homogeneous spacing */ false, 2,785 aHBox(/* <- homogeneous spacing */ false, 2,
797 aButton("Päivitä", update_pressed, null),786 aButton("Päivitä", update_pressed, null),
798 /* ^^ expand fill padding */ false, true, 2,787 /* ^^ expand fill padding */ false, true, 2,
799 aButton("Esitä", play_pressed, null),788 aButton("Katso", play_pressed, null),
800 /* ^^ expand fill padding */ false, true, 2,789 /* ^^ expand fill padding */ false, true, 2,
801 aButton("Tallenna", save_pressed, null),790 aButton("Tallenna", save_pressed, null),
802 /* ^^ expand fill padding */ false, true, 2,791 /* ^^ expand fill padding */ false, true, 2,
839// gtk_widget_show_all(W.w);828// gtk_widget_show_all(W.w);
840}829}
841830
842void output_pl(void)
843{
844 char path[512];
845 struct stat st;
846 const char * home = getenv("HOME");
847
848 if (strlen(home) > 128)
849 die("Home directory path too long\n");
850
851 sprintf(path, "%s/.tvkaista/2/tvkaista-helper02.pl", home);
852
853 //putenv("SHELL=/bin/sh");
854 setenv("SHELL", "/bin/sh", 1);
855 if (system("tvdir=\"$HOME\"/.tvkaista/2;\n"
856 "test -d \"$tvdir\" || mkdir \"$tvdir\";\n"
857 "helper=\"$tvdir\"/tvkaista-helper02.pl\n"
858 "test -x \"$helper\" || exit 1;\n"
859 "exec grep '^#noupdate: yes' \"$helper\" >/dev/null 2>&1\n"
860 ) != 0) {
861 FILE * fh;
862 fh = popen("gzip -dc > \"$HOME\"/.tvkaista/2/tvkaista-helper02.pl",
863 "w");
864 if (fh == null)
865 die("popen():");
866 if (fwrite(helpercode, 1, helpercode_size, fh) != helpercode_size)
867 die("fwrite():");
868 pclose(fh);
869 chmod(path, 0755);
870 }
871 if (stat(path, &st) < 0)
872 die("stat():");
873 if ((st.st_mode & 0777) != 0755)
874 die("st.st_mode (%0) != 0755\n", st.st_mode);
875 if (st.st_size != (int)helpercode_full_size) {
876 die("helpercode == %ld, not %d\n", st.st_size, helpercode_full_size);
877 }
878 sprintf(path, "%s/.tvkaista/2", home);
879 if (chdir(path) < 0)
880 die("chdir():");
881}
882831
883832
884int main(int argc, char *argv[])833int main(int argc, char *argv[])
887 init_G();836 init_G();
888 gtk_init(&argc, &argv);837 gtk_init(&argc, &argv);
889 setenv("PERL_UNICODE", "SD", 1);838 setenv("PERL_UNICODE", "SD", 1);
890 output_pl();
891 gui();839 gui();
892 gtk_main();840 gtk_main();
893 return 0;841 return 0;