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
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
|
diff -rupN tint-0.03b/config.h tint/config.h
--- tint-0.03b/config.h 2001-12-08 00:03:24.000000000 +0100
+++ tint/config.h 2016-05-27 14:47:15.797402090 +0200
@@ -29,7 +29,16 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include <libpayload.h>
+#include <curses.h>
+#define random(x) rand(x)
+#define srandom(x) srand(x)
+#define curs_set(x)
+
+
/* Score file */
+#if 0
const char scorefile[] = SCOREFILE;
+#endif
#endif /* #ifndef CONFIG_H */
diff -rupN tint-0.03b/debian/changelog tint/debian/changelog
--- tint-0.03b/debian/changelog 2005-07-17 13:32:20.000000000 +0200
+++ tint/debian/changelog 1970-01-01 01:00:00.000000000 +0100
@@ -1,53 +0,0 @@
-tint (0.03b) unstable; urgency=low
-
- * Added breaks at end of switch statements to keep gcc 3+ happy
- (Closes: #316022)
- * Added missing includes to engine.c
- * Fixed spelling mistake in NOTES
- * Updated debian policy version
-
- -- Abraham van der Merwe <abz@debian.org> Sun, 17 Jul 2005 13:32:17 +0200
-
-tint (0.03a) unstable; urgency=low
-
- * Applied patch with some minor tweaks from Marcello Mamino which
- adds a dotted background.
- * Applied patches from Robert Lemmen which add support for user logins as
- default name and an interactive mode for specifying the start level.
- * Show player statistics.
-
- -- Abraham van der Merwe <abz@debian.org> Mon, 16 Jun 2003 23:07:37 +0200
-
-tint (0.02d) unstable; urgency=low
-
- * Install man page in correct directory (Closes: #128923)
- * Created a postinst program that checks for old score files
- before installing the default score file (Closes: #136466)
- * Added a menu control file (Closes: #128924)
-
- -- Abraham van der Merwe <abz@debian.org> Wed, 19 Dec 2001 18:03:34 +0200
-
-tint (0.02c) unstable; urgency=low
-
- * Removed common-sense suggests from control file *g* (Closes: #123204)
-
- -- Abraham van der Merwe <abz@debian.org> Wed, 19 Dec 2001 18:03:34 +0200
-
-tint (0.02b) unstable; urgency=low
-
- * Changed the name from tclassic to tint (as in TINT Is Not Tetris(tm))
- * Added a build dependancy on libncurses5-dev (Closes: #124241)
- * Changed the location for the score file to /var/games (Closes: #124236)
- * Made score file sgid games (Closes: #123595)
-
- -- Abraham van der Merwe <abz@debian.org> Wed, 19 Dec 2001 18:03:34 +0200
-
-tclassic (0.02a) unstable; urgency=low
-
- * Initial Release. (Closes: #122839)
-
- -- Abraham van der Merwe <abz@debian.org> Fri, 7 Dec 2001 17:59:25 +0200
-
-Local variables:
-mode: debian-changelog
-End:
diff -rupN tint-0.03b/debian/control tint/debian/control
--- tint-0.03b/debian/control 2005-07-17 13:31:13.000000000 +0200
+++ tint/debian/control 1970-01-01 01:00:00.000000000 +0100
@@ -1,19 +0,0 @@
-Source: tint
-Section: games
-Priority: optional
-Maintainer: Abraham van der Merwe <abz@debian.org>
-Build-Depends: debhelper (>> 3.0.0), libncurses5-dev
-Standards-Version: 3.6.1
-
-Package: tint
-Architecture: any
-Depends: ${shlibs:Depends}
-Replaces: tclassic
-Conflicts: tclassic
-Description: TINT Is Not Tetris(tm) ...at least the name isn't
- As the title suggests, this is a clone of the original tetris game
- written by Alexey Pajitnov, Dmitry Pavlovsky, and Vadim Gerasimov.
- .
- I've tried to keep the game as close to the original as possible, but
- there is a few differences. Nevertheless, it's probably the closest to
- the original that you'll ever find in the UNIX world...
diff -rupN tint-0.03b/debian/copyright tint/debian/copyright
--- tint-0.03b/debian/copyright 2001-12-19 17:08:42.000000000 +0100
+++ tint/debian/copyright 1970-01-01 01:00:00.000000000 +0100
@@ -1,39 +0,0 @@
-This is the Debian GNU/Linux prepackaged version of tint. These
-files were written and packaged by Abraham van der Merwe <abz@debian.org>
-
-The games is released under a derivative of the BSD license. For more
-information see http://www.opensource.org/licenses/bsd-license.html
-
-The original source can be found at: http://oasis.frogfoot.net
-
-Copyright:
-
- Copyright (c) Abraham vd Merwe <abz@blio.net>
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- 3. Neither the name of the author nor the names of other contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
diff -rupN tint-0.03b/debian/.depends tint/debian/.depends
--- tint-0.03b/debian/.depends 2002-03-16 17:26:42.000000000 +0100
+++ tint/debian/.depends 1970-01-01 01:00:00.000000000 +0100
@@ -1 +0,0 @@
-tint.postinst.o: tint.postinst.c
diff -rupN tint-0.03b/debian/dirs tint/debian/dirs
--- tint-0.03b/debian/dirs 2002-03-16 17:58:42.000000000 +0100
+++ tint/debian/dirs 1970-01-01 01:00:00.000000000 +0100
@@ -1,2 +0,0 @@
-usr/games
-usr/share/man/man6
diff -rupN tint-0.03b/debian/docs tint/debian/docs
--- tint-0.03b/debian/docs 2001-12-07 17:25:17.000000000 +0100
+++ tint/debian/docs 1970-01-01 01:00:00.000000000 +0100
@@ -1,2 +0,0 @@
-NOTES
-CREDITS
diff -rupN tint-0.03b/debian/Makefile tint/debian/Makefile
--- tint-0.03b/debian/Makefile 2002-03-16 18:41:18.000000000 +0100
+++ tint/debian/Makefile 1970-01-01 01:00:00.000000000 +0100
@@ -1,28 +0,0 @@
-
-# -*- sh -*-
-
-# Written by Abraham van der Merwe <abz@blio.net>
-# Last updated: 2002-03-26
-
-CC = gcc
-CFLAGS = -Wall -Os -pipe
-LDFLAGS = -s
-
-STRIP = strip
-STRIPFLAGS = --strip-all --remove-section=.note --remove-section=.comment
-
-OBJ =
-SRC = $(OBJ:%.o=%.c)
-PRG =
-
-all: #$(PRG)
-
-$(PRG): $(OBJ)
- $(CC) $(CPPFLAGS) $(CFLAGS) $^ -o $@ $(LDFLAGS) $(LDLIBS)
-
-clean:
- rm -rf tint
- rm -f *~ $(OBJ) $(PRG) *.substvars *.debhelper
-
-.PHONY: all clean
-
diff -rupN tint-0.03b/debian/menu tint/debian/menu
--- tint-0.03b/debian/menu 2002-03-16 18:31:13.000000000 +0100
+++ tint/debian/menu 1970-01-01 01:00:00.000000000 +0100
@@ -1,4 +0,0 @@
-?package(tint):needs="text" section="Games/Tetris-like" \
- title="TINT Is Not Tetris(tm)" \
- command="sh -c '/usr/games/tint -l 5;echo;echo PRESS ENTER;read line'" \
- hints="Text"
diff -rupN tint-0.03b/debian/postinst tint/debian/postinst
--- tint-0.03b/debian/postinst 2002-03-16 18:44:34.000000000 +0100
+++ tint/debian/postinst 1970-01-01 01:00:00.000000000 +0100
@@ -1,13 +0,0 @@
-#!/bin/sh -e
-
-scorefile="/var/games/tint.scores"
-
-if [ ! -e $scorefile ]
-then
- touch $scorefile
- chmod 0664 $scorefile
- chown root:games $scorefile
-fi
-
-#DEBHELPER#
-
diff -rupN tint-0.03b/debian/postinst.c tint/debian/postinst.c
--- tint-0.03b/debian/postinst.c 2002-03-16 18:15:32.000000000 +0100
+++ tint/debian/postinst.c 1970-01-01 01:00:00.000000000 +0100
@@ -1,143 +0,0 @@
-
-/*
- * Hacked up postinst program to install the default score file. We have to do it this
- * way, since the old score file is overwritten if the score file already exists in the
- * package - abz
- */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <pwd.h>
-#include <grp.h>
-#include <inttypes.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-/* location of score file */
-static const char filename[] = "/var/games/tint.scores";
-
-/* user name of default score file */
-static const char user[] = "root";
-
-/* group name of default score file */
-static const char group[] = "games";
-
-/* contents of default score file */
-static const uint8_t contents[] =
-{
- 0x54, 0x69, 0x6e, 0x74, 0x20, 0x30, 0x2e, 0x30,
- 0x32, 0x62, 0x20, 0x28, 0x63, 0x29, 0x20, 0x41,
- 0x62, 0x72, 0x61, 0x68, 0x61, 0x6d, 0x20, 0x76,
- 0x64, 0x20, 0x4d, 0x65, 0x72, 0x77, 0x65, 0x20,
- 0x2d, 0x20, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x73,
- 0x52, 0x69, 0x61, 0x61, 0x6e, 0x20, 0x45, 0x6e,
- 0x67, 0x65, 0x6c, 0x62, 0x72, 0x65, 0x63, 0x68,
- 0x74, 0x00, 0x10, 0x5f, 0x00, 0x00, 0xb7, 0xc8,
- 0x20, 0x3c, 0x41, 0x62, 0x7a, 0x00, 0x80, 0x3a,
- 0x00, 0x00, 0x94, 0xc5, 0x20, 0x3c, 0x52, 0x69,
- 0x61, 0x61, 0x6e, 0x20, 0x45, 0x6e, 0x67, 0x65,
- 0x6c, 0x62, 0x72, 0x65, 0x63, 0x68, 0x74, 0x00,
- 0x66, 0x21, 0x00, 0x00, 0x31, 0xc9, 0x20, 0x3c,
- 0x52, 0x69, 0x61, 0x61, 0x6e, 0x20, 0x45, 0x6e,
- 0x67, 0x65, 0x6c, 0x62, 0x72, 0x65, 0x63, 0x68,
- 0x74, 0x00, 0xdc, 0x1a, 0x00, 0x00, 0x79, 0xc6,
- 0x20, 0x3c, 0x52, 0x69, 0x61, 0x61, 0x6e, 0x20,
- 0x45, 0x6e, 0x67, 0x65, 0x6c, 0x62, 0x72, 0x65,
- 0x63, 0x68, 0x74, 0x00, 0x2f, 0x16, 0x00, 0x00,
- 0xf9, 0xc5, 0x20, 0x3c, 0x52, 0x69, 0x61, 0x61,
- 0x6e, 0x20, 0x45, 0x6e, 0x67, 0x65, 0x6c, 0x62,
- 0x72, 0x65, 0x63, 0x68, 0x74, 0x00, 0x8b, 0x11,
- 0x00, 0x00, 0x82, 0xc7, 0x20, 0x3c, 0x41, 0x62,
- 0x7a, 0x00, 0x23, 0x10, 0x00, 0x00, 0xa9, 0xc9,
- 0x20, 0x3c, 0x44, 0x6f, 0x70, 0x70, 0x65, 0x6c,
- 0x67, 0x61, 0x6e, 0x67, 0x65, 0x72, 0x00, 0x13,
- 0x0b, 0x00, 0x00, 0x21, 0xc7, 0x20, 0x3c, 0x4a,
- 0x6f, 0x68, 0x61, 0x6e, 0x6e, 0x20, 0x42, 0x6f,
- 0x74, 0x68, 0x61, 0x00, 0x5a, 0x09, 0x00, 0x00,
- 0xef, 0xc6, 0x20, 0x3c, 0x41, 0x62, 0x7a, 0x00,
- 0xd7, 0x07, 0x00, 0x00, 0xad, 0xc6, 0x20, 0x3c
-};
-
-static void debhelper_stuff()
-{
- /* dh_installdocs */
- system ("if [ -d /usr/doc -a ! -e /usr/doc/tint -a -d /usr/share/doc/tint ]; then\n"
- " ln -sf ../share/doc/tint /usr/doc/tint\n"
- "fi\n");
-
- /* dh_installmenu */
- system ("if [ -x /usr/bin/update-menus ]; then update-menus ; fi");
-}
-
-int main (int argc,char *argv[])
-{
- struct stat sb;
-
- /* we only do something if we're called as <program> configure ... */
- if (argc < 2 || strcmp (argv[1],"configure")) exit (EXIT_SUCCESS);
-
- /* if the score file doesn't exist, create it */
- if (stat (filename,&sb) < 0)
- {
- int fd,result;
- struct passwd *u;
- struct group *g;
- uid_t uid;
- gid_t gid;
-
- /* get uid */
- if ((u = getpwnam (user)) == NULL)
- {
- fprintf (stderr,"Couldn't obtain uid for %s: %m\n",user);
- exit (EXIT_FAILURE);
- }
- uid = u->pw_uid;
-
- /* get gid */
- if ((g = getgrnam (group)) == NULL)
- {
- fprintf (stderr,"Couldn't obtain gid for %s: %m\n",group);
- exit (EXIT_FAILURE);
- }
- gid = g->gr_gid;
-
- /* create default score file */
- if ((fd = creat (filename,0664)) < 0)
- {
- fprintf (stderr,"Couldn't create score file %s: %m\n",filename);
- exit (EXIT_FAILURE);
- }
- result = write (fd,contents,sizeof (contents));
- if (result < 0)
- {
- fprintf (stderr,"Unable to write to %s: %m\n",filename);
- close (fd);
- unlink (filename);
- exit (EXIT_FAILURE);
- }
- if (result < sizeof (contents))
- {
- fprintf (stderr,"Short write count. %d/%d bytes written to %s\n",result,sizeof (contents),filename);
- close (fd);
- unlink (filename);
- exit (EXIT_FAILURE);
- }
- close (fd);
-
- /* change ownership of score file */
- if (chown (filename,uid,gid) < 0)
- {
- fprintf (stderr,"Couldn't change ownership of %s to %s:%s: %m\n",filename,user,group);
- unlink (filename);
- exit (EXIT_FAILURE);
- }
- }
-
- debhelper_stuff ();
-
- exit (EXIT_SUCCESS);
-}
-
diff -rupN tint-0.03b/debian/rules tint/debian/rules
--- tint-0.03b/debian/rules 2002-03-16 18:00:11.000000000 +0100
+++ tint/debian/rules 1970-01-01 01:00:00.000000000 +0100
@@ -1,82 +0,0 @@
-#!/usr/bin/make -f
-
-# -*- sh -*-
-
-# Uncomment this to turn on verbose mode.
-export DH_VERBOSE=1
-
-# This is the debhelper compatability version to use.
-export DH_COMPAT=3
-
-configure: configure-stamp
-configure-stamp:
- dh_testdir
- # Add here commands to configure the package.
-
-
- touch configure-stamp
-
-build: configure-stamp build-stamp
-build-stamp:
- dh_testdir
-
- # Add here commands to compile the package.
- $(MAKE)
-
- touch build-stamp
-
-clean:
- dh_testdir
- dh_testroot
- rm -f build-stamp configure-stamp
-
- # Add here commands to clean up after the build process.
- -$(MAKE) clean
-
- dh_clean
-
-install: build
- dh_testdir
- dh_testroot
- dh_clean -k
- dh_installdirs
-
- # Add here commands to install the package into debian/tint.
- $(MAKE) install DESTDIR=$(CURDIR)/debian/tint
-
-# Build architecture-independent files here.
-binary-indep: build install
-# We have nothing to do by default.
-
-# Build architecture-dependent files here.
-binary-arch: build install
- dh_testdir
- dh_testroot
-# dh_installdebconf
- dh_installdocs
-# dh_installexamples
- dh_installmenu
-# dh_installlogrotate
-# dh_installemacsen
-# dh_installpam
-# dh_installmime
-# dh_installinit
-# dh_installcron
- dh_installman
-# dh_installinfo
-# dh_undocumented
- dh_installchangelogs
- dh_link
- dh_strip
- dh_compress
-# dh_fixperms --exclude /usr/games/tint
-# dh_makeshlibs
- dh_installdeb
-# dh_perl
- dh_shlibdeps
- dh_gencontrol
- dh_md5sums
- dh_builddeb
-
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install configure
diff -rupN tint-0.03b/engine.c tint/engine.c
--- tint-0.03b/engine.c 2005-07-17 13:26:22.000000000 +0200
+++ tint/engine.c 2016-05-27 19:05:21.681035752 +0200
@@ -27,10 +27,13 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
+
+#if 0
#include <stdlib.h>
#include <string.h>
+#endif
-#include "typedefs.h"
#include "utils.h"
#include "io.h"
#include "engine.h"
diff -rupN tint-0.03b/engine.h tint/engine.h
--- tint-0.03b/engine.h 2001-12-07 16:48:08.000000000 +0100
+++ tint/engine.h 2016-05-27 19:04:32.456828081 +0200
@@ -29,7 +29,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "typedefs.h" /* bool */
+#include "curses.h" /* bool */
/*
* Macros
diff -rupN tint-0.03b/io.c tint/io.c
--- tint-0.03b/io.c 2001-12-07 16:48:20.000000000 +0100
+++ tint/io.c 2016-05-27 14:47:15.798402053 +0200
@@ -27,9 +27,13 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
+
+#if 0
#include <stdarg.h> /* va_list(), va_start(), va_end() */
#include <sys/time.h> /* gettimeofday() */
#include <unistd.h> /* gettimeofday() */
+#endif
#include <curses.h>
@@ -70,7 +74,11 @@ static int in_timeleft;
/* Initialize screen */
void io_init ()
{
+ curses_enable_serial(0);
+ curses_enable_vga(1);
initscr ();
+ halfdelay(1);
+ timeout(1);
start_color ();
curs_set (CURSOR_INVISIBLE);
out_attr = A_NORMAL;
@@ -176,11 +184,17 @@ void out_beep ()
/* Read a character. Please note that you MUST call in_timeout() before in_getch() */
int in_getch ()
{
+#if 0
struct timeval starttv,endtv;
+#endif
int ch;
+#if 0
timeout (in_timeleft / 1000);
gettimeofday (&starttv,NULL);
+#endif
ch = getch ();
+ mdelay(150);
+#if 0
gettimeofday (&endtv,NULL);
/* Timeout? */
if (ch == ERR)
@@ -198,6 +212,7 @@ int in_getch ()
in_timeleft -= endtv.tv_usec;
if (in_timeleft <= 0) in_timeleft = in_timetotal;
}
+#endif
return ch;
}
diff -rupN tint-0.03b/Makefile tint/Makefile
--- tint-0.03b/Makefile 2005-07-17 13:30:54.000000000 +0200
+++ tint/Makefile 2016-05-27 21:04:02.374391088 +0200
@@ -28,85 +28,79 @@
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#CROSS = arm-linux-
-
-bindir = $(DESTDIR)/usr/games
-mandir = $(DESTDIR)/usr/share/man
-localstatedir = $(DESTDIR)/var/games
-
-ifeq ($(CC),)
-CC = gcc
-else
-ifeq ($(CC),colorgcc)
- ifneq ($(CROSS),)
- CC = gcc
- endif
+# in addition to the dependency below, create the file if it doesn't exist
+# to silence warnings about a file that would be generated anyway.
+$(if $(wildcard .xcompile),,$(eval $(shell ../../../../util/xcompile/xcompile $(XGCCPATH) > .xcompile || rm -f .xcompile)))
+.xcompile: ../../../../util/xcompile/xcompile
+
+CONFIG_COMPILER_GCC := y
+ARCH-y := x86_32
+
+include .xcompile
+
+src := $(CURDIR)
+srctree := $(src)
+tint_obj := $(src)/build
+
+LIBCONFIG_PATH := $(realpath ../../../libpayload)
+LIBPAYLOAD_DIR := $(tint_obj)/libpayload
+HAVE_LIBPAYLOAD := $(wildcard $(LIBPAYLOAD_DIR)/lib/libpayload.a)
+LIB_CONFIG ?= configs/defconfig-tinycurses
+
+# CFLAGS := -Wall -Werror -Os
+CFLAGS := -Wall -g -Os
+TARGET := tint
+OBJS := $(TARGET).o engine.o io.o utils.o
+
+ARCH-y := x86_32
+
+CC := $(CC_$(ARCH-y))
+AS := $(AS_$(ARCH-y))
+OBJCOPY := $(OBJCOPY_$(ARCH-y))
+
+LPCC := CC="$(CC)" $(LIBPAYLOAD_DIR)/bin/lpgcc
+LPAS := AS="$(AS)" $(LIBPAYLOAD_DIR)/bin/lpas
+
+# Make is silent per default, but 'make V=1' will show all compiler calls.
+ifneq ($(V),1)
+Q := @
endif
-endif
-
-CFLAGS = -Wall -Os -pipe
-CPPFLAGS = -DSCOREFILE=\"$(localstatedir)/$(PRG).scores\" #-DUSE_RAND
-LDFLAGS = -s
-LDLIBS = -lncurses
-
-STRIP = strip
-STRIPFLAGS = --strip-all --remove-section=.note --remove-section=.comment
-
-INSTALL = install
-
-OBJ = engine.o utils.o io.o tint.o
-SRC = $(OBJ:%.o=%.c)
-PRG = tint
-
- ########### NOTHING TO EDIT BELOW THIS ###########
-
-.PHONY: all clean do-it-all depend with-depends without-depends debian postinst
-
-all: do-it-all postinst
-ifeq (.depends,$(wildcard .depends))
-include .depends
-do-it-all: with-depends
+all: $(TARGET).elf
+# printf" CC $(CC)\n"
+
+$(TARGET).elf: $(OBJS) libpayload
+ $(Q)printf " LPCC $(subst $(shell pwd)/,,$(@))\n"
+ $(Q)$(LPCC) -o $@ $(OBJS)
+ $(Q)$(OBJCOPY) --only-keep-debug $@ tint.debug
+ $(Q)$(OBJCOPY) --strip-debug $@
+ $(Q)$(OBJCOPY) --add-gnu-debuglink=tint.debug $@
+
+%.o: %.c libpayload
+ $(Q)printf " LPCC $(subst $(shell pwd)/,,$(@))\n"
+ $(Q)$(LPCC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
+
+%.S.o: %.S libpayload
+ $(Q)printf " LPAS $(subst $(shell pwd)/,,$(@))\n"
+ $(Q)$(LPAS) $(ASFLAGS) --32 -o $@ $<
+
+ifneq ($(strip $(HAVE_LIBPAYLOAD)),)
+libpayload:
+ $(Q)printf "Found Libpayload $(LIBPAYLOAD_DIR).\n"
else
-do-it-all: without-depends
-endif
-
-without-depends: depend with-depends
-
-depend:
- rm -f .depends
- set -e; for F in $(SRC); do $(CC) -MM $(CFLAGS) $(CPPFLAGS) $$F >> .depends; done
-
-with-depends: $(PRG)
-
-$(PRG): $(OBJ)
- $(CROSS)$(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS)
- $(CROSS)$(STRIP) $(STRIPFLAGS) $@
-
-ifneq ($(DESTDIR),)
-install: $(PRG)
- $(INSTALL) -d $(bindir) $(mandir) $(localstatedir)
- $(INSTALL) -s -g games -o root -m 2755 $(PRG) $(bindir)
- $(INSTALL) -g games -o root -m 0644 $(PRG).6 $(mandir)/man6
-# cp tint.scores $(localstatedir)/$(PRG).scores
-# chown root.games $(localstatedir)/$(PRG).scores
-# chmod 0664 $(localstatedir)/$(PRG).scores
-
-uninstall:
- rm -f $(bindir)/$(PRG) $(mandir)/man6/$(PRG).6 $(localstatedir)/$(PRG).scores
+libpayload:
+ $(Q)printf "Building libpayload @ $(LIBCONFIG_PATH).\n"
+ $(Q)make -C $(LIBCONFIG_PATH) distclean
+ $(Q)make -C $(LIBCONFIG_PATH) defconfig KBUILD_DEFCONFIG=$(LIB_CONFIG)
+ $(Q)make -C $(LIBCONFIG_PATH) DESTDIR=$(tint_obj) install
endif
-postinst:
- $(MAKE) -C debian
-
-debian:
- dpkg-buildpackage -rfakeroot -k2B555AEE
-
clean:
- rm -f .depends *~ $(OBJ) $(PRG) {configure,build}-stamp gmon.out a.out
- rm -rf debian/$(PRG)
- rm -f debian/*.{debhelper,substvars} debian/files debian/*~
+ $(Q)rm -f $(TARGET).elf $(TARGET).debug *.o
+ $(Q)rm .xcompile
distclean: clean
- $(MAKE) -C debian clean
+ $(Q)rm -rf $(tint_obj)
+
+.PHONY: all clean do-it-all depend with-depends without-depends debian postinst
Binary files tint-0.03b/.Makefile.swp and tint/.Makefile.swp differ
diff -rupN tint-0.03b/tint.c tint/tint.c
--- tint-0.03b/tint.c 2005-07-17 13:26:43.000000000 +0200
+++ tint/tint.c 2016-05-27 18:59:53.838346317 +0200
@@ -1,4 +1,3 @@
-
/*
* Copyright (c) Abraham vd Merwe <abz@blio.net>
* All rights reserved.
@@ -27,6 +26,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#if 0
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -34,8 +34,8 @@
#include <pwd.h>
#include <sys/types.h>
#include <unistd.h>
+#endif
-#include "typedefs.h"
#include "utils.h"
#include "io.h"
#include "config.h"
@@ -321,6 +321,7 @@ typedef struct
time_t timestamp;
} score_t;
+#if 0
static void getname (char *name)
{
struct passwd *pw = getpwuid (geteuid ());
@@ -337,7 +338,9 @@ static void getname (char *name)
name[NAMELEN - 1] = '\0';
}
}
+#endif
+#if 0
static void err1 ()
{
fprintf (stderr,"Error creating %s\n",scorefile);
@@ -349,10 +352,11 @@ static void err2 ()
fprintf (stderr,"Error writing to %s\n",scorefile);
exit (EXIT_FAILURE);
}
+#endif
void showplayerstats (engine_t *engine)
{
- fprintf (stderr,
+ printf (
"\n\t PLAYER STATISTICS\n\n\t"
"Score %11d\n\t"
"Efficiency %11d\n\t"
@@ -360,6 +364,7 @@ void showplayerstats (engine_t *engine)
GETSCORE (engine->score),engine->status.efficiency,GETSCORE (engine->score) / getsum ());
}
+#if 0
static void createscores (int score)
{
FILE *handle;
@@ -394,7 +399,9 @@ static void createscores (int score)
fprintf (stderr,"%s",scoretitle);
fprintf (stderr,"\t 1* %7d %s\n\n",score,scores[0].name);
}
+#endif
+#if 0
static int cmpscores (const void *a,const void *b)
{
int result;
@@ -412,7 +419,9 @@ static int cmpscores (const void *a,cons
/* timestamps is equal */
return 0;
}
+#endif
+#if 0
static void savescores (int score)
{
FILE *handle;
@@ -490,11 +499,13 @@ static void savescores (int score)
}
fprintf (stderr,"\n");
}
+#endif
/***************************************************************************/
/***************************************************************************/
/***************************************************************************/
+#if 0
static void showhelp ()
{
fprintf (stderr,"USAGE: tint [-h] [-l level] [-n]\n");
@@ -504,9 +515,11 @@ static void showhelp ()
fprintf (stderr," -d Draw vertical dotted lines\n");
exit (EXIT_FAILURE);
}
+#endif
static void parse_options (int argc,char *argv[])
{
+#if 0
int i = 1;
while (i < argc)
{
@@ -536,10 +549,12 @@ static void parse_options (int argc,char
}
i++;
}
+#endif
}
static void choose_level ()
{
+#if 0
char buf[NAMELEN];
do
@@ -549,6 +564,8 @@ static void choose_level ()
buf[strlen (buf) - 1] = '\0';
}
while (!str2int (&level,buf) || level < MINLEVEL || level > MAXLEVEL);
+#endif
+ level = 1;
}
/***************************************************************************/
@@ -663,8 +680,15 @@ int main (int argc,char *argv[])
if (ch != 'q')
{
showplayerstats (&engine);
+#if 0
savescores (GETSCORE (engine.score));
+#endif
}
+ printf("Bye.\n");
+ refresh();
+ for(;;); //halt();
+#if 0
exit (EXIT_SUCCESS);
+#endif
}
diff -rupN tint-0.03b/typedefs.h tint/typedefs.h
--- tint-0.03b/typedefs.h 2001-12-07 16:49:06.000000000 +0100
+++ tint/typedefs.h 1970-01-01 01:00:00.000000000 +0100
@@ -1,68 +0,0 @@
-#ifndef TYPEDEFS_H
-#define TYPEDEFS_H
-
-/*
- * Copyright (c) Abraham vd Merwe <abz@blio.net>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the author nor the names of other contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Boolean definitions
- */
-
-#ifndef bool
-#define bool int
-#endif
-
-#if !defined(false) || (false != 0)
-#define false 0
-#endif
-
-#if !defined(true) || (true != 0)
-#define true 1
-#endif
-
-#if !defined(FALSE) || (FALSE != false)
-#define FALSE false
-#endif
-
-#if !defined(TRUE) || (TRUE != true)
-#define TRUE true
-#endif
-
-/*
- * Error flags
- */
-
-#if !defined(ERR) || (ERR != -1)
-#define ERR -1
-#endif
-
-#if !defined(OK) || (OK != 0)
-#define OK 0
-#endif
-
-#endif /* #ifndef TYPEDEFS_H */
diff -rupN tint-0.03b/utils.c tint/utils.c
--- tint-0.03b/utils.c 2001-12-07 16:49:19.000000000 +0100
+++ tint/utils.c 2016-05-27 19:05:40.313351887 +0200
@@ -27,11 +27,13 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
+
+#if 0
#include <stdlib.h>
#include <time.h>
#include <limits.h>
-
-#include "typedefs.h"
+#endif
/*
* Initialize random number generator
@@ -41,8 +43,11 @@ void rand_init ()
#ifdef USE_RAND
srand (time (NULL));
#else
+#if 0
srandom (time (NULL));
#endif
+ srandom (123);
+#endif
}
/*
@@ -61,6 +66,7 @@ int rand_value (int range)
* Convert an str to long. Returns TRUE if successful,
* FALSE otherwise.
*/
+#if 0
bool str2int (int *i,const char *str)
{
char *endptr;
@@ -69,3 +75,4 @@ bool str2int (int *i,const char *str)
return TRUE;
}
+#endif
diff -rupN tint-0.03b/utils.h tint/utils.h
--- tint-0.03b/utils.h 2001-12-07 16:49:35.000000000 +0100
+++ tint/utils.h 2016-05-27 19:00:34.120754123 +0200
@@ -29,7 +29,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "typedefs.h"
+#include <curses.h>
/*
* Initialize random number generator
|