--- kon2-0.3.9b.orig/.config +++ kon2-0.3.9b/.config @@ -0,0 +1,24 @@ +INCDIR = /home/ishikawa/work/kon2/kon2-0.3.9b/include +LIB = /home/ishikawa/work/kon2/kon2-0.3.9b/lib/libgon.a + +TOPDIR = +BINDIR = $(TOPDIR)/usr/bin +LIBDIR = $(TOPDIR)/etc +MANDIR = $(TOPDIR)/usr/share/man/ja/man1 +CONFIG_NAME = kon.cfg +OPTS = -DCONFIG_NAME=\"$(LIBDIR)/$(CONFIG_NAME)\" -I$(INCDIR) +ifdef MINI_KON +CFLAGS += -DMINI_KON -O2 -Wall $(OPTS) +else +CFLAGS += -O2 -Wall $(OPTS) +endif +LD = gcc $(CFLAGS) -lutil +RM = rm -f +INSTALL = install -c -s + +HAS_VGA = HAS_VGA +HAS_MOUSE = HAS_MOUSE +FLD_MINIX = FLD_MINIX +FLD_BDF = FLD_BDF +FLD_FONTX2 = FLD_FONTX2 +USE_STATICFONT = USE_STATICFONT --- kon2-0.3.9b.orig/kon.cfg.linux +++ kon2-0.3.9b/kon.cfg.linux @@ -115,22 +115,20 @@ # Startup command definition (usually font loading commands are specified) minix: - /usr/bin/fld.minix -n /usr/share/fonts/publicfont.ank - /usr/bin/fld.minix -n /usr/share/fonts/publicfont.k14 + /usr/bin/fld.minix -n /usr/share/fonts/kon/publicfont.ank + /usr/bin/fld.minix -n /usr/share/fonts/kon/publicfont.k14 fontx: /usr/bin/fld.fontx -n /dos/lib/font/new/jpnhn16x.fnt /usr/bin/fld.fontx -n /dos/lib/font/new/jpnzn16x.fnt minix-zcat: - zcat /usr/share/fonts/publicfont.a.Z | /usr/bin/fld.minix -n - zcat /usr/share/fonts/publicfont.k.Z | /usr/bin/fld.minix -n + zcat /usr/share/fonts/kon/publicfont.a.Z | /usr/bin/fld.minix -n + zcat /usr/share/fonts/kon/publicfont.k.Z | /usr/bin/fld.minix -n 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 + gzip -d < /usr/share/fonts/kon/pubfont.a.gz | /usr/bin/fld -t minix -n + gzip -d < /usr/share/fonts/kon/pubfont.k.gz | /usr/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 @@ -196,10 +194,10 @@ # EUC, SJIS ja_JP.ujis:Coding - JISX0201.1976-0 JISX0208.1983-0 EUC + ISO8859-1 JISX0208.1983-0 EUC ja_JP.sjis: - JISX0201.1976-0 JISX0208.1983-0 SJIS + ISO8859-1 JISX0208.1983-0 SJIS zh_TW.big5: ISO8859-1 BIG5.HKU-0 --- kon2-0.3.9b.orig/Makefile.linux +++ kon2-0.3.9b/Makefile.linux @@ -47,7 +47,7 @@ mv $(LIBDIR)/$(CONFIG_NAME) $(LIBDIR)/$(CONFIG_NAME)'.org';\ echo $(LIBDIR)/$(CONFIG_NAME)': file exists ... renamed !!';\ fi - @install -c $(CONFIG_NAME).linux $(LIBDIR)/${CONFIG_NAME} + @install -m 644 -c $(CONFIG_NAME).linux $(LIBDIR)/${CONFIG_NAME} install -c doc/kon.1 $(MANDIR) makedir: --- kon2-0.3.9b.orig/config.out +++ kon2-0.3.9b/config.out @@ -0,0 +1,20 @@ +build MINI KON +MINI_KON n +Support VGA driver +HAS_VGA y +Support J31SX driver +HAS_J31SX n +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 n +Use ROM font +USE_ROMFONT n +Use Static font +USE_STATICFONT y --- kon2-0.3.9b.orig/terminfo.kon +++ kon2-0.3.9b/terminfo.kon @@ -1,5 +1,5 @@ kon|kanji on console, - am, bce, ccc, eo, mir, msgr, xenl, xon, + am, ccc, eo, mir, msgr, xenl, xon, colors#8, cols#80, it#8, lines#25, ncv#3, pairs#64, acsc=`\004a\261f\370g\361h\260j\331k\277l\332m\300n\305o~q\304r\362s_t\303u\264v\301w\302x\263y\371z\372{\373|\374}\375~\376.\031-\030\054\021+^P0\333p\304r\304y\363z\362{\343|\330}\234, bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, --- kon2-0.3.9b.orig/src/errors.c +++ kon2-0.3.9b/src/errors.c @@ -50,7 +50,7 @@ vfprintf(stderr, format, args); } else { VtEmu(head, strlen(head)); - vsprintf(buf, format, args); + vsnprintf(buf, MAX_MSGLEN, format, args); VtEmu(buf, strlen(buf)); } #endif --- kon2-0.3.9b.orig/src/main.c +++ kon2-0.3.9b/src/main.c @@ -30,15 +30,42 @@ #include #include #include +#include +#include +#if defined(linux) +#include +#endif #include #include #include -void +void KonInit (); +void KonStart (); + +int +check_tty () +{ + struct stat device_stat; + + if (stat(ttyname(STDIN_FILENO), &device_stat) == -1) + return -1; + if (major(device_stat.st_rdev) != TTY_MAJOR) + return -1; + + return 0; +} + +int main(int argc, const char *argv[]) { + + if (check_tty ()) { + fprintf(stderr, "You can run this Kon at only console terminal.\n"); + exit(EXIT_FAILURE); + } + #ifdef MINI_KON fprintf(stderr, "Kanji ON Console MINI " VERSION "\n\n"); #else @@ -50,4 +77,6 @@ } KonInit(argc - 1, argv + 1); KonStart(TRUE); + + return 0; } --- kon2-0.3.9b.orig/src/term.c +++ kon2-0.3.9b/src/term.c @@ -25,6 +25,9 @@ * */ +/* #define ErrorF(x,y) fprintf(stderr,x,y); */ +#define ErrorF(x,y) + #include #include #include @@ -58,6 +61,7 @@ #include #include #include +#include #ifdef MINI_KON static int mouseFd=-1; #else @@ -81,6 +85,9 @@ static char ptyName[MAX_TTYNAME + 1]; static int orgVtNum = -1; +static void ChangeNewConsole (); +void RunStartupCmd (); + struct initInfo { bool display; /* display initialized */ bool utmp; /* utmp set */ @@ -180,10 +187,11 @@ numFds = masterPty + 1; #else FD_SET(sockFd, &orgReadFds); - if (mInfo.has_mouse && mouseFd > 0) + if (mInfo.has_mouse) MouseSetRfd(mouseFd); else MouseResetRfd(mouseFd); + numFds = (masterPty < numFds) ? numFds : masterPty + 1; #endif /* Note: we use timeout on select call even if cursor blink is off because of screen saver and mouse cursor timeout. */ @@ -197,8 +205,16 @@ tv.tv_sec = 0; tv.tv_usec = 100000; /* 0.1 sec */ v = select(numFds, &readFds, NULL, NULL, &tv); - } while (v == 0 || (v < 0 && (errno == EINTR || mouseFd < 0))); + } while (v == 0 || (v < 0 && + (errno == EINTR || mouseFd < 0 || + (errno == EBADF && mInfo.has_mouse)))); if (v < 0) { + ErrorF("v: %d\r\n", v); + ErrorF("numFds: %d\r\n", numFds); + ErrorF("masterPty: %d\r\n", masterPty); + ErrorF("sockFd: %d\r\n", sockFd); + ErrorF("mouseFd: %d\r\n", mouseFd); + ErrorF("errno: %d\r\n", errno); PerrorExit("select"); } if (FD_ISSET(masterPty, &readFds)) { @@ -235,7 +251,10 @@ if (FD_ISSET(sockFd, &readFds)) SocketInterface(sockFd); if (mInfo.has_mouse && mouseFd > 0) { if (FD_ISSET(mouseFd, &readFds) && con.active) { - i = read(mouseFd, buff, BUFSIZ); + i = -1; + if(mouseFd > 0) { + i = read(mouseFd, buff, BUFSIZ); + } if (i > 0) MouseGetPacket(buff, i); PollCursor(TRUE); } @@ -248,7 +267,7 @@ { int i = 0; const char *video = "NORMAL"; - extern int ConfigExecProg(const char *); + extern int ConfigExecProg(const char *,char *const args[]); if (argc > 0 && argv[0][0] != '-') { video = argv[0]; @@ -268,8 +287,10 @@ KonError("no value for `%s'\r\n", arg); break; } - if (!strcasecmp(arg, "e")) - ConfigExecProg(argv[i]); + if (!strcasecmp(arg, "e")){ + ConfigExecProg(argv[i],&(argv[i])); + break; + } else if (SetCapArg(arg, argv[i]) < 0) KonWarn("invalid capability `%s' ignored\r\n", arg); i++; @@ -279,6 +300,8 @@ static int savedArgc; /* argc of startup time */ static const char **savedArgv; /* argv of startup time */ +static void ChangeNewConsole(); + /* Do initialization before reading config file */ void KonInit(int argc, const char *argv[]) @@ -288,7 +311,6 @@ init.display = init.utmp = init.socket = init.termios = FALSE; /* Initialize subsystems. */ - ChangeNewConsole(); CapInit(); #ifndef MINI_KON @@ -321,8 +343,9 @@ CapInit(); ConsoleCleanup(); #ifndef MINI_KON - if (mInfo.has_mouse) + if (mInfo.has_mouse && mouseFd > 0) { MouseCleanup(); + } MouseInit(); #endif #if 0 @@ -357,8 +380,9 @@ TryTermReset(0, (const char **)NULL) < 0) KonFatal("giving up\r\n"); #ifndef MINI_KON - if (mInfo.has_mouse) + if (mInfo.has_mouse) { mouseFd = MouseStart(); + } #endif VtStart(); ConsoleStart(); @@ -388,21 +412,15 @@ char ls, ln; #ifdef MINI_KON extern void LoadMiniFont(); +#else + RunStartupCmd(); #endif - /* Open PTY(master) */ - for (ls = 'p'; ls <= 's'; ls ++) { - for (ln = 0; ln <= 0xF; ln ++) { - sprintf(ptyName, "/dev/pty%1c%1x", ls, ln); - if ((masterPty = open(ptyName, O_RDWR)) >= 0) break; - } - if (masterPty >= 0) break; - } - if (masterPty < 0) { - KonMessage("can not get master pty\r\n"); - PerrorExit(ptyName); + /* Open PTY */ + if (openpty (&masterPty, &slavePty, ptyName, NULL, NULL) == -1) { + KonMessage ("cannot open PTY\r\n"); + PerrorExit ("openpty"); } - ptyName[5] = 't'; #ifndef MINI_KON if (mInfo.has_mouse) { @@ -411,7 +429,6 @@ #endif #ifndef MINI_KON - chown("/dev/tty0", getuid(), getgid()); #if defined(linux) sockFd = SocketInit(TermName() + 8); #elif defined(__FreeBSD__) @@ -495,10 +512,6 @@ } } #endif - /* Open TTY(slave) */ - if ((slavePty = open(ptyName, O_RDWR)) < 0) { - PerrorExit(ptyName); - } close(masterPty); /* Set old tio to TTY */ tcsetattr(slavePty, TCSAFLUSH, &oldTio); @@ -571,9 +584,9 @@ } setsid(); #if defined(linux) - sprintf(vtty, "/dev/tty%d", vtNum); + snprintf(vtty, sizeof(vtty), "/dev/tty%d", vtNum); #elif defined(__FreeBSD__) - sprintf(vtty, "/dev/ttyv%d", vtNum); + snprintf(vtty, sizeof(vtty), "/dev/ttyv%d", vtNum); #endif if ((vfd = open(vtty, O_RDWR)) < 0) KonFatal("can't open %s", vtty); --- kon2-0.3.9b.orig/src/vc.c +++ kon2-0.3.9b/src/vc.c @@ -33,6 +33,7 @@ #include #if defined(linux) #include +#include #endif #include #include @@ -716,7 +717,7 @@ static void ShowCursor(struct cursorInfo *c, bool show) { - if (!con.active || !c->sw) + if (!con.active || (!c->shown && !c->sw)) return; if (c->shown != show) ToggleCursor(c); @@ -775,7 +776,7 @@ return; } if ((cInfo.interval > 0) && (++cInfo.count == cInfo.interval)) { - ToggleCursor(&cInfo); + ShowCursor(&cInfo, !cInfo.shown); } #ifndef MINI_KON if (mInfo.has_mouse) { @@ -830,7 +831,7 @@ char *name; name = malloc(strlen(config) + 1); - sscanf(config, "%s", name); + sscanf(config, "%s", name); /* ok, name[strlen(config)+1] */ for (v = videos; v->name != NULL; v++) { if (strcasecmp(name, v->name) == 0) { config = strchr(config, '\n'); --- kon2-0.3.9b.orig/src/utmp.c +++ kon2-0.3.9b/src/utmp.c @@ -45,6 +45,8 @@ #include #include #include +#include +#include static int ttyGid; @@ -56,16 +58,21 @@ struct group *ttygrp; char *tn; +#define PTYCHARLEN 4 pw = getpwuid(getuid()); - tn = rindex(tty, '/') + 1; + if (strlen (tty) <= PTYCHARLEN) { + tn = tty; + } else { + tn = tty + strlen (tty) - PTYCHARLEN; + } memset((char *)&utmp, 0, sizeof(utmp)); - strncpy(utmp.ut_id, tn + 3, sizeof(utmp.ut_id)); + strncpy(utmp.ut_id, tn, sizeof(utmp.ut_id)); utmp.ut_type = DEAD_PROCESS; setutent(); getutid(&utmp); utmp.ut_type = USER_PROCESS; utmp.ut_pid = getpid(); - strncpy(utmp.ut_line, tn, sizeof(utmp.ut_line)); + strncpy(utmp.ut_line, tty + strlen ("/dev/"), sizeof(utmp.ut_line)); strncpy(utmp.ut_user, pw->pw_name, sizeof(utmp.ut_user)); time(&(utmp.ut_time)); pututline(&utmp); @@ -85,7 +92,11 @@ struct utmp utmp, *utp; char *tn; - tn = rindex(tty, '/') + 4; + if (strlen (tty) <= PTYCHARLEN) { + tn = tty; + } else { + tn = tty + strlen (tty) - PTYCHARLEN; + } memset((char *)&utmp, 0, sizeof(utmp)); strncpy(utmp.ut_id, tn, sizeof(utmp.ut_id)); utmp.ut_type = USER_PROCESS; --- kon2-0.3.9b.orig/src/vt.c +++ kon2-0.3.9b/src/vt.c @@ -212,12 +212,12 @@ if (arg == 6) { int x = (con.x < con.xmax) ? con.x : con.xmax; int y = (con.y < con.ymax) ? con.y : con.ymax; - sprintf(report, "\x1B[%d;%dR", y + 1, x + 1); + snprintf(report, sizeof(report), "\x1B[%d;%dR", y + 1, x + 1); } else if (arg == 5) - strcpy(report, "\x1B[0n\0"); + strcpy(report, "\x1B[0n\0"); /* ok */ break; case 'c': - if (arg == 0) strcpy(report, "\x1B[?6c\0"); + if (arg == 0) strcpy(report, "\x1B[?6c\0"); /* ok */ break; } write(masterPty, report, strlen(report)); @@ -248,10 +248,11 @@ ioctl(masterPty, TIOCSWINSZ, &win); } +static void EscBracket(u_char); + static void EscStatusLine(u_char mode) { - static void EscBracket(u_char); static struct attrStack *asp; switch(mode) { @@ -303,7 +304,7 @@ if (ch >= '0' && ch <= '9') { varg[narg] = (varg[narg] * 10) + (ch - '0'); } else if (ch == ';') { - /* 引数は MAX_NARG までしかサポートしない!! */ + /* only support as args less than MAX_NARG */ if (narg < MAX_NARG) { narg ++; varg[narg] = 0; @@ -688,11 +689,13 @@ static int ConfigCoding(const char *confstr) { - char reg[3][MAX_COLS]; + char *reg[3]; int n, i; + for(i = 0; i < 3 ; i++) + reg[i] = malloc(strlen(confstr) + 1); *reg[0] = *reg[1] = *reg[2] = '\0'; - sscanf(confstr, "%s %s %s", reg[0], reg[1], reg[2]); + sscanf(confstr, "%s %s %s", reg[0], reg[1], reg[2]); /* safe, enough space allocated for reg[0,1,2] */ for (i = 0; i < 3 && *reg[i]; i ++) { n = (int)CodingByRegistry(reg[i]); if (n < 0) { --- kon2-0.3.9b.orig/src/child.c +++ kon2-0.3.9b/src/child.c @@ -39,11 +39,27 @@ #include #include +#define _USE_BSD +#include +#include +#include + static char *startupStr, *execProg; +static char *execProgArgs[256]; + +void PerrorExit (); -int ConfigExecProg(const char *string) +int ConfigExecProg(const char *string, char *args[]) { + int i=0; execProg = strdup(string); + for (i = 0; i < 256; i++) { + if (args[i]) + execProgArgs[i] = args[i]; + else + break; + } + execProgArgs[i]=NULL; return SUCCESS; } @@ -55,14 +71,42 @@ return SUCCESS; } -static void RunStartupCmd(void) +void RunStartupCmd(void) { char *p; + int StartupPid; + int stat; p = strtok(startupStr, "\n"); while(p) { - system(p); - p = strtok(NULL, "\n"); + /* fork handler */ + if ((StartupPid = fork()) < 0) { + PerrorExit("fork"); + } + if (StartupPid != 0) { + /* I'm parent. */ + + wait4(StartupPid, &stat, 0, 0); + if(WIFEXITED(stat) == 0) + PerrorExit("StartupCmd"); + + } else { + + /* I'm child */ + char *argv[4]; + + /* run as user, not effective user root */ + setgid(getgid()); + setuid(getuid()); + + argv[0] = "sh"; + argv[1] = "-c"; + argv[2] = p; + argv[3] = NULL; + execv("/bin/sh", argv); + _exit(0); + } + p = strtok(NULL, "\n"); } } @@ -95,20 +139,18 @@ #ifndef MINI_KON char *shell; - setgid(getgid()); - setuid(getuid()); - - RunStartupCmd(); + setgid(getgid()); + setuid(getuid()); #endif #if defined(linux) #ifdef MINI_KON - strcpy(buff, "TERM=linux"); + strcpy(buff, "TERM=linux"); /* ok - buff[256] */ #else - strcpy(buff, "TERM=kon"); + strcpy(buff, "TERM=kon"); /* ok - buff[256] */ #endif #elif defined(__FreeBSD__) - sprintf(buff,"TERM=vt100"); + sprintf(buff,"TERM=vt100"); /* ok - buff[256] */ #endif tcap = strdup(buff); @@ -133,13 +175,13 @@ #endif if (execProg) - execlp(execProg, execProg, 0); + execvp(execProg, execProgArgs); else { if ((execProg = getenv("SHELL")) == NULL) execProg = "/bin/sh"; if ((tail = rindex(execProg, '/')) == NULL) tail = " sh"; - sprintf(buff, "-%s", tail + 1); + snprintf(buff, sizeof(buff), "-%s", tail + 1); execl(execProg, buff, 0); } fprintf(errfp, "KON> couldn't exec shell\r\n"); --- kon2-0.3.9b.orig/src/mouse.c +++ kon2-0.3.9b/src/mouse.c @@ -34,6 +34,7 @@ #ifndef MINI_KON #include +#include #include #include @@ -48,7 +49,6 @@ #include #include #include - #include #include @@ -159,7 +159,7 @@ char *name; name = malloc(strlen(config) + 1); - sscanf(config, "%s", name); + sscanf(config, "%s", name); /* ok, name[strlen(config)+1] */ if (mouseDev) free(mouseDev); mouseDev = strdup(name); @@ -183,7 +183,7 @@ mouseType = MOUSE_NONE; mInfo.has_mouse = FALSE; name = malloc(strlen(config) + 1); - sscanf(config, "%s", name); + sscanf(config, "%s", name); /* ok, name[strlen(config)+1] */ for (p = mice; p->name != NULL; p++) { if (strcasecmp(name, p->name) == 0) { mouseType = p->type; @@ -216,7 +216,7 @@ void MouseSetBaud(int mfd, u_short baud, u_short cflag) { struct termios mio; - char *cf; + char *cf = "*q"; tcgetattr(mfd, &mio); @@ -364,7 +364,7 @@ void MouseGetPacket(u_char *buff, int size) { static u_char packet[MAX_PK_SIZE]; - static stat = 0; + static int stat = 0; int n; for (n = 0; n < size; n ++, buff ++) { --- kon2-0.3.9b.orig/src/sock.c +++ kon2-0.3.9b/src/sock.c @@ -86,9 +86,9 @@ struct sockaddr sinfo; #if defined(linux) - sprintf(sinfo.sa_data, "/tmp/.kon%s", tty); + snprintf(sinfo.sa_data, sizeof(sinfo.sa_data), "/tmp/.kon%s", tty); #elif defined(__FreeBSD__) - sprintf(sinfo.sa_data, "/tmp/.kon"); + snprintf(sinfo.sa_data, sizeof(sinfo.sa_data), "/tmp/.kon"); #endif unlink(sinfo.sa_data); if ((sfd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { --- kon2-0.3.9b.orig/src/display/j31sx.c +++ kon2-0.3.9b/src/display/j31sx.c @@ -47,7 +47,7 @@ #include #include #include -#include +/* #include */ #include #undef free #include --- kon2-0.3.9b.orig/src/display/vga.c +++ kon2-0.3.9b/src/display/vga.c @@ -44,6 +44,7 @@ #if defined(linux) /* #include */ #include +#include #elif defined(__FreeBSD__) #include #include @@ -111,6 +112,8 @@ static u_short fmPattern; /* bit pattern to modify font; skip line if bit clear */ #endif +void VgaLoadStaticFont (); + void VgaSetRegisters(struct vgaRegs *regs) { int i; @@ -190,7 +193,7 @@ static inline void VgaSetColor(u_char col) { - static old; + static u_char old; if (old == col) return; PortOutw(col << 8, VGAGRP_ADDR); @@ -692,7 +695,7 @@ GRAPH_BASE ); close(devMem); - if ((long)gramMem < 0) { + if (gramMem == (unsigned char *)-1) { perror("mmap"); return FAILURE; } --- kon2-0.3.9b.orig/src/display/s3.c +++ kon2-0.3.9b/src/display/s3.c @@ -43,7 +43,6 @@ #include #include #include -#include #include #undef free #include --- kon2-0.3.9b.orig/debian/rules +++ kon2-0.3.9b/debian/rules @@ -0,0 +1,67 @@ +#!/usr/bin/make -f +# Sample debian.rules file - for GNU Hello (1.3). +# Copyright 1994,1995 by Ian Jackson. +# I hereby give you perpetual unlimited permission to copy, +# modify and relicense this file, provided that you do not remove +# my name from the file itself. (I assert my moral right of +# paternity under the Copyright, Designs and Patents Act 1988.) +# This file may have to be extensively modified +# +# Modified to be a prototype for debmake by Christoph Lameter + +package=kon2 +build: build-stamp +build-stamp: + dh_testdir + + make -f Makefile.linux config + make depend + make + touch $@ + +clean: + dh_testdir + dh_testroot + -rm -f build-stamp + + -make clean + -rm -rf Makefile font/Makefile \ + lib/Makefile src/Makefile src/display/Makefile + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + make install TOPDIR=$(CURDIR)/debian/$(package) + + install -m 755 tools/mkminifont $(CURDIR)/debian/$(package)/usr/bin + TERMINFO=$(CURDIR)/debian/$(package)/usr/share/terminfo tic terminfo.kon + install -m 644 doc/kon.1.eng $(CURDIR)/debian/$(package)/usr/share/man/man1/kon.1 + +# 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_installdocs + dh_installman + dh_undocumented fld.1 newvc.1 swkon.1 mkminifont.1 + dh_installchangelogs doc/CHANGES + dh_strip + dh_compress + dh_fixperms + chown root.root $(CURDIR)/debian/$(package)/usr/bin/kon + chmod 4755 $(CURDIR)/debian/$(package)/usr/bin/kon + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install --- kon2-0.3.9b.orig/debian/compat +++ kon2-0.3.9b/debian/compat @@ -0,0 +1 @@ +7 --- kon2-0.3.9b.orig/debian/dirs +++ kon2-0.3.9b/debian/dirs @@ -0,0 +1,4 @@ +etc +usr/bin +usr/share/terminfo/k +usr/share/man/man1 --- kon2-0.3.9b.orig/debian/changelog +++ kon2-0.3.9b/debian/changelog @@ -0,0 +1,348 @@ +kon2 (0.3.9b-20) unstable; urgency=low + + * cleanup debian/rules + * update description + * drop debian/conffiles + * adapt Debian policy 3.7.3.0 + * fix FTBFS, closes: #479975 + + -- ISHIKAWA Mutsumi Sat, 31 May 2008 09:06:30 +0900 + +kon2 (0.3.9b-19) unstable; urgency=low + + * use unix98 pty insted of BSD tty, closes: #34540 + * import patches (build warning fix, tty check, and default + mouse baud handling) from Fedora. Thanks, Akira TAGOH. + + -- ISHIKAWA Mutsumi Mon, 27 Feb 2006 15:11:28 +0900 + +kon2 (0.3.9b-18) unstable; urgency=low + + * fix FTBFS with gcc-3.4/4.0, closes: #287102, #263603 + * add Architecture: amd64, closes: #252768 + * fix mmap() error code handling in src/display/vga.c, + closes: #290611 + + -- ISHIKAWA Mutsumi Sat, 15 Jan 2005 21:30:41 +0900 + +kon2 (0.3.9b-17) unstable; urgency=low + + * fix FTBS with libc6 2.3.2.ds1-10, closes: #223167 + + -- ISHIKAWA Mutsumi Sun, 7 Dec 2003 14:14:47 +0900 + +kon2 (0.3.9b-16) unstable; urgency=low + + * maintainer mail address change. + + -- ISHIKAWA Mutsumi Thu, 22 May 2003 03:02:37 +0900 + +kon2 (0.3.9b-15) unstable; urgency=low + + * build error fix, closes: #190683 + + -- ISHIKAWA Mutsumi Fri, 25 Apr 2003 15:35:59 +0900 + +kon2 (0.3.9b-14) unstable; urgency=low + + * adapt Debian policy 3.5.8 + * rebuild with glibc 2.3.1-6 + + -- ISHIKAWA Mutsumi Sun, 22 Dec 2002 03:25:52 +0900 + +kon2 (0.3.9b-13) unstable; urgency=low + + * mkminifont trivial fix + * adapt Debian policy 3.5.6.1 + + -- ISHIKAWA Mutsumi Sat, 11 May 2002 06:02:31 +0900 + +kon2 (0.3.9b-12) unstable; urgency=low + + * fix terminfo problem, closes: #144955 + + -- ISHIKAWA Mutsumi Mon, 29 Apr 2002 17:02:29 +0900 + +kon2 (0.3.9b-11) unstable; urgency=low + + * rebuilt with glibc 2.2.2 + + -- ISHIKAWA Mutsumi Mon, 19 Feb 2001 02:19:26 +0900 + +kon2 (0.3.9b-10) unstable; urgency=low + + * cursor handling problem fix by merging #69829's patch. + closes: #69829. + + -- ISHIKAWA Mutsumi Mon, 23 Oct 2000 06:17:16 +0900 + +kon2 (0.3.9b-9) unstable; urgency=low + + * rebuild with glibc 2.1.94 + + -- ISHIKAWA Mutsumi Fri, 29 Sep 2000 08:08:12 +0900 + +kon2 (0.3.9b-8) unstable; urgency=low + + * fix postrm incorrect suidunregistration, closes: Bug#69201 + + -- ISHIKAWA Mutsumi Thu, 17 Aug 2000 09:32:10 +0900 + +kon2 (0.3.9b-7) unstable; urgency=low + + * rece condition work around , Now Really fixed!!!!!!!! + + -- ISHIKAWA Mutsumi Wed, 19 Jul 2000 03:09:14 +0900 + +kon2 (0.3.9b-6) unstable; urgency=low + + * rece condition work around fix again... + + -- ISHIKAWA Mutsumi Tue, 4 Jul 2000 19:21:27 +0900 + +kon2 (0.3.9b-5) unstable; urgency=low + + * rece condition work around patch is incorrect, so fix. + + -- ISHIKAWA Mutsumi Mon, 3 Jul 2000 21:12:02 +0900 + +kon2 (0.3.9b-4) unstable; urgency=low + + * Font loading can not work correctly in some environment. It is fld and + kon race condition bug. Now fixed. + + -- ISHIKAWA Mutsumi Sat, 1 Jul 2000 23:03:19 +0900 + +kon2 (0.3.9b-3) frozen unstable; urgency=high + + * [Security FIX] apply "more and more buffer overflow fix patch" written + by UKAI Fumitoshi . + + -- ISHIKAWA Mutsumi Wed, 21 Jun 2000 02:42:58 +0900 + +kon2 (0.3.9b-2) frozen unstable; urgency=high + + * [Security FIX] buffer overrun security problem of + fld command (bdf.c) fixed (but ad-hoc this patch...) + + -- ISHIKAWA Mutsumi Tue, 20 Jun 2000 22:18:40 +0900 + +kon2 (0.3.9b-1) frozen unstable; urgency=high + + * New Upstream Version. + * [Security FIX] buffer overrun security problem fixed, + closes: Bug#63724 + + -- ISHIKAWA Mutsumi Sat, 13 May 2000 22:38:18 +0900 + +kon2 (0.3.8-6) unstable; urgency=low + + * Maintainer release, closes: Bug#48985 + + -- ISHIKAWA Mutsumi Mon, 3 Jan 2000 23:13:21 +0900 + +kon2 (0.3.8-5.1) experimental; urgency=low + + * experimental on select function in term.c + + -- Taketoshi Sano Tue, 2 Nov 1999 13:18:07 +0900 + +kon2 (0.3.8-5) unstable; urgency=low + + * applied mouse file descripter check patch. Thanks for Taketoshi Sano + . This patch is already send to upstream auther. + closes: Bug#48293 + + -- ISHIKAWA Mutsumi Tue, 26 Oct 1999 00:37:55 +0900 + +kon2 (0.3.8-4) unstable; urgency=low + + * Change optimization flags to -O0 (This is ad hoc solution. I'll + discuss about this bug with upstream author.) closes: Bug#48005 + + -- ISHIKAWA Mutsumi Mon, 25 Oct 1999 00:38:56 +0900 + +kon2 (0.3.8-3) unstable; urgency=low + + * can't build with gcc-2.95 (or later) problem has been fixed. + * add mkminifont + * adopt FHS. + + -- ISHIKAWA Mutsumi Wed, 20 Oct 1999 21:27:07 +0900 + +kon2 (0.3.8-2) unstable; urgency=low + + * normal user can't use kon (only root can run) fixed + * kon2 depends konfont_0.1-4(or newer) + + -- ISHIKAWA Mutsumi Sat, 29 May 1999 01:09:01 +0900 + +kon2 (0.3.8-1) unstable; urgency=low + + * New Maintainer. + * New Upstream version. + * apply some patches for compile with glibc 2.1 and some bug fix. These + patches from SRPM of Vine Linux. Thanks for Daisuke SUZUKI + suggestion to apply these patches. And + special thanks for Project Vine :-) + + -- ISHIKAWA Mutsumi Thu, 20 May 1999 00:21:09 +0900 + +kon2 (0.3.7-9) frozen unstable; urgency=low + + * Japanese Manpage is under /usr/man/ja_JP.ujis. + This bug was not fixed at 0.3.7-8. + * Lintian Free (v0.9.4) + + -- Yoshiaki Yanagihara Fri, 8 Jan 1999 19:19:43 +0900 + +kon2 (0.3.7-8) frozen unstable; urgency=low + + * Moved Japanese manpage to /usr/man/ja. (Bug#JP/700) + + -- Yoshiaki Yanagihara Mon, 21 Dec 1998 15:48:56 +0900 + +kon2 (0.3.7-7) frozen unstable; urgency=HIGH + + * BugFix: Can't extract source package. (Bug#21682) + + -- Yoshiaki Yanagihara Mon, 27 Apr 1998 11:44:45 +0900 + +kon2 (0.3.7-6) unstable; urgency=low + + * Change swkon and newvc from static link to dynamic link (#19342). + * Check with lintian-0.3.1. + + -- Yoshiaki Yanagihara Wed, 11 Mar 1998 10:39:12 +0900 + +kon2 (0.3.7-5) unstable; urgency=low + + * BUG FIXED: #17695 + - Remove README.debian. + - Added undocumented english manpage: kon.1 fld.1 newvc.1 swkon.1 + - Fixed permission of japanese manpage kon.1. + - Remove INSTALLATION GUIDE: QINSTALL.ENG, INSTALL.ENG. + - kon terminfo database file installed to /usr/share/terminfo/k. + * Change Standard-Version to 2.4.0.0. + * Change Maintainer's E-mail address. + * Build with debhelper. + + -- Yoshiaki Yanagihara Tue, 10 Mar 1998 00:36:57 +0900 + +kon2 (0.3.7-4) unstable; urgency=low + + * Change architecture from any to i386 in debian/control (#16718) + * Fixed URL in debian/copyright file. + * Standards-Version 2.3.0.1 + + -- Yoshiaki Yanagihara Wed, 7 Jan 1998 10:13:34 +0900 + +kon2 (0.3.7-3) unstable; urgency=low + + * Public Release for Debian Project. + * Compiled with libc6. + + -- Yoshiaki Yanagihara Mon, 10 Nov 1997 12:51:19 +0900 + +kon2 (0.3.7-2) unstable; urgency=low + + * Compiled with libc6. + + -- Yoshiaki Yanagihara Wed, 15 Oct 1997 16:32:11 +0900 + +kon2 (0.3.7-1) unstable; urgency=low + + * New upstream version. + * Still link to libc5. + + -- Yoshiaki Yanagihara Wed, 10 Sep 1997 18:54:21 +0900 + +kon2 (0.3.5-2) unstable; urgency=low + + * Fixed Bug: font path in kon.cfg. + * Fixed download address in copyright file. + + -- Yoshiaki Yanagihara Fri, 25 Jul 1997 17:33:26 +0900 + +kon2 (0.3.5-1) unstable; urgency=low + + * New upstream version. + * Change locale name ja_JP.EUC to ja_JP.ujis. + * Fixed Bug: correct copyright file (bugs #11334) + + -- Yoshiaki Yanagihara Fri, 18 Jul 1997 19:12:20 +0900 + +kon2 (0.3-1) unstable; urgency=low + + * New source version. + * This release is for Debian JP Project. + * Add conffiles file. + + -- Yoshiaki Yanagihara Thu, 27 Mar 1997 13:28:35 +0900 + +kon2 (0.2.1-5) frozen unstable; urgency=low + + * Fixed Section Name. + * Add conffiles file. + + -- Yoshiaki Yanagihara Mon, 31 Mar 1997 19:02:42 +0900 + +kon2 (0.2.1-4) unstable; urgency=low + + * Initial Official Release (For Debian Project) + + -- Yoshiaki Yanagihara Fri, 21 Mar 1997 13:30:26 +0900 + +kon2 (0.2.1-3) unstable; urgency=low + + * Remove /usr/man/man1/kon.1 manpages. + + -- Yoshiaki Yanagihara Wed, 29 Jan 1997 15:41:59 +0900 + +kon2 (0.2.1-2) unstable; urgency=low + + * Change section from misc to utils. + * New standards-version: 2.1.2.2. + + -- Yoshiaki Yanagihara Wed, 29 Jan 1997 02:07:46 +0900 + +kon2 (0.2.1-1) unstable; urgency=HIGH + + * New upstream version. + + -- Yoshiaki Yanagihara Thu, 19 Dec 1996 11:51:46 +0900 + +kon2 (0.1-3) unstable; urgency=HIGH + + * Changed section from base to misc. + * Support konfont package instead of kon-font package. + + -- Yoshiaki Yanagihara Wed, 11 Dec 1996 03:20:25 +0900 + +kon2 (0.1-2) unstable; urgency=HIGH + + * Fixed Bug: can't output one graphicscard. + + -- Yoshiaki Yanagihara Mon, 11 Nov 1996 11:56:43 +0900 + +kon2 (0.1-1) unstable; urgency=HIGH + + * New upstream version. + * Divided kon-font package. (Make kon-font_1.0) + + -- Yoshiaki Yanagihara Wed, 30 Oct 1996 10:46:58 +0900 + +kon (0.99.4g-2) unstable; urgency=HIGH + + * Compress manual page with gzip -9v. + * Compress any documentations with gzip -9v. + + -- Yoshiaki Yanagihara Mon, 7 Oct 1996 20:07:41 +0900 + +kon (0.99.4g-1) unstable; urgency=HIGH + + * Initial release. + + -- Yoshiaki Yanagihara Tue, 1 Oct 1996 11:32:22 +0900 + + --- kon2-0.3.9b.orig/debian/control +++ kon2-0.3.9b/debian/control @@ -0,0 +1,14 @@ +Source: kon2 +Section: utils +Priority: optional +Maintainer: ISHIKAWA Mutsumi +Build-Depends: debhelper (>= 7) +Standards-Version: 3.7.3.0 + +Package: kon2 +Architecture: i386 amd64 +Conflicts: kon +Replaces: kon +Depends: ${shlibs:Depends}, konfont (>= 0.1-4) +Description: Kanji on Linux Console + Userland Japanese terminal on Linux console. --- kon2-0.3.9b.orig/debian/copyright +++ kon2-0.3.9b/debian/copyright @@ -0,0 +1,34 @@ +This package was debianized by Yoshiaki Yanagihara yochi@debian.or.jp on +Fri, 18 Jul 1997 19:12:20 +0900. + +Maintainer change from Yoshiaki Yanagihara to +ISHIKAWA Mutsumi on Thu May 20 01:18:03 JST 1999 + +It was downloaded from + ftp://ftp.linet.gr.jp/pub/KON/ + +Copyright: + + KON2 - Kanji ON Console - + Copyright (C) 1992-1997 Takashi MANABE (manabe@papilio.tutics.tut.ac.jp) + + 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. + + THIS SOFTWARE IS PROVIDED BY TAKASHI MANABE ``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 TAKASHI MANABE 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. --- kon2-0.3.9b.orig/debian/docs +++ kon2-0.3.9b/debian/docs @@ -0,0 +1,9 @@ +doc/AUTHOR +doc/MODULE +doc/README +doc/THANKS +doc/TODO +doc/conf.doc +doc/fld.j3100.doc +doc/kon.doc +tools/minifont.list --- kon2-0.3.9b.orig/font/fontx2.c +++ kon2-0.3.9b/font/fontx2.c @@ -41,7 +41,7 @@ #include extern struct fontInfo fi; -extern forceLoad; +extern int forceLoad; struct fontx { char title[6]; --- kon2-0.3.9b.orig/font/j3100.c +++ kon2-0.3.9b/font/j3100.c @@ -40,7 +40,8 @@ #include #include #include -#include +/* #include */ +/* #include */ #include #include --- kon2-0.3.9b.orig/font/minix.c +++ kon2-0.3.9b/font/minix.c @@ -52,7 +52,7 @@ #define FH_MEMO_SIZE 508 extern struct fontInfo fi; -extern forceLoad; +extern int forceLoad; struct font_header { short fnt_size; /* bytes per one character bit patern */ --- kon2-0.3.9b.orig/font/fld.c +++ kon2-0.3.9b/font/fld.c @@ -33,6 +33,8 @@ #include unsigned char *LoadFontFile(); +void UnloadShmem(); +void ShowFont(); extern struct fontInfo fi; @@ -44,7 +46,7 @@ int i, n; FILE *fp = stdin; enum {ST_ARG, ST_UNLOAD, ST_TYPE} st=ST_ARG; - char *path, *type, *p; + char *path, *type = NULL, *p; u_char *font; int forceLoad=1; --- kon2-0.3.9b.orig/font/bdf.c +++ kon2-0.3.9b/font/bdf.c @@ -39,14 +39,20 @@ #include extern struct fontInfo fi; -extern forceLoad; +extern int forceLoad; + +int buffer_error() +{ + fprintf(stderr,"buffer overflow\n"); + exit(1); +} u_char *FontLoadBdf(fp) FILE *fp; { char *fdata = NULL, line[256], *p, *w, reg[256]; u_char ch, ch2; - int num, width, high, i, code, data, k, n; + int num, width, high, i, code = 0, data, k, n; struct fontRegs *fReg; struct fontLoaderRegs *fldReg; @@ -61,23 +67,38 @@ p = line + sizeof("FONTBOUNDINGBOX"); sscanf(p, "%d %d", &width, &high); } else if (!strncmp("CHARSET_REGISTRY", line, 16)) { - p = line + sizeof("CHARSET_REGISTRY"); - while(*p != '"') p ++; + p = line + sizeof("CHARSET_REGISTRY") - 1; + while(*p != '"') { + p ++; + if (p - line > 255) buffer_error(); + } w = ++p; - while(*p != '"') p ++; + while(*p != '"') { + p ++; + if (p - line > 255) buffer_error(); + } *p = '\0'; - strcpy(reg, w); + strncpy(reg, w, sizeof(reg)); } else if (!strncmp("CHARSET_ENCODING", line, 16)) { - p = line + sizeof("CHARSET_ENCODING"); - while(*p != '"') p ++; + p = line + sizeof("CHARSET_ENCODING") - 1; + while(*p != '"') { + p ++; + if (p - line > 255) buffer_error(); + } w = ++p; - while(*p != '"') p ++; + while(*p != '"') { + p ++; + if (p - line > 255) buffer_error(); + } *p = '\0'; - strcat(reg, "-"); - strcat(reg, w); + if (strlen(reg) + 1 + strlen(w) + 1 < sizeof(reg)) { + strcat(reg, "-"); + strcat(reg, w); + } else + buffer_error(); fi.type = CodingByRegistry(reg); } else if (!num && !strncmp("CHARS ", line, 6)) { - p = line + sizeof("CHARS"); + p = line + sizeof("CHARS") - 1; sscanf(p, "%d", &num); break; } @@ -162,3 +183,4 @@ exit(0); } #endif + --- kon2-0.3.9b.orig/kbiff/kbiff.c +++ kon2-0.3.9b/kbiff/kbiff.c @@ -24,13 +24,15 @@ time_t old_mtime=0; int n, update=1; struct stat st; + int bufflen; if ((term = getenv("TERM")) == NULL || (mail = getenv("MAIL")) == NULL) exit(1); setupterm(term, 1, &n); if (n != 1) exit(1); if (!has_status_line) exit(1); - if ((buff = calloc(columns + 1, 1)) == NULL) exit(1); + bufflen = columns + 1; + if ((buff = calloc(bufflen, 1)) == NULL) exit(1); putp(tparm(to_status_line, 0, 0)); putp(from_status_line); fflush(stdout); @@ -39,14 +41,14 @@ while (1) { if (!stat(mail, &st) && st.st_size) { if (st.st_mtime > old_mtime) { - sprintf(buff, "New mail received %s", - ctime(&st.st_mtime)); + snprintf(buff, bufflen, "New mail received %s", + ctime(&st.st_mtime)); update = 1; old_mtime = st.st_mtime; } } else { if (st.st_mtime > old_mtime) { - sprintf(buff, "No mail"); + snprintf(buff, bufflen, "No mail"); update = 1; old_mtime = st.st_mtime; } --- kon2-0.3.9b.orig/lib/getcap.c +++ kon2-0.3.9b/lib/getcap.c @@ -73,6 +73,12 @@ fprintf(stderr, "cap %s redefined (default %s)\r\n", name, def_value ? def_value : "None"); #endif + /* release previous value - ukai */ + if (cp->name) + free(cp->name); + if (cp->def_value) + free(cp->def_value); + cp->name = strdup(name); cp->func = func; if (def_value) @@ -223,6 +229,9 @@ /* Protected capability. */ return FAILURE; } + /* release previous value - ukai */ + if (cp->arg) + free(cp->arg); cp->arg = strdup(value); #ifdef DEBUG fprintf(stderr, "Setting arg for %s to %s\r\n", capName, value); @@ -234,8 +243,9 @@ bool BoolConf(const char *confstr) { - char name[MAX_COLS]; - sscanf(confstr, "%s", name); + char *name; + name = malloc(strlen(confstr) + 1); + sscanf(confstr, "%s", name); /* its safe because name[strlen(confstr)+1] */ if (strcasecmp(name, "On") == 0 || strcasecmp(name, "True") == 0) { return TRUE; --- kon2-0.3.9b.orig/lib/sockface.c +++ kon2-0.3.9b/lib/sockface.c @@ -86,9 +86,11 @@ if (ioctl(fd, VT_GETSTATE, &vs) < 0) { return EOF; } - sprintf(sa->sa_data, "%s%d", SOCKET_BASENAME, vs.v_active); + snprintf(sa->sa_data, sizeof(sa->sa_data), + "%s%d", SOCKET_BASENAME, vs.v_active); #elif defined(__FreeBSD__) - sprintf(sa->sa_data, "%s", SOCKET_BASENAME); + snprintf(sa->sa_data, sizeof(sa->sa_data), + "%s", SOCKET_BASENAME); #endif return(0); } --- kon2-0.3.9b.orig/doc/kon.1 +++ kon2-0.3.9b/doc/kon.1 @@ -267,9 +267,9 @@ .SH 【ファイル】 .if n .ta 2.5i .if t .ta 1.8i -/usr/local/lib/kon.cfg 環境設定ファイル +/etc/kon.cfg 環境設定ファイル .br -/usr/lib/font/* フォントファイル +/usr/share/fonts/kon/* フォントファイル .SH 【関連項目】 swkon(1), fld(1) .SH 【注意事項】 --- kon2-0.3.9b.orig/doc/kon.1.eng +++ kon2-0.3.9b/doc/kon.1.eng @@ -0,0 +1,290 @@ +.TH KON 1 "Sep 5, 1996" +.UC 4 +.SH NAME +KON \- Kanji cONsole emulator +.SH SYNOPSYS +.B kon +[ +.B video +] +[ +.B -capability +value ... +] +.SH DESCRIPTION +\fIKON\fP is a program to display Kanji characters on a virtual +console of \fILinux\fP and \fIFreeBSD\fP. + +\fIKON\fP uses +.B pty(4) +to hook the I/O for console, and displays Kanji characters by +drawing the image of them on \fIVGA\fP or \fIDCGA\fP. + +\fIKON\fP can be invoked from another \fIKON\fP. In this situation, +new \fIKON\fP runs on newly opened virtual console. +.SH OPTIONS +.PP +\fIKON\fP has ability to interpret some options to specify the video +driver to be used, or some other environmental conditions. +.B video +is to specify one of video driver entries written in \fIkon.cfg\fP. +If this option is omitted, then \fINORMAL\fP video driver is used. +Some settings as such as \fICursorInterval\fP can be overridden by +.B -capability +options. For example, + +.br + % kon -CursorInterval 10 +.br + +invokes the kon with setting the value of \fICursorInterval\fP to 10. + +.PP +.SH CONFIGURATION +\fIkon.cfg\fP is the file to configure the behaviour of \fIKON\fP. +Video drivers and Palettes used by \fIKON\fP is specified in this file. +The format of an entry for this file is: +.TP 8 + \fIEntryName\fP:[\fIAlias1\fP:\fIAlias2\fP:...] + \fIValue_for_Entry\fP +.PP +There are no distinction about case (upper/lower) in \fIEntryName\fP. +Any line for "\fIValue_for_Entry\fP" must start with \fITAB\fP. +The part from \fI#\fP to the end of line, is treated as comment. +.PP +Types of "\fIValue_for_Entry\fP" are: +.TP 10 +\fIboolean\fP +On / Off (no distinction about upper/lower case) +.TP 10 +\fIchoice\fP +select one from options (no distinction about upper/lower case) +.TP 10 +\fInumeric\fP +Decimal Number +.TP 10 +\fIstring\fP +Each entry has it's special format. +.PP +Following two entries are essential in this configuration file: +.TP 4 +\fINORMAL\fP(string) +specify the video driver to be used. Available options are: + +.nf +\fIVGA\fP driver for VGA, SVGA, EGA +\fIVGAFM\fP same above but with ability of font deformation +\fIJ3100SX\fP driver for TOSHIBA J3100SX (DCGA) +.fi + +\fIVGA\fP and \fIVGAFM\fP require some parameters for + \fIVGA register value\fP, screen size(Number of dots), +Width(Number of characters), Hight(Number of lines). + +Users can use this entry to change the total number of characters +to be displayed, but except for VGA resolution(640x480), +the number of characters that can be seen for the specified +\fIVGA register value\fP, depends the video cards. +Default \fIkon.cfg\fP set \fINORMAL\fP as an alias for the standard +VGA, and has some alternate entries for some video cards. + +.TP 4 +\fISTARTUP\fP(string) +specify the command to be invoked at the start of \fIKON\fP. +One line for each commands, but multiple lines can be specified. +The command to load the fonts must be specified here. +When the fonts for ASCII alphanumeric have not been loaded, +then \fIVGA font\fP is used. + +.nf +.I for the fonts file which is not compressed + + +.I for the fonts file which is compressed + zcat | + zcat | +.fi +.PP +Next entry is required when VGA or VGAFM is specified as video driver: +.TP +\fIPELS\fP(string) +specify the Pallete. The format is the pallette value(decimal) for +R,G,B in each line, and 16 lines are there total. +Default \fIkon.cfg\fP has \fISTDPEL\fP and \fIREVPEL\fP entries. +\fISTDPEL\fP is the standard palette, and \fIREVPEL\fP is the reverse. +\fIPELS\fP can be specified as an alias for used entry. +.PP +Other entries are: +.TP 4 +\fIMOUSE\fP(choice) +specify the mouse driver. Select a type of mouse from +Microsoft, MouseSystems, BusMouse, MMSeries, Logitech, None +None is default. +.TP 4 +\fIMouseBaud\fP(choice) +specify the baud rate for serial mouse. Select one from +1200, 2400, 4800, 9600. Default is 1200. This is enabled +when MOUSE is specified as others than NONE or BusMousees. +.TP 4 +\fIMouseDev\fP(string) +specify the device name of Mouse. Default is /dev/mouse. +This is enabled when \fIMOUSE\fP has the entry other than None. +.TP 4 +\fIMouse3Buttons\fP(boolean) +specify if the Mouse is 3-button type. Default is Off. +.TP 4 +\fIHardScroll\fP(boolean) +specify wheter hardware scroll is used or not. Default is On. +This is effective for VGA, VGAFM, J3100SX. +.TP 4 +\fIBeepCounter\fP(numeric) +specify the length of beep sound in the unit of 1/100 sec. +Default is 5. +.TP 4 +\fICursorInterval\fP(numeric) +specify the interval of cursor blinking in the unit of 1/10 sec. +Default is 4. To stop the blinking, specify 0. +.TP 4 +\fISaveTime\fP(numeric) +specify the amount of time to start the screen saver in the unit +of minutes. Default is 4. +.TP 4 +\fIKanjiCursor\fP(boolean) +specify if wide cursor is used on Kanji characters, or ot. +Default is On. +.TP 4 +\fICursorTop\fP(numeric),\fICursorBottom\fP(numeric) +specify the size of cursor box using these two entries. +.nf + 0 +--------+ + | | + |--------| <-- CursorTop + |********| + |********| + |********| + |********| + |********| + 15 +--------+ <-- CursorBottom +.fi +These are effective for VGA, VGAFM, and CGA drivers. +.TP 4 +\fIBoxCursor\fP(boolean) +specify if the shape of cursor is box or under line. +Default is Off. Effective for only J3100SX driver. +.TP 4 +\fISavePlane3\fP(boolean) +specify if the font data on 3rd page in VGA memory is saved. +This is useful for Trident video cards. Default is Off. +Effective for VGA, VGAFM drivers. +.TP 4 +\fIVgaFontOffset\fP(numeric) +specify the offset value for \fIVGA font\fP. Default is 0. +When the \fIVGA fonts\fP are used as ASCII alphanumeric font, +there are some PCs the lower parts of characters are missing. +In those circumstance, this entry can be used to adjust the position +of displayed characters. +.TP 4 +\fICoding\fP(string) +specify the default font and the coding in 1bit. +The formats are: + +.br + [EUC|SJIS] + +SB font and DB font can be selected from: +.PP +.TP 4 + SB font: Single Byte font + ISO8859-1,ISO8859-2,ISO8859-3,ISO8859-4,ISO8859-5, + ISO8859-6,ISO8859-7,ISO8859-8,ISO8859-9, + JISX0201.1976-0 +.PP +.TP 4 + DB font: Double Byte font + GB2312.1980-1,JISX0208.1983-0,KSC5601,BIG5 +.PP +.TP 4 +\fIStartupMessage\fP(boolean) +specify if the greeting message is shown at startup. Default is On. +.PP +.SH Configuratino for High resolution screen. +When VGA or VGAFM is used as video driver, \fIKON\fP can use the +wider space for text area with the fine-tuing at \fIkon.cfg\fP. +.TP 4 +\fIEntryName\fP: +.br + <\fIVGA\fP or \fIVGAFM\fP> +.br + [decimation factor for \fIVGAFM\fP] +.br +
+.br + <\fIClock Number\fP> +.br + <\fILine Width - 1\fP> <\fILine Numbers - 1\fP> +.PP +Control parameter in 3rd line for VGAFM (2nd line for VGA) +consists of 8 decimal numbers. These numbers are similar +as the video mode lines in XF86Config. +\fIKON\fP can emulate text upto 800x600 resolution. +.TP 4 +Screen control parameters: +.br +.B HR +total dot number in horizontal +.br +.B HS +the start point of horizontal sync +.br +.B HE +the end point of horizontal sync +.br +.B HFL +Total number of horizontal frames +.br +.B VR +number of vertical lines +.br +.B VS +the start point of vertical sync +.br +.B VE +the end point of vertical sync +.br +.B VFL +total number of vertical frames +.PP +\fIClock Number\fP selects the clock frequency for the mode of +that entry. Only lowest 2 bit is effective, i.e. a number from 0 +to 3 can be specified here. +The last line specifies the area for text screen to emulate. +.SH FILES +.if n .ta 2.5i +.if t .ta 1.8i +/etc/kon.cfg Configuratin file +.br +/usr/share/fonts/kon/* Font files +.SH See Also + +.\" swkon(1), fld(1) +.SH NOTE +- When text screen is in high resolution mode at + the start of \fILinux\fP, \fIKON\fP can not work + successfully since the size of \fIVGA font\fP is + different from usual. +.br +- When multiple entries with same name in \fIkon.cfg\fP, + the first entry is used. The maximum length of one line + is 255 bytes. +.br +.\" - If \fIX Window System\fP can not start from \fIKON\fP, use +.\" \fIswkon(1)\fP to enter text mode, then disconnect mouse. +.\" After that, \fIX Window System\fP may start up. +.SH AUTHORS +.nf +MANABE Takashi +MAEDA Atusi +KOMEDA Shinji +YOSHIDA Kensyu +obuk@MIX +.fi --- kon2-0.3.9b.orig/tools/Makefile +++ kon2-0.3.9b/tools/Makefile @@ -12,7 +12,7 @@ endif CC:=$(CC) -g -LDFLAGS = -N +LDFLAGS = # -N LOADLIBES = $(LIB) all: $(TOOLS) $(SYSTOOLS) --- kon2-0.3.9b.orig/tools/logto.c +++ kon2-0.3.9b/tools/logto.c @@ -21,7 +21,7 @@ len = 0; } else { getcwd(path, _POSIX_PATH_MAX); - sprintf(name, "%s/%s", path, argv[1]); + snprintf(name, sizeof(name), "%s/%s", path, argv[1]); len = strlen(name) + 1; } SocketSendStr(s, STR_LOGTO); --- kon2-0.3.9b.orig/tools/newvc.c +++ kon2-0.3.9b/tools/newvc.c @@ -96,7 +96,7 @@ if (newVcNum < 0) { error("can't find unused virtual console", NULL); } - sprintf(newTtyName, "/dev/tty%d", newVcNum); + snprintf(newTtyName, sizeof(newTtyName), "/dev/tty%d", newVcNum); setsid(); @@ -135,6 +135,7 @@ setuid(getuid()); setgid(getgid()); + /* now run as user, not effective uid 0 */ if ((shell = getenv("SHELL")) == NULL) { shell = "/bin/sh"; @@ -152,8 +153,8 @@ command = argv[1]; for (i = 1; i < argc; i++) { - strncat(cmdBuf, argv[i], MAXCMDLEN); - strncat(cmdBuf, " ", MAXCMDLEN); + strncat(cmdBuf, argv[i], MAXCMDLEN - strlen(cmdBuf)); + strncat(cmdBuf, " ", MAXCMDLEN - strlen(cmdBuf)); } } newArgv[0] = command; --- kon2-0.3.9b.orig/tools/Configure.linux +++ kon2-0.3.9b/tools/Configure.linux @@ -61,7 +61,7 @@ TOPDIR = BINDIR = $(TOPDIR)/usr/bin LIBDIR = $(TOPDIR)/etc -MANDIR = $(TOPDIR)/usr/man/ja_JP.ujis/man1 +MANDIR = $(TOPDIR)/usr/share/man/ja/man1 CONFIG_NAME = kon.cfg OPTS = -DCONFIG_NAME=\"$(LIBDIR)/$(CONFIG_NAME)\" -I$(INCDIR) ifdef MINI_KON @@ -69,7 +69,7 @@ else CFLAGS += -O2 -Wall $(OPTS) endif -LD = gcc $(CFLAGS) +LD = gcc $(CFLAGS) -lutil RM = rm -f INSTALL = install -c -s @@ -84,7 +84,10 @@ echo '/*' $mess '*/' >>$CONFIG_H read sig def echo -n $mess '['$def']? ' - read ans < /dev/tty + #Please modify ../config.linux + #read ans < /dev/tty + ans="" + echo if [ "$ans" = "" ] then ans=$def --- kon2-0.3.9b.orig/tools/mkminifont.c +++ kon2-0.3.9b/tools/mkminifont.c @@ -1,8 +1,12 @@ #include +#include +#include #include #include #include +unsigned char *LoadFontFile (); + struct _fontent { unsigned short code; unsigned char bitmap[32]; @@ -25,7 +29,7 @@ } else path = argv[i]; } if (!path) { - printf("usage: %s [minix font file]\n"); + printf("usage: %s [minix font file]\n", argv[0]); exit(1); } if ((font = LoadFontFile(path, "minix", 0)) == NULL) { --- kon2-0.3.9b.orig/include/config.h +++ kon2-0.3.9b/include/config.h @@ -0,0 +1,70 @@ + +/* + * KON2 - Kanji ON Console - + * Copyright (C) 1992, 1993 MAEDA Atusi (mad@math.keio.ac.jp) + * Copyright (C) 1992-1996 Takashi MANABE (manabe@papilio.tutics.tut.ac.jp) + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY TAKASHI MANABE ``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 TERRENCE R. LAMBERT 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. + * + */ + +/* + NOTE: This is automatically generated config. + >>>>>>>>>>>>>> DO NOT EDIT !! <<<<<<<<<<<<<< +*/ + +#ifndef CONFIG_H +#define CONFIG_H + + +/* build MINI KON */ + +/* Support VGA driver */ +#define HAS_VGA + +/* Support J31SX driver */ + +/* Support MOUSE driver */ +#define HAS_MOUSE + +/* Install Minix/V font loader */ +#define FLD_MINIX + +/* Install $fontx2 font loader */ +#define FLD_BDF + +/* Install .bdf font loader */ +#define FLD_FONTX2 + +/* Install J3100ROM font loader */ + +/* Use ROM font */ + +/* Use Static font */ +#define USE_STATICFONT + +#ifdef MINI_KON +#define PATH_MINIFONT "/usr/lib/minikon.fnt" +#undef HAS_MOUSE +#endif + +#endif