mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-07 13:14:51 +00:00
Add Russian printer filters, mandatory because hardware code page 866
is different with KOI8-R
This commit is contained in:
parent
9ad9ea38ac
commit
6094ceca72
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=33088
@ -1,7 +1,7 @@
|
|||||||
# $Id$
|
# $Id: Makefile,v 1.3 1997/12/02 20:44:46 wollman Exp $
|
||||||
|
|
||||||
SUBDIR= common_source chkprintcap lp lpc lpd lpq lpr lprm lptest pac \
|
SUBDIR= common_source chkprintcap lp lpc lpd lpq lpr lprm lptest pac \
|
||||||
filters SMM.doc
|
filters filters.ru SMM.doc
|
||||||
|
|
||||||
.include <bsd.subdir.mk>
|
.include <bsd.subdir.mk>
|
||||||
|
|
||||||
|
12
usr.sbin/lpr/filters.ru/Makefile
Normal file
12
usr.sbin/lpr/filters.ru/Makefile
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
PROG= koi2alt
|
||||||
|
NOMAN= noman
|
||||||
|
BINDIR= /usr/libexec/lpr/ru
|
||||||
|
|
||||||
|
SAMPLES=bjc-240.sh.sample
|
||||||
|
|
||||||
|
afterinstall:
|
||||||
|
cd ${.CURDIR} && \
|
||||||
|
${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${SHAREMODE} \
|
||||||
|
${SAMPLES} ${BINDIR}
|
||||||
|
|
||||||
|
.include <bsd.prog.mk>
|
57
usr.sbin/lpr/filters.ru/bjc-240.sh.sample
Normal file
57
usr.sbin/lpr/filters.ru/bjc-240.sh.sample
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
printf "\033[K\00200\037" | tr 0 "\0"
|
||||||
|
|
||||||
|
cat << EOF1
|
||||||
|
BJLSTART
|
||||||
|
ControlMode=BJ
|
||||||
|
Font=Roman
|
||||||
|
PageLength=12
|
||||||
|
CodePage=866
|
||||||
|
AutoLF=Off
|
||||||
|
TextScaleMode=Off
|
||||||
|
AutoCR=Off
|
||||||
|
CharacterSet=Set2
|
||||||
|
AGM=Off
|
||||||
|
BJLEND
|
||||||
|
EOF1
|
||||||
|
|
||||||
|
printf "\033[K\00200\037" | tr 0 "\0"
|
||||||
|
|
||||||
|
cat << EOF2
|
||||||
|
BJLSTART
|
||||||
|
ControlMode=LQ
|
||||||
|
Font=Roman
|
||||||
|
PageLength=12
|
||||||
|
CodePage=866
|
||||||
|
AutoLF=Off
|
||||||
|
TextScaleMode=Off
|
||||||
|
CharacterSet=Graphics
|
||||||
|
International=USA
|
||||||
|
BJLEND
|
||||||
|
EOF2
|
||||||
|
|
||||||
|
printf "\033[K\00200\037" | tr 0 "\0"
|
||||||
|
|
||||||
|
cat << EOF3
|
||||||
|
BJLSTART
|
||||||
|
@SetControlMode=LQ
|
||||||
|
BJLEND
|
||||||
|
EOF3
|
||||||
|
|
||||||
|
printf "\033[K\00200\037" | tr 0 "\0"
|
||||||
|
|
||||||
|
cat << EOF4
|
||||||
|
BJLSTART
|
||||||
|
ControlMode=Common
|
||||||
|
PrintMode=HQ
|
||||||
|
Reduction=On
|
||||||
|
Smoothing=On
|
||||||
|
PaperSelect=A4
|
||||||
|
I/D-Buffer=Input
|
||||||
|
AutoPowerOff=10
|
||||||
|
AutoPowerOn=Enable
|
||||||
|
BJLEND
|
||||||
|
EOF4
|
||||||
|
|
||||||
|
exec /usr/libexec/lpr/ru/koi2alt $*
|
101
usr.sbin/lpr/filters.ru/koi2alt.c
Normal file
101
usr.sbin/lpr/filters.ru/koi2alt.c
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 1993-98 by Andrey A. Chernov, Moscow, Russia.
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* KOI8-R -> CP866 conversion filter (Russian character sets)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
int length = 66;
|
||||||
|
int lines;
|
||||||
|
|
||||||
|
char *koi2alt[] = {
|
||||||
|
/* 0 1 2 3 4 5 6 7 */
|
||||||
|
/* 8 9 A B C D E F */
|
||||||
|
/* 8 */ "\xc4","\xb3","\xda","\xbf","\xc0","\xd9","\xc3","\xb4",
|
||||||
|
"\xc2","\xc1","\xc5","\xdf","\xdc","\xdb","\xdd","\xde",
|
||||||
|
/* 9 */ "\xb0","\xb1","\xb2","\xb3","\xfe","\xf9","\xfb","-\b~",
|
||||||
|
"<\b_",">\b_","\xff","\xb3","\xf8","2\b-","\xfa",":\b-",
|
||||||
|
/* A */ "\xcd","\xba","\xd5","\xf1","\xd6","\xc9","\xb8","\xb7",
|
||||||
|
"\xbb","\xd4","\xd3","\xc8","\xbe","\xbd","\xbc","\xc6",
|
||||||
|
/* B */ "\xc7","\xcc","\xb5","\xf0","\xb6","\xb9","\xd1","\xd2",
|
||||||
|
"\xcb","\xcf","\xd0","\xca","\xd8","\xd7","\xce","c\b_",
|
||||||
|
/* C */ "\xee","\xa0","\xa1","\xe6","\xa4","\xa5","\xe4","\xa3",
|
||||||
|
"\xe5","\xa8","\xa9","\xaa","\xab","\xac","\xad","\xae",
|
||||||
|
/* D */ "\xaf","\xef","\xe0","\xe1","\xe2","\xe3","\xa6","\xa2",
|
||||||
|
"\xec","\xeb","\xa7","\xe8","\xed","\xe9","\xe7","\xea",
|
||||||
|
/* E */ "\x9e","\x80","\x81","\x96","\x84","\x85","\x94","\x83",
|
||||||
|
"\x95","\x88","\x89","\x8a","\x8b","\x8c","\x8d","\x8e",
|
||||||
|
/* F */ "\x8f","\x9f","\x90","\x91","\x92","\x93","\x86","\x82",
|
||||||
|
"\x9c","\x9b","\x87","\x98","\x9d","\x99","\x97","\x9a"
|
||||||
|
};
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
int c, i;
|
||||||
|
char *cp;
|
||||||
|
|
||||||
|
while (--argc) {
|
||||||
|
if (*(cp = *++argv) == '-') {
|
||||||
|
switch (*++cp) {
|
||||||
|
case 'l':
|
||||||
|
if ((i = atoi(++cp)) > 0)
|
||||||
|
length = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while ((c = getchar()) != EOF) {
|
||||||
|
if (c == '\031') {
|
||||||
|
if ((c = getchar()) == '\1') {
|
||||||
|
lines = 0;
|
||||||
|
fflush(stdout);
|
||||||
|
kill(getpid(), SIGSTOP);
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
ungetc(c, stdin);
|
||||||
|
c = '\031';
|
||||||
|
}
|
||||||
|
} else if (c & 0x80) {
|
||||||
|
fputs(koi2alt[c & 0x7F], stdout);
|
||||||
|
continue;
|
||||||
|
} else if (c == '\n')
|
||||||
|
lines++;
|
||||||
|
else if (c == '\f')
|
||||||
|
lines = length;
|
||||||
|
putchar(c);
|
||||||
|
if (lines >= length) {
|
||||||
|
lines = 0;
|
||||||
|
fflush(stdout);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
101
usr.sbin/lpr/filters.ru/koi2alt/koi2alt.c
Normal file
101
usr.sbin/lpr/filters.ru/koi2alt/koi2alt.c
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 1993-98 by Andrey A. Chernov, Moscow, Russia.
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* KOI8-R -> CP866 conversion filter (Russian character sets)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
int length = 66;
|
||||||
|
int lines;
|
||||||
|
|
||||||
|
char *koi2alt[] = {
|
||||||
|
/* 0 1 2 3 4 5 6 7 */
|
||||||
|
/* 8 9 A B C D E F */
|
||||||
|
/* 8 */ "\xc4","\xb3","\xda","\xbf","\xc0","\xd9","\xc3","\xb4",
|
||||||
|
"\xc2","\xc1","\xc5","\xdf","\xdc","\xdb","\xdd","\xde",
|
||||||
|
/* 9 */ "\xb0","\xb1","\xb2","\xb3","\xfe","\xf9","\xfb","-\b~",
|
||||||
|
"<\b_",">\b_","\xff","\xb3","\xf8","2\b-","\xfa",":\b-",
|
||||||
|
/* A */ "\xcd","\xba","\xd5","\xf1","\xd6","\xc9","\xb8","\xb7",
|
||||||
|
"\xbb","\xd4","\xd3","\xc8","\xbe","\xbd","\xbc","\xc6",
|
||||||
|
/* B */ "\xc7","\xcc","\xb5","\xf0","\xb6","\xb9","\xd1","\xd2",
|
||||||
|
"\xcb","\xcf","\xd0","\xca","\xd8","\xd7","\xce","c\b_",
|
||||||
|
/* C */ "\xee","\xa0","\xa1","\xe6","\xa4","\xa5","\xe4","\xa3",
|
||||||
|
"\xe5","\xa8","\xa9","\xaa","\xab","\xac","\xad","\xae",
|
||||||
|
/* D */ "\xaf","\xef","\xe0","\xe1","\xe2","\xe3","\xa6","\xa2",
|
||||||
|
"\xec","\xeb","\xa7","\xe8","\xed","\xe9","\xe7","\xea",
|
||||||
|
/* E */ "\x9e","\x80","\x81","\x96","\x84","\x85","\x94","\x83",
|
||||||
|
"\x95","\x88","\x89","\x8a","\x8b","\x8c","\x8d","\x8e",
|
||||||
|
/* F */ "\x8f","\x9f","\x90","\x91","\x92","\x93","\x86","\x82",
|
||||||
|
"\x9c","\x9b","\x87","\x98","\x9d","\x99","\x97","\x9a"
|
||||||
|
};
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
int c, i;
|
||||||
|
char *cp;
|
||||||
|
|
||||||
|
while (--argc) {
|
||||||
|
if (*(cp = *++argv) == '-') {
|
||||||
|
switch (*++cp) {
|
||||||
|
case 'l':
|
||||||
|
if ((i = atoi(++cp)) > 0)
|
||||||
|
length = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while ((c = getchar()) != EOF) {
|
||||||
|
if (c == '\031') {
|
||||||
|
if ((c = getchar()) == '\1') {
|
||||||
|
lines = 0;
|
||||||
|
fflush(stdout);
|
||||||
|
kill(getpid(), SIGSTOP);
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
ungetc(c, stdin);
|
||||||
|
c = '\031';
|
||||||
|
}
|
||||||
|
} else if (c & 0x80) {
|
||||||
|
fputs(koi2alt[c & 0x7F], stdout);
|
||||||
|
continue;
|
||||||
|
} else if (c == '\n')
|
||||||
|
lines++;
|
||||||
|
else if (c == '\f')
|
||||||
|
lines = length;
|
||||||
|
putchar(c);
|
||||||
|
if (lines >= length) {
|
||||||
|
lines = 0;
|
||||||
|
fflush(stdout);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user