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
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
|
diff -c -r Makefile Makefile
*** Makefile Mon Jan 24 15:09:55 1994
--- Makefile Sat Jun 24 12:22:33 1995
***************
*** 1,6 ****
VERSION = 0.99
! SUBDIRS = lib src font tools
ifeq (.config,$(wildcard .config))
include .config
--- 1,6 ----
VERSION = 0.99
! SUBDIRS = lib src font #tools
ifeq (.config,$(wildcard .config))
include .config
***************
*** 32,38 ****
do (cd $$i && echo cleaning all in $$i && $(MAKE) clean);\
done
! install: makedir instbin
@if [ -f $(LIBDIR)/$(CONFIG_NAME) ]; then\
mv $(LIBDIR)/$(CONFIG_NAME) $(LIBDIR)/$(CONFIG_NAME)'.org';\
echo $(LIBDIR)/$(CONFIG_NAME)': file exists ... renamed !!';\
--- 32,38 ----
do (cd $$i && echo cleaning all in $$i && $(MAKE) clean);\
done
! install: makedir instbin instfont
@if [ -f $(LIBDIR)/$(CONFIG_NAME) ]; then\
mv $(LIBDIR)/$(CONFIG_NAME) $(LIBDIR)/$(CONFIG_NAME)'.org';\
echo $(LIBDIR)/$(CONFIG_NAME)': file exists ... renamed !!';\
***************
*** 44,51 ****
--- 44,58 ----
@sh tools/makedir $(BINDIR)
@sh tools/makedir $(LIBDIR)
@sh tools/makedir $(MANDIR)
+ @sh tools/makedir $(FONTDIR)
instbin:
@for i in $(SUBDIRS);\
do (cd $$i && echo installing all in $$i && $(MAKE) install);\
+ done
+
+ instfont:
+ @for i in k14.bdf 7x14rk.bdf; do\
+ install -c /usr/ports/distfiles/$$i $(FONTDIR);\
+ gzip -f -9 $(FONTDIR)/$$i;\
done
diff -c -r README.FreeBSD README.FreeBSD
*** README.FreeBSD Sat Jun 24 12:41:42 1995
--- README.FreeBSD Sat Jun 24 12:22:28 1995
***************
*** 0 ****
--- 1,64 ----
+ KON for FreeBSD ver 0.1
+
+ 1995-06-04
+ ���� ��
+ <ogura@st.rim.or.jp>
+
+ �Ϥ���� kon for FreeBSD �ϡ�linux �����ܸ쥳����Ǥ��� kon-0.99.4e
+ �� kon for NetBSD(NetBSD-0.9 ���������줿�����˰ܿ����줿���)��١���
+ �˰ܿ�������ΤǤ���
+
+ ��ħ�Ȥ��ơ����������ɥ���˥ե���Ȥξ�����֤��Τ�¿���β��ۥ���
+ ���� kon ��ư���Ƥ�����¿�����Ѥ��ʤ����Ȥ�����ޤ����ޤ�����Ԥ�
+ ��ȴ���������Ϥ��㤵���饪�ꥸ�ʥ�� kon-0.99.4e ���¿���ε�ǽ���������
+ �Ƥ��ޤ����б����Ƥ��ʤ���ǽ�ˤĤ��Ƥ�����Ǥ��ʤ��Ѥˤ��Ƥ��ޤ���
+
+
+ ���ȡ���λ���
+
+ 1.1 �����ͥ�˥��������ɥ�������ꤹ�롣/usr/src/sys/i386/conf/GENERIC
+ �ե������"options SYSVSHM"�ιԤ��ɲø塢
+ config GENERIC;cd ../../compile/GENERIC
+ make depend;make all;cp kernel /
+ �ʤɤ�¹Ԥ��ƥ�֡��Ȥ��Ƥ���������
+
+ 1.2 ���Υǥ��쥯�ȥ�� make config ��¹Ԥ��Ƥ���������VGA ��ɬ��[y]��
+ ���Ƥ����������ե���Ȥ�����Ϥɤ줫��Ĥ�ɬ��[y]�ˤ��Ƥ���������
+
+ 1.3 .config �ե������¹ԥ⥸�塼��ȡ��뤹��ǥ��쥯�ȥ�䡢
+ kon.cfg / man �ե�����γ�Ǽ��ʤɤ��ѹ����Ƥ����������ǥե���Ȥ�
+ �ϰʲ����ѤˤʤäƤ��ޤ���
+ /usr/local/bin �¹ԥ⥸�塼���Ǽ��
+ /usr/local/etc kon.cfg �ե������Ǽ��
+ /usr/local/man/ja_JP.ujis/man1 man �ե������Ǽ��
+
+ 1.4 kon.cfg �ե������ե���Ȥˤ��碌���ѹ����Ƥ���������������ˡ��
+ �ɤ� doc �ʲ��Υե�����ͤˤ��Ƥ������������Ѥ���ե���Ȥ�
+ �ǥե���ȤǤ� linux �����ܸ�ѥå������Ǥ��� JE �� publicfont
+ �� k14 �� ank �ե���Ȥ� gzip ������ /usr/share/fonts �ʲ��˳�Ǽ
+ ����褦�ˤʤäƤ��ޤ���
+
+ 1.5 make;make install ��¹Ԥ��Ƥ���������
+
+
+ �ȥ�֥륷�塼�ƥ���
+
+ kon �����ޤ���ư���ʤ����ˤϡ����������ɥ��꤬���ѤǤ��뤫��
+ ǧ���Ƥ��������� �ޤ������̤����ðŤǤ�ۤȤ�ɤξ��ϥϤ�
+ �Ƥ��ޤ���"exit" �� "CTRL+D"��"CTRL+C" �ʤɤ� kon ��λ����
+ "vidcontrol VGA_80x30"��¹Ԥ��Ƹ��Ƥ����������ޤ���XFree86-3.1
+ �Ȥۤ�Ʊ����ˡ�ǥ�������ʸ����ɽ�����Ƥ���Τǣؤ����ѤǤ�
+ �뤳�Ȥ��ǧ���ƤߤƤ���������
+
+
+ �ܥ��եȥ�����(kon for FreeBSD)�ϥե���եȥ������Ǥ��ꡢ�ѹ������ۤ�
+ ��ͳ�˹ԤäƤ��������Ʒ빽�Ǥ����������Х��䴶�ۤʤɤ�䰸�˥��Ǥ⤷
+ �Ƥ���������й����Ǥ���
+ �ޤ���kon for FreeBSD ��Ȥäƥϡ��ɥ�������¾�Υ��եȥ����������꤬ȯ��
+ ���Ƥ���Ǥ��Ȥ뤳�ȤϤǤ��ޤ���
+
+ �Ǹ�ˡ�kon �κ�ԤǤ��뿿�餵��<manabe@papilio.tutics.tut.ac.jp>��
+ kon for NetBSD �κ�ԤǤ��뱭������<ukai@hplj.hpl.hp.com>���ƥ��Ȥ˶��Ϥ�
+ �Ƥ������ä����͡����꤬�Ȥ��������ޤ�����
+
+ ���� ��<ogura@st.rim.or.jp>
diff -c -r config.in config.in
*** config.in Sun May 8 17:50:41 1994
--- config.in Sat Jun 24 12:22:28 1995
***************
*** 1,14 ****
Support VGA driver
HAS_VGA y
- Support J31SX driver
- HAS_J31SX y
- Support MOUSE driver
- HAS_MOUSE y
Install Minix/V font loader
FLD_MINIX y
- Install $fontx2 font loader
- FLD_BDF y
Install .bdf font loader
! FLD_FONTX2 y
! Install J3100ROM font loader
! FLD_J31ROM y
--- 1,6 ----
Support VGA driver
HAS_VGA y
Install Minix/V font loader
FLD_MINIX y
Install .bdf font loader
! FLD_BDF y
diff -c -r font/Makefile font/Makefile
*** font/Makefile Mon May 9 23:43:13 1994
--- font/Makefile Sat Jun 24 12:22:28 1995
***************
*** 1,4 ****
! OBJ = fld.o minix.o fontx2.o bdf.o j3100.o
ifeq (../.config,$(wildcard ../.config))
include ../.config
--- 1,4 ----
! OBJ = fld.o minix.o fontx2.o bdf.o # j3100.o
ifeq (../.config,$(wildcard ../.config))
include ../.config
diff -c -r font/fld.c font/fld.c
*** font/fld.c Wed May 11 14:29:35 1994
--- font/fld.c Sat Jun 24 12:22:28 1995
***************
*** 37,43 ****
--- 37,45 ----
u_char *FontLoadMinix();
u_char *FontLoadFontx();
u_char *FontLoadBdf();
+ #if defined(linux)
u_char *FontLoadJ3100();
+ #endif
static struct {
char *type;
***************
*** 56,62 ****
--- 58,68 ----
int shmid;
struct shmid_ds shmseg;
+ #if defined(linux)
shmkey = ftok(CONFIG_NAME, fnum);
+ #elif defined(__FreeBSD__)
+ shmkey = 5000 + (fnum & 0x7F);
+ #endif
if ((shmid = shmget(shmkey, sizeof(struct fontInfo), 0444)) < 0)
return;
shmctl(shmid, IPC_STAT, &shmseg);
***************
*** 71,77 ****
--- 77,87 ----
extern int forceLoad;
if (forceLoad) return(EOF);
+ #if defined(linux)
shmkey = ftok(SHMEM_NAME, fnum);
+ #elif defined(__FreeBSD__)
+ shmkey = 5000 + (fnum & 0x7F);
+ #endif
if (shmget(shmkey, 1, 0444) == EOF) return(EOF);
return(0);
}
***************
*** 82,89 ****
key_t shmkey;
int shmid;
u_char *shmbuff;
!
shmkey = ftok(SHMEM_NAME, fi->type);
shmid = shmget(shmkey, fi->size+sizeof(struct fontInfo),
IPC_CREAT|0666);
shmbuff = shmat(shmid, 0, 0);
--- 92,103 ----
key_t shmkey;
int shmid;
u_char *shmbuff;
!
! #if defined(linux)
shmkey = ftok(SHMEM_NAME, fi->type);
+ #elif defined(__FreeBSD__)
+ shmkey = 5000 + (fi->type & 0x0000007F);
+ #endif
shmid = shmget(shmkey, fi->size+sizeof(struct fontInfo),
IPC_CREAT|0666);
shmbuff = shmat(shmid, 0, 0);
***************
*** 120,126 ****
--- 134,144 ----
int shmid;
struct fontInfo *fi;
+ #if defined(linux)
shmkey = ftok(CONFIG_NAME, fnum);
+ #elif defined(__FreeBSD__)
+ shmkey = 5000 + (fnum & 0x7F);
+ #endif
if ((shmid = shmget(shmkey, sizeof(struct fontInfo), 0444)) < 0)
return(0);
fi = (struct fontInfo*)shmat(shmid, 0, SHM_RDONLY);
***************
*** 223,232 ****
argv[0], type);
exit(EOF);
}
if (!fontLoaders[i].loader)
font = FontLoadJ3100(argc, argv);
else
! font = fontLoaders[i].loader(fp);
if (font == NULL) {
fprintf(stderr, "%s> Can not load font.\n", argv[0]);
exit(EOF);
--- 241,252 ----
argv[0], type);
exit(EOF);
}
+ #if defined(linux)
if (!fontLoaders[i].loader)
font = FontLoadJ3100(argc, argv);
else
! #endif
! font = fontLoaders[i].loader(fp);
if (font == NULL) {
fprintf(stderr, "%s> Can not load font.\n", argv[0]);
exit(EOF);
diff -c -r include/config.h include/config.h
*** include/config.h Sat Jun 24 12:41:57 1995
--- include/config.h Sat Jun 24 12:34:57 1995
***************
*** 0 ****
--- 1,39 ----
+
+ /*
+ KON - Kanji ON Linux Console -
+ Copyright (C) 1992, 1993
+ MAEDA Atusi (mad@math.keio.ac.jp)
+ Takashi MANABE (manabe@tut.ac.jp)
+
+ KON 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 2 of the License, or
+ (at your option) any later version.
+
+ KON 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, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+ /*
+ NOTE: This is automatically generated config.
+ >>>>>>>>>>>>>> DO NOT EDIT !! <<<<<<<<<<<<<<
+ */
+
+ #ifndef CONFIG_H
+ #define CONFIG_H
+
+
+ /* Support VGA driver */
+ #define HAS_VGA
+
+ /* Install Minix/V font loader */
+
+ /* Install .bdf font loader */
+ #define FLD_BDF
+ #endif
diff -c -r include/defs.h include/defs.h
*** include/defs.h Tue Mar 9 00:29:44 1993
--- include/defs.h Sat Jun 24 12:22:28 1995
***************
*** 22,27 ****
--- 22,29 ----
#ifndef DEFS_H
#define DEFS_H
+ #undef FALSE
+ #undef TRUE
typedef enum {FALSE, TRUE} bool;
#define FAILURE (-1)
diff -c -r include/version.h include/version.h
*** include/version.h Thu Jul 7 23:19:16 1994
--- include/version.h Sat Jun 24 12:22:28 1995
***************
*** 1 ****
! #define VERSION "ver.0.99.4e (07/07)"
--- 1 ----
! #define VERSION "ver.0.1 (06/04)"
diff -c -r include/vga.h include/vga.h
*** include/vga.h Mon Jul 4 14:43:29 1994
--- include/vga.h Sat Jun 24 12:22:29 1995
***************
*** 48,54 ****
--- 48,58 ----
#define VGAATTR_CNT 21
#define EGAATTR_CNT 20
+ #if defined(linux)
#define GRAPH_BASE 0xA0000
+ #elif defined(__FreeBSD__)
+ #define GRAPH_BASE 0x0
+ #endif
#define FONT_SIZE 0x2000
#define VGA_FONT_SIZE 128
diff -c -r kon.cfg kon.cfg
*** kon.cfg Mon May 9 22:11:28 1994
--- kon.cfg Sat Jun 24 12:37:32 1995
***************
*** 55,61 ****
VGA
640 680 776 808 480 491 493 524
1
! 79 29
# Pels: Pallette value definition for VGA, VGAFM drivers
--- 55,61 ----
VGA
640 680 776 808 480 491 493 524
1
! 79 23
# Pels: Pallette value definition for VGA, VGAFM drivers
***************
*** 114,119 ****
--- 114,122 ----
63 63 63
# Startup command definition (usually font loading commands are specified)
+ bdf-zcat:Startup
+ gzip -cd /usr/local/fonts/k14.bdf.gz | /usr/local/bin/fld -t bdf -n
+ gzip -cd /usr/local/fonts/7x14rk.bdf.gz | /usr/local/bin/fld -t bdf -n
minix:
/usr/bin/fld.minix -n /usr/share/fonts/publicfont.ank
/usr/bin/fld.minix -n /usr/share/fonts/publicfont.k14
***************
*** 126,136 ****
fontx-zcat:
zcat /dos/lib/font/jpnhn16x.Z | /usr/bin/fld.fontx -n
zcat /dos/lib/font/jpnzn16x.Z | /usr/bin/fld.fontx -n
! minix-gzip:Startup
! /usr/bin/fld -t fontx -n /usr/share/fonts/vga.fnt
! gzip -d < /usr/share/fonts/pubfont.k.gz | /usr/bin/fld -t minix -n
! # gzip -d < /usr/share/fonts/vga.fnt.gz | /usr/bin/fld.fontx -n
! # gzip -d < /usr/share/fonts/pubfont.a.gz | /usr/bin/fld.minix -n
fontx-gzip:
gzip -d < /dos/lib/font/jpnhn16x.z | /usr/bin/fld.fontx -n
gzip -d < /dos/lib/font/jpnzn16x.z | /usr/bin/fld.fontx -n
--- 129,137 ----
fontx-zcat:
zcat /dos/lib/font/jpnhn16x.Z | /usr/bin/fld.fontx -n
zcat /dos/lib/font/jpnzn16x.Z | /usr/bin/fld.fontx -n
! minix-gzip:
! gzip -cd /usr/share/fonts/publicfont.k14.gz | /usr/local/bin/fld -t minix -n
! gzip -cd /usr/share/fonts/publicfont.ank.gz | /usr/local/bin/fld -t minix -n
fontx-gzip:
gzip -d < /dos/lib/font/jpnhn16x.z | /usr/bin/fld.fontx -n
gzip -d < /dos/lib/font/jpnzn16x.z | /usr/bin/fld.fontx -n
diff -c -r lib/Makefile lib/Makefile
*** lib/Makefile Tue May 3 17:07:13 1994
--- lib/Makefile Sat Jun 24 12:22:29 1995
***************
*** 8,14 ****
all: $(LIB)
$(LIB): $(OBJ)
! $(AR) rcs $(LIB) $(OBJ)
depend .depend:
$(CC) $(CFLAGS) -M *.c > .depend
--- 8,15 ----
all: $(LIB)
$(LIB): $(OBJ)
! $(AR) rc $(LIB) $(OBJ)
! ranlib $(LIB)
depend .depend:
$(CC) $(CFLAGS) -M *.c > .depend
diff -c -r lib/font.c lib/font.c
*** lib/font.c Wed May 11 14:30:09 1994
--- lib/font.c Sat Jun 24 12:22:29 1995
***************
*** 36,42 ****
--- 36,46 ----
int shmid;
struct shmid_ds shmseg;
+ #if defined(linux)
shmkey = ftok(CONFIG_NAME, fnum);
+ #elif defined(__FreeBSD__)
+ shmkey = 5000 + (fnum & 0x7F);
+ #endif
if ((shmid = shmget(shmkey, sizeof(struct fontInfo), 0444)) < 0)
return;
shmctl(shmid, IPC_STAT, &shmseg);
***************
*** 51,57 ****
--- 55,65 ----
key_t shmkey;
int shmid;
+ #if defined(linux)
shmkey = ftok(CONFIG_NAME, fnum);
+ #elif defined(__FreeBSD__)
+ shmkey = 5000 + (fnum & 0x7F);
+ #endif
if ((shmid = shmget(shmkey, sizeof(struct fontInfo), 0444)) < 0) return(0);
return((u_char*)shmat(shmid, 0, SHM_RDONLY));
}
diff -c -r lib/sockface.c lib/sockface.c
*** lib/sockface.c Mon Mar 15 00:01:34 1993
--- lib/sockface.c Sat Jun 24 12:22:29 1995
***************
*** 26,32 ****
--- 26,34 ----
#include <sys/file.h>
#include <sys/types.h>
#include <sys/socket.h>
+ #ifdef linux
#include <sys/vt.h>
+ #endif
#include <sys/ioctl.h>
#include <interface.h>
***************
*** 43,49 ****
void SocketKill(int sfd)
{
close(sfd);
! /* unlink(socketName);*/
}
int SocketRecCommand(int fd, struct messageHeader *mh)
--- 45,51 ----
void SocketKill(int sfd)
{
close(sfd);
! unlink("/tmp/.kon");
}
int SocketRecCommand(int fd, struct messageHeader *mh)
***************
*** 62,75 ****
--- 64,83 ----
int SocketSearchName(struct sockaddr *sa, int fd)
{
+ #ifdef linux
struct vt_stat vs;
+ #endif
bzero(sa, sizeof(struct sockaddr));
sa->sa_family = AF_UNIX;
+ #if defined(linux)
if (ioctl(fd, VT_GETSTATE, &vs) < 0) {
return EOF;
}
sprintf(sa->sa_data, "%s%d", SOCKET_BASENAME, vs.v_active);
+ #elif defined(__FreeBSD__)
+ sprintf(sa->sa_data, "%s", SOCKET_BASENAME);
+ #endif
return(0);
}
***************
*** 83,89 ****
--- 91,101 ----
SocketSearchName(&sa, fd);
s = socket(AF_UNIX, SOCK_STREAM, 0);
+ #if defined(linux)
len = sizeof(sa.sa_family) + strlen(sa.sa_data);
+ #elif defined(__FreeBSD__)
+ len = sizeof(sa.sa_family) + strlen(sa.sa_data) + 1;
+ #endif
if (connect(s, &sa, len) == -1) s = EOF;
return(s);
}
diff -c -r src/Makefile src/Makefile
*** src/Makefile Sat May 14 16:52:34 1994
--- src/Makefile Sat Jun 24 12:22:29 1995
***************
*** 28,33 ****
--- 28,36 ----
clean:
$(RM) -f *.o $(KON) *~ .depend
+ @for i in $(SUBDIRS);\
+ do (cd $$i && echo cleaning in $$i && $(MAKE) clean) || exit;\
+ done
install: $(KON)
$(INSTALL) -m 4755 $(KON) $(BINDIR)
diff -c -r src/child.c src/child.c
*** src/child.c Thu May 12 19:48:36 1994
--- src/child.c Sat Jun 24 12:22:30 1995
***************
*** 20,25 ****
--- 20,28 ----
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+ #ifdef __FreeBSD__
+ #include <errno.h>
+ #endif
#include <getcap.h>
***************
*** 81,99 ****
RunStartupCmd();
sprintf(buff, "TERMCAP=:co#%d:li#%d:tc=console:",
dInfo.txmax + 1, dInfo.tymax + 1);
tcap = strdup(buff);
putenv(tcap);
if (startupMessage) {
! printf("\rKON " VERSION ", Copyright (C) 1993, 1994 Takashi MANABE and MAEDA Atusi\r\n"
"KON comes with \x1b[4mABSOLUTELY NO WARRANTY\x1b[m.\r\n"
"KON is free software, and you are welcome to redistribute it\r\n"
"KON under certain conditions; show COPYING for details.\r\n");
}
printf("KON using VT number %c.\n\n",
*(ttyname(fileno(errfp))+8));
fflush(stdout);
if (execProg)
--- 84,113 ----
RunStartupCmd();
+ #if defined(linux)
sprintf(buff, "TERMCAP=:co#%d:li#%d:tc=console:",
dInfo.txmax + 1, dInfo.tymax + 1);
+ #elif defined(__FreeBSD__)
+ sprintf(buff,"TERM=vt100");
+ #endif
tcap = strdup(buff);
putenv(tcap);
if (startupMessage) {
! printf("\rKON for Linux 0.99.4e, Copyright (C) 1993, 1994 Takashi MANABE and MAEDA Atusi\r\n"
"KON comes with \x1b[4mABSOLUTELY NO WARRANTY\x1b[m.\r\n"
"KON is free software, and you are welcome to redistribute it\r\n"
"KON under certain conditions; show COPYING for details.\r\n");
+ #if defined(__FreeBSD__)
+ printf("\rKON for FreeBSD-2.x ver0.01 Takashi OGURA\r\n");
+ #endif
}
printf("KON using VT number %c.\n\n",
+ #if defined(linux)
*(ttyname(fileno(errfp))+8));
+ #elif defined(__FreeBSD__)
+ *(ttyname(fileno(errfp))+9));
+ #endif
fflush(stdout);
if (execProg)
diff -c -r src/display/Makefile src/display/Makefile
*** src/display/Makefile Mon Jul 4 14:46:12 1994
--- src/display/Makefile Sat Jun 24 12:22:30 1995
***************
*** 18,24 ****
all: $(DISP)
$(DISP): $(OBJS)
! $(AR) rcs $(DISP) $(OBJS)
depend .depend:
$(CC) $(CFLAGS) -M *.c > .depend
--- 18,25 ----
all: $(DISP)
$(DISP): $(OBJS)
! $(AR) rc $(DISP) $(OBJS)
! ranlib $(DISP)
depend .depend:
$(CC) $(CFLAGS) -M *.c > .depend
diff -c -r src/display/svga.c src/display/svga.c
*** src/display/svga.c Mon Jul 4 14:39:28 1994
--- src/display/svga.c Sat Jun 24 12:22:30 1995
***************
*** 33,40 ****
--- 33,42 ----
#include <string.h>
#include <unistd.h>
#include <sys/mman.h>
+ #if defined(linux)
#include <linux/mm.h>
#include <sys/kd.h>
+ #endif
#undef free
#include <stdlib.h>
diff -c -r src/display/vga.c src/display/vga.c
*** src/display/vga.c Mon Jul 4 14:47:22 1994
--- src/display/vga.c Sat Jun 24 12:22:30 1995
***************
*** 33,40 ****
--- 33,47 ----
#include <string.h>
#include <unistd.h>
#include <sys/mman.h>
+ #if defined(linux)
#include <linux/mm.h>
#include <sys/kd.h>
+ #elif defined(__FreeBSD__)
+ #include <vm/vm_param.h>
+ #include <sys/ioctl.h>
+ #include <machine/console.h>
+ vm_size_t page_size;
+ #endif
#undef free
#include <stdlib.h>
***************
*** 567,572 ****
--- 574,580 ----
{
int devMem;
+ #if defined(linux)
ioperm(VGAMISC_IN, 1, 1);
if (!(PortInb(VGAMISC_IN)&0x01)) { /* monochrome VGA */
vgaCrtAddr = 0x3B4;
***************
*** 594,599 ****
--- 602,621 ----
Perror("/dev/mem");
return FAILURE;
}
+ #elif defined(__FreeBSD__)
+ if (ioctl(0, KDENABIO,0) < 0) {
+ Perror("ioctl CONSOLE_IO_ENABLE");
+ return FAILURE;
+ }
+ if (ioctl(0, KDSETMODE,KD_GRAPHICS) < 0) {
+ Perror("ioctl CONSOLE_IO_ENABLE");
+ return FAILURE;
+ }
+ if ((devMem = open("/dev/vga", O_RDWR|O_NDELAY) ) < 0) {
+ Perror("/dev/mem");
+ return FAILURE;
+ }
+ #endif
if ((gramMem = valloc(dInfo.gsize)) == NULL ||
(fontBuff1 = malloc(FONT_SIZE)) == NULL ||
(savePlane3 && (fontBuff2 = malloc(FONT_SIZE)) == NULL)) {
***************
*** 604,613 ****
--- 626,642 ----
(caddr_t)gramMem,
dInfo.gsize,
PROT_READ|PROT_WRITE,
+ #if defined(linux)
MAP_SHARED|MAP_FIXED,
+ #elif defined(__FreeBSD__)
+ MAP_FILE|MAP_SHARED|MAP_FIXED,
+ #endif
devMem,
GRAPH_BASE
);
+ #if defined(__FreeBSD__)
+ ioctl(devMem, TIOCFLUSH);
+ #endif
close(devMem);
if ((long)gramMem < 0) {
Perror("mmap");
***************
*** 620,625 ****
--- 649,655 ----
void VgaDetach(void)
{
gramHead = 0;
+ #if defined(linux)
ioperm(vgaCrtAddr, 1, 0);
ioperm(VGAATTR_A_O, 1, 0);
ioperm(VGAGRP_ADDR, 1, 0);
***************
*** 634,640 ****
ioperm(VGAMISC_OUT, 1, 0);
ioperm(vgaSt1Addr, 1, 0);
ioperm(VGAPAL_DATA, 1, 0);
!
munmap(gramMem, dInfo.gsize);
SafeFree((void **)&gramMem);
--- 664,671 ----
ioperm(VGAMISC_OUT, 1, 0);
ioperm(vgaSt1Addr, 1, 0);
ioperm(VGAPAL_DATA, 1, 0);
! #endif
!
munmap(gramMem, dInfo.gsize);
SafeFree((void **)&gramMem);
diff -c -r src/main.c src/main.c
*** src/main.c Sun May 15 23:21:17 1994
--- src/main.c Sat Jun 24 12:22:30 1995
***************
*** 31,41 ****
--- 31,46 ----
{
char *p;
+ #if defined(linux)
fprintf(stderr, "Kanji ON Linux console " VERSION "\n\n");
+ #elif defined(__FreeBSD__)
+ fprintf(stderr, "Kanji ON FreeBSD console " VERSION "\n\n");
+ #endif
if (geteuid() != 0) {
fprintf(stderr, "can not get I/O permissions.\n");
exit(EXIT_FAILURE);
}
+
ChangeNewConsole();
TermInit(argc - 1, argv + 1);
if (ReadConfig(CONFIG_NAME) < 0) {
diff -c -r src/sock.c src/sock.c
*** src/sock.c Thu May 12 13:35:44 1994
--- src/sock.c Sat Jun 24 12:22:30 1995
***************
*** 68,81 ****
{
int len, sfd;
struct sockaddr sinfo;
!
sprintf(sinfo.sa_data, "/tmp/.kon%s", tty);
unlink(sinfo.sa_data);
if ((sfd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
PerrorExit(sinfo.sa_data);
}
sinfo.sa_family = AF_UNIX;
len = sizeof(sinfo.sa_family) + strlen(sinfo.sa_data);
if (bind(sfd, &sinfo, len) < 0) {
message("can't bind socket");
PerrorExit(sinfo.sa_data);
--- 68,89 ----
{
int len, sfd;
struct sockaddr sinfo;
!
! #if defined(linux)
sprintf(sinfo.sa_data, "/tmp/.kon%s", tty);
+ #elif defined(__FreeBSD__)
+ sprintf(sinfo.sa_data, "/tmp/.kon");
+ #endif
unlink(sinfo.sa_data);
if ((sfd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
PerrorExit(sinfo.sa_data);
}
sinfo.sa_family = AF_UNIX;
+ #if defined(linux)
len = sizeof(sinfo.sa_family) + strlen(sinfo.sa_data);
+ #elif defined(__FreeBSD__)
+ len = sizeof(sinfo.sa_family) + strlen(sinfo.sa_data) + 1;
+ #endif
if (bind(sfd, &sinfo, len) < 0) {
message("can't bind socket");
PerrorExit(sinfo.sa_data);
diff -c -r src/term.c src/term.c
*** src/term.c Tue May 17 19:39:31 1994
--- src/term.c Sat Jun 24 12:22:30 1995
***************
*** 22,32 ****
--- 22,40 ----
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
+ #if defined(linux)
#include <termio.h>
+ #elif defined(__FreeBSD__)
+ #include <termios.h>
+ #include <machine/console.h>
+ #define termio termios
+ #endif
#include <signal.h>
#include <errno.h>
+ #if defined(linux)
#include <sys/vt.h>
#include <sys/kd.h>
+ #endif
#include <sys/time.h>
#include <sys/ioctl.h>
#include <sys/file.h>
***************
*** 46,51 ****
--- 54,66 ----
#include <sock.h>
#include <mouse.h>
+ #ifdef __FreeBSD__
+ #define TCSETA TIOCSETA
+ #define TCGETA TIOCGETA
+ #define SIGCLD SIGCHLD
+ #define XCASE 0
+ #endif
+
int masterPty; /* master pseudo-tty file descriptor */
#define MAX_TTYNAME 10
***************
*** 92,98 ****
static void ExitPty(int signum)
{
int stat;
!
if (wait3(&stat, WNOHANG, 0) != childPid) {
TextMode();
kill(0, SIGTSTP);
--- 107,116 ----
static void ExitPty(int signum)
{
int stat;
!
! #if defined(__FreeBSD__)
! signal(SIGCLD, SIG_DFL);
! #endif
if (wait3(&stat, WNOHANG, 0) != childPid) {
TextMode();
kill(0, SIGTSTP);
***************
*** 322,328 ****
--- 340,350 ----
}
chown("/dev/tty0", getuid(), getgid());
+ #if defined(linux)
sockFd = SocketInit(ttyname(0) + 8);
+ #elif defined(__FreeBSD__)
+ sockFd = SocketInit(ttyname(0) + 9);
+ #endif
init.socket = TRUE;
/* Get old tio of 0 */
***************
*** 353,360 ****
--- 375,394 ----
newTio.c_oflag &= ~OPOST;
newTio.c_cc[VMIN] = 1;
newTio.c_cc[VTIME] = 0;
+ #if defined(__FreeBSD__)
+ newTio.c_cc[VDISCARD] = _POSIX_VDISABLE;
+ newTio.c_cc[VLNEXT] = _POSIX_VDISABLE;
+ newTio.c_cc[VSTART] = _POSIX_VDISABLE;
+ newTio.c_cc[VSTOP] = _POSIX_VDISABLE;
+ newTio.c_cc[VINTR] = _POSIX_VDISABLE;
+ newTio.c_cc[VSUSP] = _POSIX_VDISABLE;
+ newTio.c_cc[VDSUSP] = _POSIX_VDISABLE;
+ newTio.c_cc[VQUIT] = _POSIX_VDISABLE;
+ #endif
newTio.c_cflag |= CS8;
+ #ifdef linux
newTio.c_line = 0;
+ #endif
ioctl(0, TCSETA, &newTio);
/* VGA initialize */
VtStart();
***************
*** 371,376 ****
--- 405,419 ----
/* I'm child */
/* Make me process leader */
setsid();
+ #if defined(__FreeBSD__)
+ {
+ int devtty;
+ if ((devtty = open("/dev/tty",O_RDWR|O_NDELAY)) >= 0) {
+ ioctl(devtty, TIOCNOTTY, (char *)0);
+ close(devtty);
+ }
+ }
+ #endif
/* Open TTY(slave) */
if ((slavePty = open(ptyName, O_RDWR)) < 0) {
PerrorExit(ptyName);
***************
*** 378,383 ****
--- 421,429 ----
close(masterPty);
/* Set old tio to TTY */
ioctl(slavePty, TCSETA, &oldTio);
+ #ifdef __FreeBSD__
+ ioctl(slavePty, TIOCSCTTY, (char *)0);
+ #endif
/* Set std??? to pty */
dup2(slavePty, 0);
dup2(slavePty, 1);
***************
*** 390,396 ****
--- 436,446 ----
{
int cfd;
+ #if defined(linux)
if ((cfd = open("/dev/console", 0)) < 0) {
+ #elif defined(__FreeBSD__)
+ if ((cfd = open("/dev/vga", 0)) < 0) {
+ #endif
PerrorExit("/dev/console");
}
ioctl(cfd, VT_ACTIVATE, orgVtNum);
***************
*** 399,417 ****
--- 449,475 ----
void ChangeNewConsole()
{
+ #if defined(linux)
struct vt_stat vts;
+ #endif
int cfd, vfd, vtNum, child, parent, mode;
char vtty[MAX_TTYNAME + 1];
+ #if defined(linux)
if ((cfd = open("/dev/console", 0)) < 0)
+ #elif defined(__FreeBSD__)
+ if ((cfd = open("/dev/vga", 0)) < 0)
+ #endif
fatal("can't open /dev/console");
ioctl(cfd, KDGETMODE, &mode);
if (mode == KD_TEXT) {
close(cfd);
return;
}
+ #if defined(linux)
ioctl(cfd, VT_GETSTATE, &vts);
orgVtNum = vts.v_active;
+ #endif
ioctl(cfd, VT_OPENQRY, &vtNum);
if (vtNum < 0)
fatal("can't get free VC");
***************
*** 423,429 ****
--- 481,491 ----
pause();
}
setsid();
+ #if defined(linux)
sprintf(vtty, "/dev/tty%d", vtNum);
+ #elif defined(__FreeBSD__)
+ sprintf(vtty, "/dev/ttyv%d", vtNum);
+ #endif
if ((vfd = open(vtty, O_RDWR)) < 0)
fatal("can't open %s", vtty);
if (ioctl(cfd, VT_ACTIVATE, vtNum) != 0)
diff -c -r src/utmp.c src/utmp.c
*** src/utmp.c Wed Sep 22 20:31:12 1993
--- src/utmp.c Sat Jun 24 12:22:31 1995
***************
*** 38,43 ****
--- 38,44 ----
void SetUtmp(char *tty)
{
+ #ifdef linux
struct utmp utmp;
struct passwd *pw;
struct group *ttygrp;
***************
*** 63,72 ****
--- 64,75 ----
ttyGid = -1;
chmod(tty, 0622);
chown(tty, getuid(), ttyGid);
+ #endif
}
void ResetUtmp(char *tty)
{
+ #ifdef linux
struct utmp utmp, *utp;
char *tn;
***************
*** 84,87 ****
--- 87,91 ----
endutent();
chmod(tty, 0600);
chown(tty, 0, ttyGid);
+ #endif
}
diff -c -r src/vc.c src/vc.c
*** src/vc.c Mon May 23 23:33:25 1994
--- src/vc.c Sat Jun 24 12:22:31 1995
***************
*** 24,35 ****
--- 24,44 ----
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+ #if defined(linux)
#include <sys/vt.h>
+ #endif
#include <fcntl.h>
#include <signal.h>
+ #if defined(linux)
#include <termio.h>
+ #elif defined(__FreeBSD__)
+ #include <termios.h>
+ #include <machine/console.h>
+ #endif
#include <sys/ioctl.h>
+ #ifdef linux
#include <sys/kd.h>
+ #endif
#include <mem.h>
#include <getcap.h>
***************
*** 257,263 ****
vtm.relsig = 0;
vtm.acqsig = 0;
ioctl(0, VT_SETMODE, &vtm);
!
con.text_mode = TRUE;
SetTextMode();
ioctl(masterPty, TIOCSWINSZ, &text_win);
--- 266,274 ----
vtm.relsig = 0;
vtm.acqsig = 0;
ioctl(0, VT_SETMODE, &vtm);
! #if defined(__FreeBSD__)
! ioctl(0, VT_RELDISP, 1);
! #endif
con.text_mode = TRUE;
SetTextMode();
ioctl(masterPty, TIOCSWINSZ, &text_win);
***************
*** 270,275 ****
--- 281,289 ----
con.text_mode = FALSE;
ioctl(0, KDSETMODE, KD_GRAPHICS);
+ #if defined(__FreeBSD__)
+ ioctl(0, VT_RELDISP, VT_ACKACQ);
+ #endif
signal(SIGUSR1, LeaveVC);
signal(SIGUSR2, EnterVC);
vtm.mode = VT_PROCESS;
***************
*** 295,303 ****
static
void LeaveVC(int signum)
{
signal(SIGUSR1, LeaveVC); /* should use sigaction()? */
if (busy) {
! release = TRUE;
return;
}
release = FALSE;
--- 309,318 ----
static
void LeaveVC(int signum)
{
+
signal(SIGUSR1, LeaveVC); /* should use sigaction()? */
if (busy) {
! release = TRUE;
return;
}
release = FALSE;
***************
*** 319,324 ****
--- 334,340 ----
if (!con.active) {
con.active = TRUE;
GraphMode();
+ signal(SIGUSR2, EnterVC);
#ifdef HAS_MOUSE
if (mInfo.has_mouse) {
MouseStart();
***************
*** 794,809 ****
--- 810,829 ----
static int ConfigBeep(const char *confstr)
{
beepCount = atoi(confstr) * 10000;
+ #if defined(linux)
ioperm(COUNTER_ADDR, 1, TRUE);
+ #endif
return SUCCESS;
}
void Beep(void)
{
if (!con.active) return;
+ #ifdef linux
PortOutb(PortInb(COUNTER_ADDR)|3, COUNTER_ADDR);
usleep(beepCount);
PortOutb(PortInb(COUNTER_ADDR)&0xFC, COUNTER_ADDR);
+ #endif
}
static int ConfigInterval(const char *confstr)
***************
*** 852,858 ****
--- 872,880 ----
SafeFree((void **)&textBuff);
SafeFree((void **)&attrBuff);
SafeFree((void **)&flagBuff);
+ #ifdef linux
ioperm(COUNTER_ADDR, 1, FALSE);
+ #endif
SafeFree((void **)&videoName);
}
diff -c -r src/vt.c src/vt.c
*** src/vt.c Sat Jun 11 16:48:44 1994
--- src/vt.c Sat Jun 24 12:22:31 1995
***************
*** 21,27 ****
--- 21,31 ----
#include <stdio.h>
#include <unistd.h>
#include <string.h>
+ #if defined(linux)
#include <termio.h>
+ #elif defined(__FreeBSD__)
+ #include <termios.h>
+ #endif
#include <malloc.h>
#include <sys/types.h>
diff -c -r tools/Configure tools/Configure
*** tools/Configure Sat Mar 26 19:10:24 1994
--- tools/Configure Sat Jun 24 12:22:31 1995
***************
*** 50,70 ****
cat << 'END' >> $CONFIG_MK
! TOPDIR =
! BINDIR = $(TOPDIR)/usr/bin
LIBDIR = $(TOPDIR)/etc
! MANDIR = $(TOPDIR)/usr/man/ja_JP.ujis/man1
CONFIG_NAME = kon.cfg
OPTS = -DCONFIG_NAME=\"$(LIBDIR)/$(CONFIG_NAME)\" -I$(INCDIR)
CFLAGS = -O -Wall $(OPTS)
LD = gcc $(CFLAGS)
RM = rm -f
INSTALL = install -c -s
! SUBDIRS = lib src font tools
END
! echo "KON Kanji ON Linux console"
while read mess
do
--- 50,70 ----
cat << 'END' >> $CONFIG_MK
! TOPDIR = /usr/local
! BINDIR = $(TOPDIR)/bin
LIBDIR = $(TOPDIR)/etc
! MANDIR = $(TOPDIR)/man/ja_JP.ujis/man1
CONFIG_NAME = kon.cfg
OPTS = -DCONFIG_NAME=\"$(LIBDIR)/$(CONFIG_NAME)\" -I$(INCDIR)
CFLAGS = -O -Wall $(OPTS)
LD = gcc $(CFLAGS)
RM = rm -f
INSTALL = install -c -s
! SUBDIRS = lib src font # tools
END
! echo "KON Kanji ON FreeBSD console"
while read mess
do
diff -c -r tools/makedir tools/makedir
*** tools/makedir Tue Mar 23 08:44:32 1993
--- tools/makedir Sat Jun 24 12:36:23 1995
***************
*** 7,21 ****
echo 'ok'
else
echo ' not exist'
- echo -n 'make' "'$1'" '? '
- read yn
- if [ "$yn" = "n" -o "$yn" = "N" ]
- then
- exit 1
- fi
mkdir -p $1
- if [ $? != 0 ]
- then
- exit 1
- fi
fi
--- 7,11 ----
|