From 7016330cd29b36e50e7029badfc191ab84881f48 Mon Sep 17 00:00:00 2001 From: Alexey Gladkov Date: Thu, 21 May 2009 23:51:50 +0400 Subject: [PATCH] [BUILD] klibc port Signed-off-by: Alexey Gladkov --- configure.ac | 3 + m4/klibc.m4 | 96 +++++++++++ po/cat-id-tbl.c | 384 ++++++++++++++++++++++--------------------- src/Makefile.am | 34 ++-- src/analyze.c | 3 + src/analyze.l | 3 + src/clrunimap.c | 2 + src/dumpkeys.c | 3 +- src/fgconsole.c | 2 + src/findfile.c | 18 +++ src/getkeycodes.c | 3 +- src/getunimap.c | 3 +- src/kbd_mode.c | 4 +- src/klibc_compat.c | 28 ++++ src/klibc_compat.h | 19 +++ src/loadkeys.c | 439 +++++++++++++++++++++----------------------------- src/loadkeys.y | 3 +- src/loadunimap.c | 3 +- src/mapscrn.c | 5 +- src/nls.h | 2 + src/psffontop.c | 4 + src/psfxtable.c | 3 +- src/resizecons.c | 90 ++++++----- src/setfont.c | 5 +- src/setkeycodes.c | 3 +- src/setleds.c | 3 +- src/setlogcons.c | 2 + src/setmetamode.c | 3 +- src/setvesablank.c | 2 + src/showconsolefont.c | 3 +- src/showkey.c | 10 +- src/totextmode.c | 3 +- src/version.h | 8 +- src/xmalloc.c | 4 + 34 files changed, 680 insertions(+), 520 deletions(-) create mode 100644 m4/klibc.m4 create mode 100644 src/klibc_compat.c create mode 100644 src/klibc_compat.h diff --git a/configure.ac b/configure.ac index 6d85478..8e664bc 100644 --- a/configure.ac +++ b/configure.ac @@ -7,6 +7,9 @@ AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR([src/showkey.c]) AC_CONFIG_HEADERS(config.h) +m4_include(m4/klibc.m4) +AC_CHECK_KLIBC + # Checks for programs. AC_PROG_YACC AC_PROG_CC diff --git a/m4/klibc.m4 b/m4/klibc.m4 new file mode 100644 index 0000000..7d40c1b --- /dev/null +++ b/m4/klibc.m4 @@ -0,0 +1,96 @@ +# klibc.m4 serial 99 +## Copyright (C) 1995-2003 Free Software Foundation, Inc. +## This file is free software, distributed under the terms of the GNU +## General Public License. As a special exception to the GNU General +## Public License, this file may be distributed as part of a program +## that contains a configuration script generated by Autoconf, under +## the same distribution terms as the rest of that program. +## +## This file can can be used in projects which are not available under +## the GNU General Public License or the GNU Library General Public +## License but which still want to provide support for the GNU gettext +## functionality. +## Please note that the actual code of the KLIBC Library is partly covered +## by the GNU Library General Public License, and party copyrighted by the +## Regents of The University of California, and the rest is covered by a +## MIT style license. + +# Authors: +# Martin Schlemmer , 2005. + + +# AC_CHECK_KLIBC +# -------------- +# Check if the user wants KLIBC support enabled. If so, set KLIBC=yes and +# fill in KLIBC_PREFIX, KLIBC_BINDIR, KLIBC_SBINDIR, KLIBC_LIBDIR and +# KLIBC_INCLUDEDIR. CC is also set to the proper klcc executable. +# NOTE: This should be called before AC_PROG_CC, and before header, function +# or type checks. +AC_DEFUN([AC_CHECK_KLIBC], +[AC_BEFORE([$0], [AC_PROG_CC]) +AC_REQUIRE([AC_CANONICAL_HOST]) +AC_ARG_ENABLE([klibc], + [AS_HELP_STRING([--enable-klibc], + [Enable linking to klibc [no]. You need at + least klibc-1.0 or later for this. Set KLCC + to the absolute file name of klcc if not in + the PATH])], + [KLIBC=$enableval], [KLIBC=no]) +AC_ARG_ENABLE([klibc-layout], + [AS_HELP_STRING([--enable-klibc-layout], + [Enable installing binaries, libraries and + headers into the klibc prefix [yes] ])], + [if test "X$KLIBC" != Xno; then + KLIBC_LAYOUT=$enableval + else + KLIBC_LAYOUT=no + fi], + [if test "X$KLIBC" != Xno; then + KLIBC_LAYOUT=yes + else + KLIBC_LAYOUT=no + fi]) + +if test "X$KLIBC" != Xno; then + # Basic cross compiling support. I do not think it is wise to use + # AC_CHECK_TOOL, because if we are cross compiling, we do not want + # just 'klcc' to be returned ... + if test "${host_alias}" != "${build_alias}"; then + AC_CHECK_PROGS([KLCC], [${host_alias}-klcc], [no]) + else + AC_CHECK_PROGS([KLCC], [klcc], [no]) + fi + if test "X$KLCC" = Xno; then + AC_MSG_ERROR([cannot find klibc frontend 'klcc'!]) + fi + + CC="$KLCC" + CFLAGS="-Os -D__klibc__" + #AC_DEFINE(__klibc__, 1, [Enable linking to klibc]) + + KLIBC_KCROSS="$($KLCC -print-klibc-kcross 2>/dev/null)" + KLIBC_PREFIX="$($KLCC -print-klibc-prefix 2>/dev/null)" + KLIBC_BIN_DIR="$($KLCC -print-klibc-bindir 2>/dev/null)" + KLIBC_SBIN_DIR="${KLIBC_PREFIX}/${KLIBC_KCROSS}sbin" + KLIBC_LIB_DIR="$($KLCC -print-klibc-libdir 2>/dev/null)" + KLIBC_INCLUDE_DIR="$($KLCC -print-klibc-includedir 2>/dev/null)" + + if test "X$KLIBC_LAYOUT" != Xno; then + prefix="$KLIBC_PREFIX" + bindir="$KLIBC_BIN_DIR" + sbindir="$KLIBC_SBIN_DIR" + libdir="$KLIBC_LIB_DIR" + includedir="$KLIBC_INCLUDE_DIR" + fi + + # At least KLIBC_LIB_DIR should be valid, else klibc is too old or + # something went wrong + if test ! -d "$KLIBC_LIB_DIR"; then + AC_MSG_ERROR([your klibc installation is too old or not functional!]) + fi +fi + +AC_SUBST(KLIBC) +AM_CONDITIONAL(KLIBC, test "$KLIBC" != "no") +])# AC_CHECK_KLIBC + diff --git a/po/cat-id-tbl.c b/po/cat-id-tbl.c index 3588c55..2f8b24c 100644 --- a/po/cat-id-tbl.c +++ b/po/cat-id-tbl.c @@ -108,10 +108,9 @@ Usage:\n\ {"assuming iso-8859-3 %s\n", 60}, {"assuming iso-8859-4 %s\n", 61}, {"unknown keysym '%s'\n", 62}, - {"plus before %s ignored\n", 63}, - {"'%s' is not a function key symbol", 64}, - {"too many (%d) entries on one line", 65}, - {"too many key definitions on one line", 66}, + {"'%s' is not a function key symbol", 63}, + {"too many (%d) entries on one line", 64}, + {"too many key definitions on one line", 65}, {"\ loadkeys version %s\n\ \n\ @@ -127,8 +126,9 @@ Valid options are:\n\ -h --help display this help text\n\ -m --mktable output a \"defkeymap.c\" to stdout\n\ -s --clearstrings clear kernel string table\n\ - -u --unicode implicit conversion to Unicode\n\ - -v --verbose report the changes\n", 67}, + -u --unicode force conversion to Unicode\n\ + -v --verbose report the changes\n", 66}, + {"loadkeys: error reading keyboard mode\n", 67}, {"syntax error in map file\n", 68}, {"key bindings not changed\n", 69}, {"includes are nested too deeply", 70}, @@ -154,137 +154,133 @@ Valid options are:\n\ {"deallocate keymap %d\n", 90}, {"%s: could not deallocate keymap %d\n", 91}, {"%s: cannot deallocate or clear keymap\n", 92}, - {"%s: failed to restore keyboard mode\n", 93}, - {"\ -%s: warning: this map uses Unicode symbols, %s mode=%d\n\ - (perhaps you want to do `kbd_mode -u'?)\n", 94}, - {"failed to bind string '%s' to function %s\n", 95}, - {"failed to clear string %s\n", 96}, - {"too many compose definitions\n", 97}, - {"impossible error in do_constant", 98}, + {"failed to bind string '%s' to function %s\n", 93}, + {"failed to clear string %s\n", 94}, + {"too many compose definitions\n", 95}, + {"impossible error in do_constant", 96}, {"\ \n\ -Changed %d %s and %d %s.\n", 99}, - {"key", 100}, - {"keys", 101}, - {"string", 102}, - {"strings", 103}, - {"Loaded %d compose %s.\n", 104}, - {"definition", 105}, - {"definitions", 106}, - {"(No change in compose definitions.)\n", 107}, - {"loadkeys: don't know how to compose for %s\n", 108}, - {"Error writing map to file\n", 109}, +Changed %d %s and %d %s.\n", 97}, + {"key", 98}, + {"keys", 99}, + {"string", 100}, + {"strings", 101}, + {"Loaded %d compose %s.\n", 102}, + {"definition", 103}, + {"definitions", 104}, + {"(No change in compose definitions.)\n", 105}, + {"loadkeys: don't know how to compose for %s\n", 106}, + {"Error writing map to file\n", 107}, {"\ Usage:\n\ -\t%s [-C console] [-o map.orig]\n", 110}, - {"Bad input line: %s\n", 111}, - {"%s: Glyph number (0x%x) larger than font length\n", 112}, - {"%s: Bad end of range (0x%x)\n", 113}, - {"%s: Bad Unicode range corresponding to font position range 0x%x-0x%x\n", 114}, +\t%s [-C console] [-o map.orig]\n", 108}, + {"Bad input line: %s\n", 109}, + {"%s: Glyph number (0x%x) larger than font length\n", 110}, + {"%s: Bad end of range (0x%x)\n", 111}, + {"%s: Bad Unicode range corresponding to font position range 0x%x-0x%x\n", 112}, {"\ %s: Unicode range U+%x-U+%x not of the same length as font position range 0x%\ -x-0x%x\n", 115}, - {"%s: trailing junk (%s) ignored\n", 116}, - {"Loading unicode map from file %s\n", 117}, - {"%s: %s: Warning: line too long\n", 118}, +x-0x%x\n", 113}, + {"%s: trailing junk (%s) ignored\n", 114}, + {"Loading unicode map from file %s\n", 115}, + {"%s: %s: Warning: line too long\n", 116}, {"\ %s: not loading empty unimap\n\ -(if you insist: use option -f to override)\n", 119}, - {"entry", 120}, - {"entries", 121}, - {"Saved unicode map on `%s'\n", 122}, - {"Appended Unicode map\n", 123}, - {"usage: %s [-v] [-o map.orig] map-file\n", 124}, - {"mapscrn: cannot open map file _%s_\n", 125}, - {"Cannot stat map file", 126}, - {"Loading binary direct-to-font screen map from file %s\n", 127}, - {"Error reading map from file `%s'\n", 128}, - {"Loading binary unicode screen map from file %s\n", 129}, - {"Loading symbolic screen map from file %s\n", 130}, - {"Error parsing symbolic map from `%s', line %d\n", 131}, - {"Cannot read console map\n", 132}, - {"Saved screen map in `%s'\n", 133}, - {"openvt: %s: illegal vt number\n", 134}, - {"openvt: only root can use the -u flag.\n", 135}, - {"openvt: cannot find a free vt\n", 136}, - {"openvt: cannot check whether vt %d is free\n", 137}, - {" use `openvt -f' to force.\n", 138}, - {"openvt: vt %d is in use; command aborted\n", 139}, - {"openvt: Unable to open %s: %s\n", 140}, - {"openvt: Cannot open %s read/write (%s)\n", 141}, - {"openvt: using VT %s\n", 142}, - {"openvt: Unable to set new session (%s)\n", 143}, +(if you insist: use option -f to override)\n", 117}, + {"entry", 118}, + {"entries", 119}, + {"Saved unicode map on `%s'\n", 120}, + {"Appended Unicode map\n", 121}, + {"usage: %s [-v] [-o map.orig] map-file\n", 122}, + {"mapscrn: cannot open map file _%s_\n", 123}, + {"Cannot stat map file", 124}, + {"Loading binary direct-to-font screen map from file %s\n", 125}, + {"Error reading map from file `%s'\n", 126}, + {"Loading binary unicode screen map from file %s\n", 127}, + {"Loading symbolic screen map from file %s\n", 128}, + {"Error parsing symbolic map from `%s', line %d\n", 129}, + {"Cannot read console map\n", 130}, + {"Saved screen map in `%s'\n", 131}, + {"openvt: %s: illegal vt number\n", 132}, + {"openvt: only root can use the -u flag.\n", 133}, + {"openvt: cannot find a free vt\n", 134}, + {"openvt: cannot check whether vt %d is free\n", 135}, + {" use `openvt -f' to force.\n", 136}, + {"openvt: vt %d is in use; command aborted\n", 137}, + {"openvt: Unable to open %s: %s\n", 138}, + {"openvt: Cannot open %s read/write (%s)\n", 139}, + {"openvt: using VT %s\n", 140}, + {"openvt: Unable to set new session (%s)\n", 141}, {"\ \n\ -openvt: could not open %s R/W (%s)\n", 144}, +openvt: could not open %s R/W (%s)\n", 142}, {"\ \n\ -openvt: could not activate vt %d (%s)\n", 145}, +openvt: could not activate vt %d (%s)\n", 143}, {"\ \n\ -openvt: activation interrupted? (%s)\n", 146}, - {"openvt: could not deallocate console %d\n", 147}, - {"\ -Usage: openvt [-c vtnumber] [-f] [-l] [-u] [-s] [-v] [-w] -- command_line\n", 148}, - {"Couldn't find owner of current tty!\n", 149}, - {"%s: short ucs2 unicode table\n", 150}, - {"%s: short utf8 unicode table\n", 151}, - {"%s: bad utf8\n", 152}, - {"%s: unknown utf8 error\n", 153}, - {"%s: short unicode table\n", 154}, - {"%s: Error reading input font", 155}, - {"%s: Bad call of readpsffont\n", 156}, - {"%s: Unsupported psf file mode (%d)\n", 157}, - {"%s: Unsupported psf version (%d)\n", 158}, - {"%s: zero input font length?\n", 159}, - {"%s: zero input character size?\n", 160}, - {"%s: Input file: bad input length (%d)\n", 161}, - {"%s: Input file: trailing garbage\n", 162}, - {"appendunicode: illegal unicode %u\n", 163}, - {"Cannot write font file header", 164}, - {"Cannot write font file", 165}, - {"%s: Warning: line too long\n", 166}, - {"%s: Bad input line: %s\n", 167}, - {"%s: Glyph number (0x%lx) past end of font\n", 168}, - {"%s: Bad end of range (0x%lx)\n", 169}, +openvt: activation interrupted? (%s)\n", 144}, + {"openvt: could not deallocate console %d\n", 145}, + {"\ +Usage: openvt [-c vtnumber] [-f] [-l] [-u] [-s] [-v] [-w] -- command_line\n", 146}, + {"Couldn't find owner of current tty!\n", 147}, + {"%s: short ucs2 unicode table\n", 148}, + {"%s: short utf8 unicode table\n", 149}, + {"%s: bad utf8\n", 150}, + {"%s: unknown utf8 error\n", 151}, + {"%s: short unicode table\n", 152}, + {"%s: Error reading input font", 153}, + {"%s: Bad call of readpsffont\n", 154}, + {"%s: Unsupported psf file mode (%d)\n", 155}, + {"%s: Unsupported psf version (%d)\n", 156}, + {"%s: zero input font length?\n", 157}, + {"%s: zero input character size?\n", 158}, + {"%s: Input file: bad input length (%d)\n", 159}, + {"%s: Input file: trailing garbage\n", 160}, + {"appendunicode: illegal unicode %u\n", 161}, + {"Cannot write font file header", 162}, + {"Cannot write font file", 163}, + {"%s: Warning: line too long\n", 164}, + {"%s: Bad input line: %s\n", 165}, + {"%s: Glyph number (0x%lx) past end of font\n", 166}, + {"%s: Bad end of range (0x%lx)\n", 167}, {"\ %s: Corresponding to a range of font positions, there should be a Unicode \ -range\n", 170}, +range\n", 168}, {"\ Usage:\n\ -\t%s infont intable outfont\n", 171}, +\t%s infont intable outfont\n", 169}, {"\ Usage:\n\ -\t%s infont [outtable]\n", 172}, +\t%s infont [outtable]\n", 170}, {"\ Usage:\n\ -\t%s infont outfont\n", 173}, +\t%s infont outfont\n", 171}, {"\ Usage:\n\ -\t%s [-i infont] [-o outfont] [-it intable] [-ot outtable] [-nt]\n", 174}, - {"%s: Bad magic number on %s\n", 175}, - {"%s: psf file with unknown magic\n", 176}, - {"%s: input font does not have an index\n", 177}, - {"resizecons: cannot find videomode file %s\n", 178}, - {"Invalid number of lines\n", 179}, - {"Old mode: %dx%d New mode: %dx%d\n", 180}, - {"Old #scanlines: %d New #scanlines: %d Character height: %d\n", 181}, - {"resizecons: the command `%s' failed\n", 182}, - {"\ -resizecons: don't forget to change TERM (maybe to con%dx%d or linux-%dx%d)\n", 183}, +\t%s [-i infont] [-o outfont] [-it intable] [-ot outtable] [-nt]\n", 172}, + {"%s: Bad magic number on %s\n", 173}, + {"%s: psf file with unknown magic\n", 174}, + {"%s: input font does not have an index\n", 175}, + {"resizecons: cannot find videomode file %s\n", 176}, + {"Invalid number of lines\n", 177}, + {"Old mode: %dx%d New mode: %dx%d\n", 178}, + {"Old #scanlines: %d New #scanlines: %d Character height: %d\n", 179}, + {"resizecons: the command `%s' failed\n", 180}, + {"\ +resizecons: don't forget to change TERM (maybe to con%dx%d or linux-%dx%d)\n", 181}, {"\ resizecons:\n\ call is: resizecons COLSxROWS or: resizecons COLS ROWS\n\ or: resizecons -lines ROWS, with ROWS one of 25, 28, 30, 34, 36, 40, 44, 50, \ -60\n", 184}, - {"resizecons: cannot get I/O permissions.\n", 185}, - {"usage: screendump [n]\n", 186}, - {"Error reading %s\n", 187}, - {"couldn't read %s, and cannot ioctl dump\n", 188}, - {"couldn't read %s\n", 189}, - {"Strange ... screen is both %dx%d and %dx%d ??\n", 190}, - {"Error writing screendump\n", 191}, +60\n", 182}, + {"resizecons: cannot get I/O permissions.\n", 183}, + {"usage: screendump [n]\n", 184}, + {"Error reading %s\n", 185}, + {"couldn't read %s, and cannot ioctl dump\n", 186}, + {"couldn't read %s\n", 187}, + {"Strange ... screen is both %dx%d and %dx%d ??\n", 188}, + {"Error writing screendump\n", 189}, {"\ Usage: setfont [write-options] [-] [newfont..] [-m consolemap] [-u \ unicodemap]\n\ @@ -309,48 +305,48 @@ will be loaded and, in the case of consolemaps, activated.\n\ -v Be verbose.\n\ -C Indicate console device to be used.\n\ -V Print version and exit.\n\ -Files are loaded from the current directory or %s/*/.\n", 192}, - {"setfont: too many input files\n", 193}, +Files are loaded from the current directory or %s/*/.\n", 190}, + {"setfont: too many input files\n", 191}, {"\ setfont: cannot both restore from character ROM and from file. Font \ -unchanged.\n", 194}, - {"Bad character height %d\n", 195}, - {"Bad character width %d\n", 196}, - {"%s: font position 32 is nonblank\n", 197}, - {"%s: wiped it\n", 198}, - {"%s: background will look funny\n", 199}, - {"Loading %d-char %dx%d font from file %s\n", 200}, - {"Loading %d-char %dx%d font\n", 201}, - {"Loading %d-char %dx%d (%d) font from file %s\n", 202}, - {"Loading %d-char %dx%d (%d) font\n", 203}, - {"%s: bug in do_loadtable\n", 204}, - {"Loading Unicode mapping table...\n", 205}, - {"Cannot open font file %s\n", 206}, - {"When loading several fonts, all must be psf fonts - %s isn't\n", 207}, - {"Read %d-char %dx%d font from file %s\n", 208}, - {"When loading several fonts, all must have the same height\n", 209}, - {"When loading several fonts, all must have the same width\n", 210}, - {"Cannot find default font\n", 211}, - {"Cannot find %s font\n", 212}, - {"Reading font file %s\n", 213}, - {"No final newline in combine file\n", 214}, - {"Too many files to combine\n", 215}, - {"Hmm - a font from restorefont? Using the first half.\n", 216}, - {"Bad input file size\n", 217}, +unchanged.\n", 192}, + {"Bad character height %d\n", 193}, + {"Bad character width %d\n", 194}, + {"%s: font position 32 is nonblank\n", 195}, + {"%s: wiped it\n", 196}, + {"%s: background will look funny\n", 197}, + {"Loading %d-char %dx%d font from file %s\n", 198}, + {"Loading %d-char %dx%d font\n", 199}, + {"Loading %d-char %dx%d (%d) font from file %s\n", 200}, + {"Loading %d-char %dx%d (%d) font\n", 201}, + {"%s: bug in do_loadtable\n", 202}, + {"Loading Unicode mapping table...\n", 203}, + {"Cannot open font file %s\n", 204}, + {"When loading several fonts, all must be psf fonts - %s isn't\n", 205}, + {"Read %d-char %dx%d font from file %s\n", 206}, + {"When loading several fonts, all must have the same height\n", 207}, + {"When loading several fonts, all must have the same width\n", 208}, + {"Cannot find default font\n", 209}, + {"Cannot find %s font\n", 210}, + {"Reading font file %s\n", 211}, + {"No final newline in combine file\n", 212}, + {"Too many files to combine\n", 213}, + {"Hmm - a font from restorefont? Using the first half.\n", 214}, + {"Bad input file size\n", 215}, {"\ This file contains 3 fonts: 8x8, 8x14 and 8x16. Please indicate\n\ -using an option -8 or -14 or -16 which one you want loaded.\n", 218}, - {"You asked for font size %d, but only 8, 14, 16 are possible here.\n", 219}, - {"Found nothing to save\n", 220}, - {"Saved %d-char %dx%d font file on %s\n", 221}, +using an option -8 or -14 or -16 which one you want loaded.\n", 216}, + {"You asked for font size %d, but only 8, 14, 16 are possible here.\n", 217}, + {"Found nothing to save\n", 218}, + {"Saved %d-char %dx%d font file on %s\n", 219}, {"\ usage: setkeycode scancode keycode ...\n\ (where scancode is either xx or e0xx, given in hexadecimal,\n\ - and keycode is given in decimal)\n", 222}, - {"even number of arguments expected", 223}, - {"error reading scancode", 224}, - {"code outside bounds", 225}, - {"failed to set scancode %x to keycode %d\n", 226}, + and keycode is given in decimal)\n", 220}, + {"even number of arguments expected", 221}, + {"error reading scancode", 222}, + {"code outside bounds", 223}, + {"failed to set scancode %x to keycode %d\n", 224}, {"\ Usage:\n\ \tsetleds [-v] [-L] [-D] [-F] [[+|-][ num | caps | scroll %s]]\n\ @@ -363,47 +359,47 @@ Normally, setleds influences the vt flag settings\n\ (and these are usually reflected in the leds).\n\ With -L, setleds only sets the leds, and leaves the flags alone.\n\ With -D, setleds sets both the flags and the default flags, so\n\ -that a subsequent reset will not change the flags.\n", 227}, - {"on ", 228}, - {"off", 229}, - {"Error reading current led setting. Maybe stdin is not a VT?\n", 230}, - {"\ -Error reading current flags setting. Maybe you are not on the console?\n", 231}, - {"Error reading current led setting from /dev/kbd.\n", 232}, - {"KIOCGLED unavailable?\n", 233}, - {"KIOCSLED unavailable?\n", 234}, - {"Error opening /dev/kbd.\n", 235}, - {"Error resetting ledmode\n", 236}, - {"Current default flags: ", 237}, - {"Current flags: ", 238}, - {"Current leds: ", 239}, +that a subsequent reset will not change the flags.\n", 225}, + {"on ", 226}, + {"off", 227}, + {"Error reading current led setting. Maybe stdin is not a VT?\n", 228}, + {"\ +Error reading current flags setting. Maybe you are not on the console?\n", 229}, + {"Error reading current led setting from /dev/kbd.\n", 230}, + {"KIOCGLED unavailable?\n", 231}, + {"KIOCSLED unavailable?\n", 232}, + {"Error opening /dev/kbd.\n", 233}, + {"Error resetting ledmode\n", 234}, + {"Current default flags: ", 235}, + {"Current flags: ", 236}, + {"Current leds: ", 237}, {"\ unrecognized argument: _%s_\n\ -\n", 240}, - {"Old default flags: ", 241}, - {"New default flags: ", 242}, - {"Old flags: ", 243}, - {"New flags: ", 244}, - {"Old leds: ", 245}, - {"New leds: ", 246}, +\n", 238}, + {"Old default flags: ", 239}, + {"New default flags: ", 240}, + {"Old flags: ", 241}, + {"New flags: ", 242}, + {"Old leds: ", 243}, + {"New leds: ", 244}, {"\ Usage:\n\ \tsetmetamode [ metabit | meta | bit | escprefix | esc | prefix ]\n\ Each vt has his own copy of this bit. Use\n\ \tsetmetamode [arg] < /dev/ttyn\n\ to change the settings of another vt.\n\ -The setting before and after the change are reported.\n", 247}, - {"Meta key sets high order bit\n", 248}, - {"Meta key gives Esc prefix\n", 249}, - {"Strange mode for Meta key?\n", 250}, - {"Error reading current setting. Maybe stdin is not a VT?\n", 251}, - {"old state: ", 252}, - {"new state: ", 253}, - {"usage: %s\n", 254}, - {"failed to restore original translation table\n", 255}, - {"failed to restore original unimap\n", 256}, - {"cannot change translation table\n", 257}, - {"%s: out of memory?\n", 258}, +The setting before and after the change are reported.\n", 245}, + {"Meta key sets high order bit\n", 246}, + {"Meta key gives Esc prefix\n", 247}, + {"Strange mode for Meta key?\n", 248}, + {"Error reading current setting. Maybe stdin is not a VT?\n", 249}, + {"old state: ", 250}, + {"new state: ", 251}, + {"usage: %s\n", 252}, + {"failed to restore original translation table\n", 253}, + {"failed to restore original unimap\n", 254}, + {"cannot change translation table\n", 255}, + {"%s: out of memory?\n", 256}, {"\ usage: showconsolefont -V|--version\n\ showconsolefont [-C tty] [-v] [-i]\n\ @@ -413,19 +409,19 @@ Valid options are:\n\ -C tty Device to read the font from. Default: current tty.\n\ -v Be more verbose.\n\ -i Don't print out the font table, just show\n\ - ROWSxCOLSxCOUNT and exit.\n", 259}, - {"Character count: %d\n", 260}, - {"Font width : %d\n", 261}, - {"Font height : %d\n", 262}, + ROWSxCOLSxCOUNT and exit.\n", 257}, + {"Character count: %d\n", 258}, + {"Font width : %d\n", 259}, + {"Font height : %d\n", 260}, {"\ Showing %d-char font\n\ -\n", 263}, - {"?UNKNOWN?", 264}, - {"kb mode was %s\n", 265}, +\n", 261}, + {"?UNKNOWN?", 262}, + {"kb mode was %s\n", 263}, {"\ [ if you are trying this under X, it might not work\n\ -since the X server is also reading /dev/console ]\n", 266}, - {"caught signal %d, cleaning up...\n", 267}, +since the X server is also reading /dev/console ]\n", 264}, + {"caught signal %d, cleaning up...\n", 265}, {"\ showkey version %s\n\ \n\ @@ -436,16 +432,16 @@ valid options are:\n\ \t-h --help\tdisplay this help text\n\ \t-a --ascii\tdisplay the decimal/octal/hex values of the keys\n\ \t-s --scancodes\tdisplay only the raw scan-codes\n\ -\t-k --keycodes\tdisplay only the interpreted keycodes (default)\n", 268}, +\t-k --keycodes\tdisplay only the interpreted keycodes (default)\n", 266}, {"\ \n\ Press any keys - Ctrl-D will terminate this program\n\ -\n", 269}, - {"press any key (program terminates 10s after last keypress)...\n", 270}, - {"release", 271}, - {"press", 272}, - {"keycode %3d %s\n", 273}, - {"%s from %s\n", 274}, +\n", 267}, + {"press any key (program terminates 10s after last keypress)...\n", 268}, + {"release", 269}, + {"press", 270}, + {"keycode %3d %s\n", 271}, + {"%s from %s\n", 272}, }; -int _msg_tbl_length = 274; +int _msg_tbl_length = 272; diff --git a/src/Makefile.am b/src/Makefile.am index 9d2d074..99a52f1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -2,7 +2,11 @@ WERROR = -Werror WARNINGS = -Wall -Wextra -Wmissing-noreturn -Wdisabled-optimization \ -Wcast-align -Wshadow -Wmissing-format-attribute -Wmissing-prototypes \ - -Wstrict-prototypes -Wmissing-declarations $(WERROR) + -Wstrict-prototypes -Wmissing-declarations + +if ! KLIBC +WARNINGS += $(WERROR) +endif AM_CPPFLAGS = -DDATADIR=\"$(datadir)\" -DLOCALEDIR=\"$(localedir)\" $(WARNINGS) \ -funit-at-a-time @@ -10,8 +14,11 @@ AM_CPPFLAGS = -DDATADIR=\"$(datadir)\" -DLOCALEDIR=\"$(localedir)\" $(WARNINGS) OLDPROGS = mapscrn loadunimap PROGS = \ dumpkeys loadkeys showkey setfont showconsolefont \ - setleds setmetamode kbd_mode chvt deallocvt \ - psfxtable kbdrate fgconsole openvt + setleds setmetamode kbd_mode psfxtable fgconsole + +if ! KLIBC +PROGS += kbdrate chvt deallocvt openvt +endif if KEYCODES_PROGS PROGS += getkeycodes setkeycodes @@ -23,8 +30,10 @@ endif if OPTIONAL_PROGS PROGS += \ - screendump setlogcons setvesablank spawn_console spawn_login \ - getunimap clrunimap outpsfheader setpalette + setlogcons setvesablank getunimap clrunimap outpsfheader setpalette +if ! KLIBC +PROGS += screendump spawn_console spawn_login +endif endif dist_bin_SCRIPTS = unicode_start unicode_stop @@ -44,6 +53,11 @@ PSF_S = psf.h psffontop.c psffontop.h UNIM_S = loadunimap.c loadunimap.h UTF8_S = utf8.c utf8.h XMAL_S = xmalloc.c xmalloc.h + +if KLIBC +KLIBC_S = klibc_compat.c klibc_compat.h +endif + chvt_SOURCES = $(ALL_S) chvt.c $(GETFD_S) clrunimap_SOURCES = $(ALL_S) clrunimap.c $(GETFD_S) $(KDMA_S) deallocvt_SOURCES = $(ALL_S) deallocvt.c $(GETFD_S) @@ -52,20 +66,20 @@ fgconsole_SOURCES = $(ALL_S) fgconsole.c $(GETFD_S) getkeycodes_SOURCES = $(ALL_S) getkeycodes.c $(GETFD_S) getunimap_SOURCES = $(ALL_S) getunimap.c $(GETFD_S) $(KDMA_S) kbd_mode_SOURCES = $(ALL_S) kbd_mode.c $(GETFD_S) -loadkeys_SOURCES = $(ALL_S) loadkeys.y $(GETFD_S) $(KSYMS_S) $(XMAL_S) $(FIND_S) -loadunimap_SOURCES = $(ALL_S) loadunimap.c $(FIND_S) $(PSF_S) $(UTF8_S) $(XMAL_S) $(GETFD_S) $(KDMA_S) +loadkeys_SOURCES = $(ALL_S) loadkeys.y $(GETFD_S) $(KSYMS_S) $(XMAL_S) $(FIND_S) $(KLIBC_S) +loadunimap_SOURCES = $(ALL_S) loadunimap.c $(FIND_S) $(PSF_S) $(UTF8_S) $(XMAL_S) $(GETFD_S) $(KDMA_S) $(KLIBC_S) mapscrn_SOURCES = $(ALL_S) mapscrn.c $(FIND_S) $(UTF8_S) $(XMAL_S) $(GETFD_S) $(KDMA_S) openvt_SOURCES = $(ALL_S) openvt.c openvt.h $(GETFD_S) -psfxtable_SOURCES = $(ALL_S) psfxtable.c $(PSF_S) $(XMAL_S) $(UTF8_S) $(GETFD_S) +psfxtable_SOURCES = $(ALL_S) psfxtable.c $(PSF_S) $(XMAL_S) $(UTF8_S) $(GETFD_S) $(KLIBC_S) resizecons_SOURCES = $(ALL_S) resizecons.c $(GETFD_S) $(FIND_S) $(XMAL_S) screendump_SOURCES = $(ALL_S) screendump.c $(XMAL_S) -setfont_SOURCES = $(ALL_S) setfont.c $(FIND_S) $(XMAL_S) $(GETFD_S) mapscrn.c $(KDMA_S) $(PSF_S) $(UTF8_S) kdfontop.c kdfontop.h $(UNIM_S) +setfont_SOURCES = $(ALL_S) setfont.c $(FIND_S) $(XMAL_S) $(GETFD_S) mapscrn.c $(KDMA_S) $(PSF_S) $(UTF8_S) kdfontop.c kdfontop.h $(UNIM_S) $(KLIBC_S) setkeycodes_SOURCES = $(ALL_S) setkeycodes.c $(GETFD_S) setlogcons_SOURCES = $(ALL_S) setlogcons.c $(GETFD_S) setpalette_SOURCES = $(ALL_S) setpalette.c $(GETFD_S) setvesablank_SOURCES = $(ALL_S) setvesablank.c $(GETFD_S) showconsolefont_SOURCES = $(ALL_S) showconsolefont.c $(GETFD_S) $(XMAL_S) $(KDMA_S) kdfontop.c kdfontop.h -showkey_SOURCES = $(ALL_S) showkey.c $(GETFD_S) +showkey_SOURCES = $(ALL_S) showkey.c $(GETFD_S) $(KLIBC_S) mapscrn_CFLAGS = -DMAIN loadunimap_CFLAGS = -DMAIN diff --git a/src/analyze.c b/src/analyze.c index 3d7e258..c9b0b07 100644 --- a/src/analyze.c +++ b/src/analyze.c @@ -805,6 +805,9 @@ char *yytext; #include "ksyms.h" #include "kbd.h" #include "xmalloc.h" +#ifdef __klibc__ +#include "klibc_compat.h" +#endif extern int line_nr; int yylval; diff --git a/src/analyze.l b/src/analyze.l index b231564..dab17a7 100644 --- a/src/analyze.l +++ b/src/analyze.l @@ -8,6 +8,9 @@ #include "ksyms.h" #include "kbd.h" #include "xmalloc.h" +#ifdef __klibc__ +#include "klibc_compat.h" +#endif extern int line_nr; int yylval; diff --git a/src/clrunimap.c b/src/clrunimap.c index 63d162f..74c9311 100644 --- a/src/clrunimap.c +++ b/src/clrunimap.c @@ -18,9 +18,11 @@ main(int argc, char *argv[]) { int fd; char *console = NULL; +#ifndef __klibc__ setlocale(LC_ALL, ""); bindtextdomain(PACKAGE_NAME, LOCALEDIR); textdomain(PACKAGE_NAME); +#endif if (argc >= 3 && !strcmp(argv[1], "-C")) console = argv[2]; diff --git a/src/dumpkeys.c b/src/dumpkeys.c index 30900a5..12cdafe 100644 --- a/src/dumpkeys.c +++ b/src/dumpkeys.c @@ -605,10 +605,11 @@ main (int argc, char *argv[]) { char diac_only = 0; set_progname(argv[0]); - +#ifndef __klibc__ setlocale(LC_ALL, ""); bindtextdomain(PACKAGE_NAME, LOCALEDIR); textdomain(PACKAGE_NAME); +#endif while ((c = getopt_long(argc, argv, short_opts, long_opts, NULL)) != -1) { diff --git a/src/fgconsole.c b/src/fgconsole.c index 268bfda..bb860e8 100644 --- a/src/fgconsole.c +++ b/src/fgconsole.c @@ -38,9 +38,11 @@ main(int argc, char **argv){ { "next-available", no_argument, NULL, 'n' }, { NULL, 0, NULL, 0 } }; +#ifndef __klibc__ setlocale(LC_ALL, ""); bindtextdomain(PACKAGE_NAME, LOCALEDIR); textdomain(PACKAGE_NAME); +#endif set_progname(argv[0]); while (( c = getopt_long (argc, argv, "Vhn", long_opts, NULL)) != EOF) { diff --git a/src/findfile.c b/src/findfile.c index 4a1eff2..8f9b327 100644 --- a/src/findfile.c +++ b/src/findfile.c @@ -13,14 +13,17 @@ char pathname[1024]; static int ispipe; void fpclose(FILE *fp) { +#ifndef __klibc__ if (ispipe) pclose(fp); else +#endif /* __klibc__ */ fclose(fp); } #define SIZE(a) (sizeof(a)/sizeof(a[0])) +#ifndef __klibc__ static struct decompressor { char *ext; /* starts with `.', has no other dots */ char *cmd; @@ -43,12 +46,14 @@ pipe_open(struct decompressor *dc) { fprintf(stderr, _("error executing %s\n"), pipe_cmd); return fp; } +#endif /* __klibc__ */ /* If a file PATHNAME exists, then open it. If is has a `compressed' extension, then open a pipe reading it */ static FILE * maybe_pipe_open(void) { FILE *fp; +#ifndef __klibc__ char *t; struct decompressor *dc; @@ -62,6 +67,9 @@ maybe_pipe_open(void) { } } } +#else + fp = fopen(pathname, "r"); +#endif /* __klibc__ */ return fp; } @@ -71,7 +79,9 @@ findfile_in_dir(char *fnam, char *dir, int recdepth, char **suf) { DIR *d; struct dirent *de; char *ff, *fdir, *p, *q, **sp; +#ifndef __klibc__ struct decompressor *dc; +#endif /* __klibc__ */ int secondpass = 0; ispipe = 0; @@ -142,17 +152,21 @@ findfile_in_dir(char *fnam, char *dir, int recdepth, char **suf) { /* Does tail consist of a known suffix and possibly a compression suffix? */ for(sp = suf; *sp; sp++) { +#ifndef __klibc__ int l; +#endif /* __klibc__ */ if (!strcmp(p, *sp)) return maybe_pipe_open(); +#ifndef __klibc__ l = strlen(*sp); if (strncmp(p,*sp,l) == 0) { for (dc = &decompressors[0]; dc->cmd; dc++) if (strcmp(p+l, dc->ext) == 0) return pipe_open(dc); } +#endif /* __klibc__ */ } } closedir(d); @@ -168,7 +182,9 @@ FILE *findfile(char *fnam, char **dirpath, char **suffixes) { char **dp, *dir, **sp; FILE *fp; int dl, recdepth; +#ifndef __klibc__ struct decompressor *dc; +#endif /* __klibc__ */ if (strlen(fnam) >= sizeof(pathname)) return NULL; @@ -195,6 +211,7 @@ FILE *findfile(char *fnam, char **dirpath, char **suffixes) { return fp; } +#ifndef __klibc__ for (sp = suffixes; *sp; sp++) { for (dc = &decompressors[0]; dc->cmd; dc++) { if (strlen(fnam) + strlen(*sp) @@ -209,6 +226,7 @@ FILE *findfile(char *fnam, char **dirpath, char **suffixes) { } } } +#endif /* __klibc__ */ return NULL; } diff --git a/src/getkeycodes.c b/src/getkeycodes.c index 9bee144..6504e7e 100644 --- a/src/getkeycodes.c +++ b/src/getkeycodes.c @@ -27,10 +27,11 @@ main(int argc, char **argv) { int old_kernel = 0; set_progname(argv[0]); - +#ifndef __klibc__ setlocale(LC_ALL, ""); bindtextdomain(PACKAGE_NAME, LOCALEDIR); textdomain(PACKAGE_NAME); +#endif if (argc == 2 && !strcmp(argv[1], "-V")) print_version_and_exit(); diff --git a/src/getunimap.c b/src/getunimap.c index e36326d..0097d5f 100644 --- a/src/getunimap.c +++ b/src/getunimap.c @@ -40,10 +40,11 @@ main(int argc, char **argv){ struct unimapdesc ud; set_progname(argv[0]); - +#ifndef __klibc__ setlocale(LC_ALL, ""); bindtextdomain(PACKAGE_NAME, LOCALEDIR); textdomain(PACKAGE_NAME); +#endif if (argc == 2 && (!strcmp(argv[1], "-V") || !strcmp(argv[1], "--version"))) diff --git a/src/kbd_mode.c b/src/kbd_mode.c index bc51e06..b286678 100644 --- a/src/kbd_mode.c +++ b/src/kbd_mode.c @@ -4,6 +4,7 @@ * If you make \215A\201 an alias for "kbd_mode -a", and you are * in raw mode, then hitting F7 = (two keys) will return you to sanity. */ + #include #include #include @@ -26,10 +27,11 @@ main(int argc, char *argv[]){ char *console = NULL; set_progname(argv[0]); - +#ifndef __klibc__ setlocale(LC_ALL, ""); bindtextdomain(PACKAGE_NAME, LOCALEDIR); textdomain(PACKAGE_NAME); +#endif if (argc == 2 && !strcmp(argv[1], "-V")) print_version_and_exit(); diff --git a/src/klibc_compat.c b/src/klibc_compat.c new file mode 100644 index 0000000..c8c994e --- /dev/null +++ b/src/klibc_compat.c @@ -0,0 +1,28 @@ +#include +#include +#include "kbd.h" +#include "klibc_compat.h" + +void clearerr(attr_unused FILE *stream) { + errno = 0; +} + +void rewind(FILE *stream) { + (void)fseek(stream, 0L, SEEK_SET); + clearerr(stream); +} + +int feof(attr_unused FILE *stream) { + return (errno == EOF); +} + +int ferror(attr_unused FILE *stream) { + return (errno != 0 && errno != EOF); +} + +int ungetc(int c, FILE *stream) { + if (fseek(stream, -1, SEEK_CUR) < 0) + return EOF; + else + return c; +} diff --git a/src/klibc_compat.h b/src/klibc_compat.h new file mode 100644 index 0000000..9e14bca --- /dev/null +++ b/src/klibc_compat.h @@ -0,0 +1,19 @@ +#ifdef __klibc__ +#ifndef _KLIBC_COMPAT_H +#define _KLIBC_COMPAT_H + +#undef _MALLOC_H +#undef malloc +#undef realloc +#include + +#define signal sysv_signal + +extern void clearerr(FILE *stream); +extern void rewind(FILE *stream); +extern int feof(FILE *stream); +extern int ferror(FILE *stream); +extern int ungetc(int c, FILE *stream); + +#endif +#endif /* __klibc__ */ diff --git a/src/loadkeys.c b/src/loadkeys.c index e2c0c7b..c90a0e4 100644 --- a/src/loadkeys.c +++ b/src/loadkeys.c @@ -1,23 +1,24 @@ - -/* A Bison parser, made by GNU Bison 2.4.1. */ +/* A Bison parser, made by GNU Bison 2.3. */ /* Skeleton implementation for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify + + This program 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 3 of the License, or - (at your option) any later version. - + the Free Software Foundation; either version 2, or (at your option) + any later version. + This program 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, see . */ + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -28,7 +29,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -46,7 +47,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.4.1" +#define YYBISON_VERSION "2.3" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -54,20 +55,91 @@ /* Pure parsers. */ #define YYPURE 0 -/* Push parsers. */ -#define YYPUSH 0 - -/* Pull parsers. */ -#define YYPULL 1 - /* Using locations. */ #define YYLSP_NEEDED 0 -/* Copy the first part of user declarations. */ +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + EOL = 258, + NUMBER = 259, + LITERAL = 260, + CHARSET = 261, + KEYMAPS = 262, + KEYCODE = 263, + EQUALS = 264, + PLAIN = 265, + SHIFT = 266, + CONTROL = 267, + ALT = 268, + ALTGR = 269, + SHIFTL = 270, + SHIFTR = 271, + CTRLL = 272, + CTRLR = 273, + CAPSSHIFT = 274, + COMMA = 275, + DASH = 276, + STRING = 277, + STRLITERAL = 278, + COMPOSE = 279, + TO = 280, + CCHAR = 281, + ERROR = 282, + PLUS = 283, + UNUMBER = 284, + ALT_IS_META = 285, + STRINGS = 286, + AS = 287, + USUAL = 288, + ON = 289, + FOR = 290 + }; +#endif +/* Tokens. */ +#define EOL 258 +#define NUMBER 259 +#define LITERAL 260 +#define CHARSET 261 +#define KEYMAPS 262 +#define KEYCODE 263 +#define EQUALS 264 +#define PLAIN 265 +#define SHIFT 266 +#define CONTROL 267 +#define ALT 268 +#define ALTGR 269 +#define SHIFTL 270 +#define SHIFTR 271 +#define CTRLL 272 +#define CTRLR 273 +#define CAPSSHIFT 274 +#define COMMA 275 +#define DASH 276 +#define STRING 277 +#define STRLITERAL 278 +#define COMPOSE 279 +#define TO 280 +#define CCHAR 281 +#define ERROR 282 +#define PLUS 283 +#define UNUMBER 284 +#define ALT_IS_META 285 +#define STRINGS 286 +#define AS 287 +#define USUAL 288 +#define ON 289 +#define FOR 290 + + + -/* Line 189 of yacc.c */ +/* Copy the first part of user declarations. */ #line 12 "loadkeys.y" #include @@ -162,9 +234,6 @@ FILE *find_incl_file(char *s); int yylex (void); -/* Line 189 of yacc.c */ -#line 167 "loadkeys.c" - /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 0 @@ -183,99 +252,20 @@ int yylex (void); # define YYTOKEN_TABLE 0 #endif - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - EOL = 258, - NUMBER = 259, - LITERAL = 260, - CHARSET = 261, - KEYMAPS = 262, - KEYCODE = 263, - EQUALS = 264, - PLAIN = 265, - SHIFT = 266, - CONTROL = 267, - ALT = 268, - ALTGR = 269, - SHIFTL = 270, - SHIFTR = 271, - CTRLL = 272, - CTRLR = 273, - CAPSSHIFT = 274, - COMMA = 275, - DASH = 276, - STRING = 277, - STRLITERAL = 278, - COMPOSE = 279, - TO = 280, - CCHAR = 281, - ERROR = 282, - PLUS = 283, - UNUMBER = 284, - ALT_IS_META = 285, - STRINGS = 286, - AS = 287, - USUAL = 288, - ON = 289, - FOR = 290 - }; -#endif -/* Tokens. */ -#define EOL 258 -#define NUMBER 259 -#define LITERAL 260 -#define CHARSET 261 -#define KEYMAPS 262 -#define KEYCODE 263 -#define EQUALS 264 -#define PLAIN 265 -#define SHIFT 266 -#define CONTROL 267 -#define ALT 268 -#define ALTGR 269 -#define SHIFTL 270 -#define SHIFTR 271 -#define CTRLL 272 -#define CTRLR 273 -#define CAPSSHIFT 274 -#define COMMA 275 -#define DASH 276 -#define STRING 277 -#define STRLITERAL 278 -#define COMPOSE 279 -#define TO 280 -#define CCHAR 281 -#define ERROR 282 -#define PLUS 283 -#define UNUMBER 284 -#define ALT_IS_META 285 -#define STRINGS 286 -#define AS 287 -#define USUAL 288 -#define ON 289 -#define FOR 290 - - - - #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef int YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 #endif + /* Copy the second part of user declarations. */ -/* Line 264 of yacc.c */ -#line 279 "loadkeys.c" +/* Line 216 of yacc.c. */ +#line 269 "loadkeys.c" #ifdef short # undef short @@ -350,14 +340,14 @@ typedef short int yytype_int16; #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int -YYID (int yyi) +YYID (int i) #else static int -YYID (yyi) - int yyi; +YYID (i) + int i; #endif { - return yyi; + return i; } #endif @@ -438,9 +428,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss_alloc; - YYSTYPE yyvs_alloc; -}; + yytype_int16 yyss; + YYSTYPE yyvs; + }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) @@ -474,12 +464,12 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ +# define YYSTACK_RELOCATE(Stack) \ do \ { \ YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ - Stack = &yyptr->Stack_alloc; \ + YYCOPY (&yyptr->Stack, Stack, yysize); \ + Stack = &yyptr->Stack; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ @@ -601,7 +591,7 @@ static const char *const yytname[] = "PLUS", "UNUMBER", "ALT_IS_META", "STRINGS", "AS", "USUAL", "ON", "FOR", "$accept", "keytable", "line", "charsetline", "altismetaline", "usualstringsline", "usualcomposeline", "keymapline", "range", "range0", - "strline", "compline", "singleline", "$@1", "modifiers", "modifier", + "strline", "compline", "singleline", "@1", "modifiers", "modifier", "fullline", "rvalue0", "rvalue1", "rvalue", 0 }; #endif @@ -914,20 +904,17 @@ yy_symbol_print (yyoutput, yytype, yyvaluep) #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) #else static void -yy_stack_print (yybottom, yytop) - yytype_int16 *yybottom; - yytype_int16 *yytop; +yy_stack_print (bottom, top) + yytype_int16 *bottom; + yytype_int16 *top; #endif { YYFPRINTF (stderr, "Stack now"); - for (; yybottom <= yytop; yybottom++) - { - int yybot = *yybottom; - YYFPRINTF (stderr, " %d", yybot); - } + for (; bottom <= top; ++bottom) + YYFPRINTF (stderr, " %d", *bottom); YYFPRINTF (stderr, "\n"); } @@ -961,11 +948,11 @@ yy_reduce_print (yyvsp, yyrule) /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { - YYFPRINTF (stderr, " $%d = ", yyi + 1); + fprintf (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) ); - YYFPRINTF (stderr, "\n"); + fprintf (stderr, "\n"); } } @@ -1245,8 +1232,10 @@ yydestruct (yymsg, yytype, yyvaluep) break; } } + /* Prevent warnings from -Wmissing-prototypes. */ + #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); @@ -1262,10 +1251,11 @@ int yyparse (); #endif /* ! YYPARSE_PARAM */ -/* The lookahead symbol. */ + +/* The look-ahead symbol. */ int yychar; -/* The semantic value of the lookahead symbol. */ +/* The semantic value of the look-ahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ @@ -1273,9 +1263,9 @@ int yynerrs; -/*-------------------------. -| yyparse or yypush_parse. | -`-------------------------*/ +/*----------. +| yyparse. | +`----------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ @@ -1299,68 +1289,66 @@ yyparse () #endif #endif { + + int yystate; + int yyn; + int yyresult; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + /* Look-ahead token as an internal (translated) token number. */ + int yytoken = 0; +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + /* Three stacks and their tools: + `yyss': related to states, + `yyvs': related to semantic values, + `yyls': related to locations. - int yystate; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ - /* The stacks and their tools: - `yyss': related to states. - `yyvs': related to semantic values. + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss = yyssa; + yytype_int16 *yyssp; - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; + YYSTYPE *yyvsp; - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss; - yytype_int16 *yyssp; - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs; - YYSTYPE *yyvsp; - YYSIZE_T yystacksize; +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + + YYSIZE_T yystacksize = YYINITDEPTH; - int yyn; - int yyresult; - /* Lookahead token as an internal (translated) token number. */ - int yytoken; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; - yytoken = 0; - yyss = yyssa; - yyvs = yyvsa; - yystacksize = YYINITDEPTH; - YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ + yyssp = yyss; yyvsp = yyvs; @@ -1390,6 +1378,7 @@ yyparse () YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; + /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might @@ -1397,6 +1386,7 @@ yyparse () yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); yyss = yyss1; @@ -1419,8 +1409,9 @@ yyparse () (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss_alloc, yyss); - YYSTACK_RELOCATE (yyvs_alloc, yyvs); + YYSTACK_RELOCATE (yyss); + YYSTACK_RELOCATE (yyvs); + # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); @@ -1431,6 +1422,7 @@ yyparse () yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; + YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); @@ -1440,9 +1432,6 @@ yyparse () YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - if (yystate == YYFINAL) - YYACCEPT; - goto yybackup; /*-----------. @@ -1451,16 +1440,16 @@ yyparse () yybackup: /* Do appropriate processing given the current state. Read a - lookahead token if we need one and don't already have one. */ + look-ahead token if we need one and don't already have one. */ - /* First try to decide what to do without reference to lookahead token. */ + /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a lookahead token if don't already have one. */ + /* Not known => get a look-ahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -1492,16 +1481,20 @@ yybackup: goto yyreduce; } + if (yyn == YYFINAL) + YYACCEPT; + /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; - /* Shift the lookahead token. */ + /* Shift the look-ahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the shifted token. */ - yychar = YYEMPTY; + /* Discard the shifted token unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; @@ -1541,8 +1534,6 @@ yyreduce: switch (yyn) { case 14: - -/* Line 1455 of yacc.c */ #line 121 "loadkeys.y" { set_charset((char *) kbs_buf.kb_string); @@ -1550,8 +1541,6 @@ yyreduce: break; case 15: - -/* Line 1455 of yacc.c */ #line 126 "loadkeys.y" { alt_is_meta = 1; @@ -1559,8 +1548,6 @@ yyreduce: break; case 16: - -/* Line 1455 of yacc.c */ #line 131 "loadkeys.y" { strings_as_usual(); @@ -1568,8 +1555,6 @@ yyreduce: break; case 17: - -/* Line 1455 of yacc.c */ #line 136 "loadkeys.y" { compose_as_usual((char *) kbs_buf.kb_string); @@ -1577,8 +1562,6 @@ yyreduce: break; case 18: - -/* Line 1455 of yacc.c */ #line 140 "loadkeys.y" { compose_as_usual(0); @@ -1586,8 +1569,6 @@ yyreduce: break; case 19: - -/* Line 1455 of yacc.c */ #line 145 "loadkeys.y" { keymaps_line_seen = 1; @@ -1595,8 +1576,6 @@ yyreduce: break; case 22: - -/* Line 1455 of yacc.c */ #line 153 "loadkeys.y" { int i; @@ -1606,8 +1585,6 @@ yyreduce: break; case 23: - -/* Line 1455 of yacc.c */ #line 159 "loadkeys.y" { addmap((yyvsp[(1) - (1)]),1); @@ -1615,8 +1592,6 @@ yyreduce: break; case 24: - -/* Line 1455 of yacc.c */ #line 164 "loadkeys.y" { if (KTYP((yyvsp[(2) - (5)])) != KT_FN) @@ -1628,8 +1603,6 @@ yyreduce: break; case 25: - -/* Line 1455 of yacc.c */ #line 173 "loadkeys.y" { compose((yyvsp[(2) - (6)]), (yyvsp[(3) - (6)]), (yyvsp[(5) - (6)])); @@ -1637,8 +1610,6 @@ yyreduce: break; case 26: - -/* Line 1455 of yacc.c */ #line 177 "loadkeys.y" { compose((yyvsp[(2) - (6)]), (yyvsp[(3) - (6)]), (yyvsp[(5) - (6)])); @@ -1646,15 +1617,11 @@ yyreduce: break; case 27: - -/* Line 1455 of yacc.c */ #line 181 "loadkeys.y" { mod = 0; } break; case 28: - -/* Line 1455 of yacc.c */ #line 183 "loadkeys.y" { addkey((yyvsp[(4) - (7)]), mod, (yyvsp[(6) - (7)])); @@ -1662,8 +1629,6 @@ yyreduce: break; case 29: - -/* Line 1455 of yacc.c */ #line 187 "loadkeys.y" { addkey((yyvsp[(3) - (6)]), 0, (yyvsp[(5) - (6)])); @@ -1671,71 +1636,51 @@ yyreduce: break; case 32: - -/* Line 1455 of yacc.c */ #line 194 "loadkeys.y" { mod |= M_SHIFT; } break; case 33: - -/* Line 1455 of yacc.c */ #line 195 "loadkeys.y" { mod |= M_CTRL; } break; case 34: - -/* Line 1455 of yacc.c */ #line 196 "loadkeys.y" { mod |= M_ALT; } break; case 35: - -/* Line 1455 of yacc.c */ #line 197 "loadkeys.y" { mod |= M_ALTGR; } break; case 36: - -/* Line 1455 of yacc.c */ #line 198 "loadkeys.y" { mod |= M_SHIFTL; } break; case 37: - -/* Line 1455 of yacc.c */ #line 199 "loadkeys.y" { mod |= M_SHIFTR; } break; case 38: - -/* Line 1455 of yacc.c */ #line 200 "loadkeys.y" { mod |= M_CTRLL; } break; case 39: - -/* Line 1455 of yacc.c */ #line 201 "loadkeys.y" { mod |= M_CTRLR; } break; case 40: - -/* Line 1455 of yacc.c */ #line 202 "loadkeys.y" { mod |= M_CAPSSHIFT; } break; case 41: - -/* Line 1455 of yacc.c */ #line 205 "loadkeys.y" { int i, j; @@ -1770,8 +1715,6 @@ yyreduce: break; case 44: - -/* Line 1455 of yacc.c */ #line 241 "loadkeys.y" { if (rvalct >= MAX_NR_KEYMAPS) @@ -1781,51 +1724,38 @@ yyreduce: break; case 45: - -/* Line 1455 of yacc.c */ #line 248 "loadkeys.y" {(yyval)=convert_code((yyvsp[(1) - (1)]), TO_AUTO);} break; case 46: - -/* Line 1455 of yacc.c */ #line 250 "loadkeys.y" {(yyval)=add_capslock((yyvsp[(2) - (2)]));} break; case 47: - -/* Line 1455 of yacc.c */ #line 252 "loadkeys.y" {(yyval)=convert_code((yyvsp[(1) - (1)])^0xf000, TO_AUTO);} break; case 48: - -/* Line 1455 of yacc.c */ #line 254 "loadkeys.y" {(yyval)=add_capslock((yyvsp[(2) - (2)])^0xf000);} break; case 49: - -/* Line 1455 of yacc.c */ #line 256 "loadkeys.y" {(yyval)=(yyvsp[(1) - (1)]);} break; case 50: - -/* Line 1455 of yacc.c */ #line 258 "loadkeys.y" {(yyval)=add_capslock((yyvsp[(2) - (2)]));} break; - -/* Line 1455 of yacc.c */ -#line 1829 "loadkeys.c" +/* Line 1267 of yacc.c. */ +#line 1759 "loadkeys.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -1836,6 +1766,7 @@ yyreduce: *++yyvsp = yyval; + /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ @@ -1900,7 +1831,7 @@ yyerrlab: if (yyerrstatus == 3) { - /* If just tried and failed to reuse lookahead token after an + /* If just tried and failed to reuse look-ahead token after an error, discard it. */ if (yychar <= YYEOF) @@ -1917,7 +1848,7 @@ yyerrlab: } } - /* Else will try to reuse lookahead token after shifting the error + /* Else will try to reuse look-ahead token after shifting the error token. */ goto yyerrlab1; @@ -1974,6 +1905,9 @@ yyerrlab1: YY_STACK_PRINT (yyss, yyssp); } + if (yyn == YYFINAL) + YYACCEPT; + *++yyvsp = yylval; @@ -1998,7 +1932,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#if !defined(yyoverflow) || YYERROR_VERBOSE +#ifndef yyoverflow /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -2009,7 +1943,7 @@ yyexhaustedlab: #endif yyreturn: - if (yychar != YYEMPTY) + if (yychar != YYEOF && yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); /* Do not reclaim the symbols of the rule which action triggered @@ -2035,8 +1969,6 @@ yyreturn: } - -/* Line 1675 of yacc.c */ #line 260 "loadkeys.y" @@ -2095,10 +2027,11 @@ main(int argc, char *argv[]) { char *console = NULL; set_progname(argv[0]); - +#ifndef __klibc__ setlocale(LC_ALL, ""); bindtextdomain(PACKAGE_NAME, LOCALEDIR); textdomain(PACKAGE_NAME); +#endif while ((c = getopt_long(argc, argv, short_opts, long_opts, NULL)) != -1) { diff --git a/src/loadkeys.y b/src/loadkeys.y index 70b48f9..cc7a28d 100644 --- a/src/loadkeys.y +++ b/src/loadkeys.y @@ -314,10 +314,11 @@ main(int argc, char *argv[]) { char *console = NULL; set_progname(argv[0]); - +#ifndef __klibc__ setlocale(LC_ALL, ""); bindtextdomain(PACKAGE_NAME, LOCALEDIR); textdomain(PACKAGE_NAME); +#endif while ((c = getopt_long(argc, argv, short_opts, long_opts, NULL)) != -1) { diff --git a/src/loadunimap.c b/src/loadunimap.c index 249e900..7a876a8 100644 --- a/src/loadunimap.c +++ b/src/loadunimap.c @@ -52,10 +52,11 @@ main(int argc, char *argv[]) { char *infnam = "def.uni"; set_progname(argv[0]); - +#ifndef __klibc__ setlocale(LC_ALL, ""); bindtextdomain(PACKAGE_NAME, LOCALEDIR); textdomain(PACKAGE_NAME); +#endif if (argc == 2 && (!strcmp(argv[1], "-V") || !strcmp(argv[1], "--version"))) diff --git a/src/mapscrn.c b/src/mapscrn.c index a08634e..e1140b7 100644 --- a/src/mapscrn.c +++ b/src/mapscrn.c @@ -4,7 +4,9 @@ #include #include +#ifndef __klibc__ #include +#endif #include #include #include @@ -40,10 +42,11 @@ main(int argc, char *argv[]) { int fd; set_progname(argv[0]); - +#ifndef __klibc__ setlocale(LC_ALL, ""); bindtextdomain(PACKAGE_NAME, LOCALEDIR); textdomain(PACKAGE_NAME); +#endif if (argc == 2 && !strcmp(argv[1], "-V")) print_version_and_exit(); diff --git a/src/nls.h b/src/nls.h index 5960c0d..f275d55 100644 --- a/src/nls.h +++ b/src/nls.h @@ -5,9 +5,11 @@ #define LOCALEDIR "/usr/share/locale" #endif +#ifndef __klibc__ #ifdef HAVE_LOCALE_H # include #endif +#endif #ifdef ENABLE_NLS # include diff --git a/src/psffontop.c b/src/psffontop.c index 553c2d8..ad9afc2 100644 --- a/src/psffontop.c +++ b/src/psffontop.c @@ -12,6 +12,10 @@ #include "utf8.h" #include "paths.h" +#ifdef __klibc__ +#include "klibc_compat.h" +#endif + extern char *progname; static void diff --git a/src/psfxtable.c b/src/psfxtable.c index 0eda1bd..fdefc07 100644 --- a/src/psfxtable.c +++ b/src/psfxtable.c @@ -238,10 +238,11 @@ main(int argc, char **argv) { int inbuflth, fontbuflth; set_progname(argv[0]); - +#ifndef __klibc__ setlocale(LC_ALL, ""); bindtextdomain(PACKAGE_NAME, LOCALEDIR); textdomain(PACKAGE_NAME); +#endif if (argc == 2 && !strcmp(argv[1], "-V")) print_version_and_exit(); diff --git a/src/resizecons.c b/src/resizecons.c index 2a6e488..e55894b 100644 --- a/src/resizecons.c +++ b/src/resizecons.c @@ -76,6 +76,7 @@ #include #include #include +#include #include #if (__GNU_LIBRARY__ >= 6) #include @@ -119,10 +120,11 @@ main(int argc, char **argv) { char *defaultfont; set_progname(argv[0]); - +#ifndef __klibc__ setlocale(LC_ALL, ""); bindtextdomain(PACKAGE_NAME, LOCALEDIR); textdomain(PACKAGE_NAME); +#endif if (argc < 2) usage(); @@ -349,13 +351,13 @@ usage() { /* Port I/O macros. Note that these are not compatible with the ones */ /* defined in the kernel header files. */ -static inline void outb( int port, int value ) +static inline void my_outb( int port, int value ) { __asm__ volatile ("outb %0,%1" : : "a" ((unsigned char)value), "d" ((unsigned short)port)); } -static inline int inb( int port ) +static inline int my_inb( int port ) { unsigned char value; __asm__ volatile ("inb %1,%0" @@ -376,112 +378,112 @@ static void vga_init_io() { exit(1); } crtcport = 0x3d4; - if ((inb(0x3cc) & 0x01) == 0) + if ((my_inb(0x3cc) & 0x01) == 0) crtcport = 0x3b4; } static void vga_set_fontheight( int h ) { - outb(crtcport, 0x09); - outb(crtcport + 1, (inb(crtcport + 1) & 0xe0) | (h - 1)); + my_outb(crtcport, 0x09); + my_outb(crtcport + 1, (my_inb(crtcport + 1) & 0xe0) | (h - 1)); } static int vga_get_fontheight() { - outb(crtcport, 0x09); - return (inb(crtcport + 1) & 0x1f) + 1; + my_outb(crtcport, 0x09); + return (my_inb(crtcport + 1) & 0x1f) + 1; } static void vga_set_cursor( int top, int bottom ) { - outb(crtcport, 0x0a); - outb(crtcport + 1, (inb(crtcport + 1) & 0xc0) | top); - outb(crtcport, 0x0b); - outb(crtcport + 1, (inb(crtcport + 1) & 0xe0) | bottom); + my_outb(crtcport, 0x0a); + my_outb(crtcport + 1, (my_inb(crtcport + 1) & 0xc0) | top); + my_outb(crtcport, 0x0b); + my_outb(crtcport + 1, (my_inb(crtcport + 1) & 0xe0) | bottom); } static void vga_set_verticaldisplayend_lowbyte( int byte ) { /* CRTC register 0x12 */ /* vertical display end */ - outb(crtcport, 0x12); - outb(crtcport + 1, byte); + my_outb(crtcport, 0x12); + my_outb(crtcport + 1, byte); } static void vga_480_scanlines() { /* CRTC register 0x11 */ /* vertical sync end (also unlocks CR0-7) */ - outb(crtcport, 0x11); - outb(crtcport + 1, 0x0c); + my_outb(crtcport, 0x11); + my_outb(crtcport + 1, 0x0c); /* CRTC register 0x06 */ /* vertical total */ - outb(crtcport, 0x06); - outb(crtcport + 1, 0x0b); + my_outb(crtcport, 0x06); + my_outb(crtcport + 1, 0x0b); /* CRTC register 0x07 */ /* (vertical) overflow */ - outb(crtcport, 0x07); - outb(crtcport + 1, 0x3e); + my_outb(crtcport, 0x07); + my_outb(crtcport + 1, 0x3e); /* CRTC register 0x10 */ /* vertical sync start */ - outb(crtcport, 0x10); - outb(crtcport + 1, 0xea); + my_outb(crtcport, 0x10); + my_outb(crtcport + 1, 0xea); /* CRTC register 0x12 */ /* vertical display end */ - outb(crtcport, 0x12); - outb(crtcport + 1, 0xdf); + my_outb(crtcport, 0x12); + my_outb(crtcport + 1, 0xdf); /* CRTC register 0x15 */ /* vertical blank start */ - outb(crtcport, 0x15); - outb(crtcport + 1, 0xe7); + my_outb(crtcport, 0x15); + my_outb(crtcport + 1, 0xe7); /* CRTC register 0x16 */ /* vertical blank end */ - outb(crtcport, 0x16); - outb(crtcport + 1, 0x04); + my_outb(crtcport, 0x16); + my_outb(crtcport + 1, 0x04); /* Misc Output register */ /* Preserver clock select bits and set correct sync polarity */ - outb(0x3c2, (inb(0x3cc) & 0x0d) | 0xe2); + my_outb(0x3c2, (my_inb(0x3cc) & 0x0d) | 0xe2); } static void vga_400_scanlines() { /* CRTC register 0x11 */ /* vertical sync end (also unlocks CR0-7) */ - outb(crtcport, 0x11); - outb(crtcport + 1, 0x0e); + my_outb(crtcport, 0x11); + my_outb(crtcport + 1, 0x0e); /* CRTC register 0x06 */ /* vertical total */ - outb(crtcport, 0x06); - outb(crtcport + 1, 0xbf); + my_outb(crtcport, 0x06); + my_outb(crtcport + 1, 0xbf); /* CRTC register 0x07 */ /* (vertical) overflow */ - outb(crtcport, 0x07); - outb(crtcport + 1, 0x1f); + my_outb(crtcport, 0x07); + my_outb(crtcport + 1, 0x1f); /* CRTC register 0x10 */ /* vertical sync start */ - outb(crtcport, 0x10); - outb(crtcport + 1, 0x9c); + my_outb(crtcport, 0x10); + my_outb(crtcport + 1, 0x9c); /* CRTC register 0x12 */ /* vertical display end */ - outb(crtcport, 0x12); - outb(crtcport + 1, 0x8f); + my_outb(crtcport, 0x12); + my_outb(crtcport + 1, 0x8f); /* CRTC register 0x15 */ /* vertical blank start */ - outb(crtcport, 0x15); - outb(crtcport + 1, 0x96); + my_outb(crtcport, 0x15); + my_outb(crtcport + 1, 0x96); /* CRTC register 0x16 */ /* vertical blank end */ - outb(crtcport, 0x16); - outb(crtcport + 1, 0xb9); + my_outb(crtcport, 0x16); + my_outb(crtcport + 1, 0xb9); /* Misc Output register */ /* Preserver clock select bits and set correct sync polarity */ - outb(0x3c2, (inb(0x3cc) & 0x0d) | 0x62); + my_outb(0x3c2, (my_inb(0x3cc) & 0x0d) | 0x62); } diff --git a/src/setfont.c b/src/setfont.c index 511a94b..8efa528 100644 --- a/src/setfont.c +++ b/src/setfont.c @@ -11,7 +11,9 @@ */ #include +#ifndef __klibc__ #include +#endif #include #include #include @@ -108,10 +110,11 @@ main(int argc, char *argv[]) { int restore = 0; set_progname(argv[0]); - +#ifndef __klibc__ setlocale(LC_ALL, ""); bindtextdomain(PACKAGE_NAME, LOCALEDIR); textdomain(PACKAGE_NAME); +#endif ifiles[0] = mfil = ufil = Ofil = ofil = omfil = oufil = NULL; iunit = hwunit = 0; diff --git a/src/setkeycodes.c b/src/setkeycodes.c index f48da2a..8ae8fb2 100644 --- a/src/setkeycodes.c +++ b/src/setkeycodes.c @@ -31,10 +31,11 @@ main(int argc, char **argv) { struct kbkeycode a; set_progname(argv[0]); - +#ifndef __klibc__ setlocale(LC_ALL, ""); bindtextdomain(PACKAGE_NAME, LOCALEDIR); textdomain(PACKAGE_NAME); +#endif if (argc == 2 && !strcmp(argv[1], "-V")) print_version_and_exit(); diff --git a/src/setleds.c b/src/setleds.c index 3577aee..b7d0907 100644 --- a/src/setleds.c +++ b/src/setleds.c @@ -162,10 +162,11 @@ main(int argc, char **argv) { struct led *lp; set_progname(argv[0]); - +#ifndef __klibc__ setlocale(LC_ALL, ""); bindtextdomain(PACKAGE_NAME, LOCALEDIR); textdomain(PACKAGE_NAME); +#endif if (argc == 2 && (!strcmp("-V", argv[1]) || !strcmp("--version", argv[1]))) print_version_and_exit(); diff --git a/src/setlogcons.c b/src/setlogcons.c index cfccb85..46246b5 100644 --- a/src/setlogcons.c +++ b/src/setlogcons.c @@ -17,9 +17,11 @@ main(int argc, char **argv){ int fd, cons; struct { char fn, subarg; } arg; +#ifndef __klibc__ setlocale(LC_ALL, ""); bindtextdomain(PACKAGE_NAME, LOCALEDIR); textdomain(PACKAGE_NAME); +#endif if (argc == 2) cons = atoi(argv[1]); diff --git a/src/setmetamode.c b/src/setmetamode.c index 1d927b0..9e05d71 100644 --- a/src/setmetamode.c +++ b/src/setmetamode.c @@ -64,10 +64,11 @@ main(int argc, char **argv) { struct meta *mp; set_progname(argv[0]); - +#ifndef __klibc__ setlocale(LC_ALL, ""); bindtextdomain(PACKAGE_NAME, LOCALEDIR); textdomain(PACKAGE_NAME); +#endif if (argc == 2 && !strcmp(argv[1], "-V")) print_version_and_exit(); diff --git a/src/setvesablank.c b/src/setvesablank.c index f0e23bd..c0c0247 100644 --- a/src/setvesablank.c +++ b/src/setvesablank.c @@ -15,9 +15,11 @@ main(int argc, char *argv[]) { int fd; struct { char ten, onoff; } arg; +#ifndef __klibc__ setlocale(LC_ALL, ""); bindtextdomain(PACKAGE_NAME, LOCALEDIR); textdomain(PACKAGE_NAME); +#endif if (argc != 2) { fprintf(stderr, _("usage: %s\n"), "setvesablank ON|on|off"); diff --git a/src/showconsolefont.c b/src/showconsolefont.c index 733e634..08c430d 100644 --- a/src/showconsolefont.c +++ b/src/showconsolefont.c @@ -121,10 +121,11 @@ main (int argc, char **argv) { int list[64], lth, info = 0, verbose = 0; set_progname(argv[0]); - +#ifndef __klibc__ setlocale(LC_ALL, ""); bindtextdomain(PACKAGE_NAME, LOCALEDIR); textdomain(PACKAGE_NAME); +#endif if (argc == 2 && (!strcmp(argv[1], "-V") || !strcmp(argv[1], "--version"))) diff --git a/src/showkey.c b/src/showkey.c index 2d8e3df..0c40541 100644 --- a/src/showkey.c +++ b/src/showkey.c @@ -1,7 +1,6 @@ #include #include #include -#include #include #include #include @@ -11,6 +10,12 @@ #include "nls.h" #include "version.h" +#ifndef __klibc__ + #include +#else + #include "klibc_compat.h" +#endif + int tmp; /* for debugging */ int fd; @@ -109,10 +114,11 @@ main (int argc, char *argv[]) { int i, n; set_progname(argv[0]); - +#ifndef __klibc__ setlocale(LC_ALL, ""); bindtextdomain(PACKAGE_NAME, LOCALEDIR); textdomain(PACKAGE_NAME); +#endif while ((c = getopt_long(argc, argv, short_opts, long_opts, NULL)) != -1) { diff --git a/src/totextmode.c b/src/totextmode.c index 3d59061..3d114e3 100644 --- a/src/totextmode.c +++ b/src/totextmode.c @@ -17,10 +17,11 @@ main(int argc, char *argv[]) { int fd, num; set_progname(argv[0]); - +#ifndef __klibc__ setlocale(LC_ALL, ""); bindtextdomain(PACKAGE_NAME, LOCALEDIR); textdomain(PACKAGE_NAME); +#endif if (argc == 2 && !strcmp(argv[1], "-V")) print_version_and_exit(); diff --git a/src/version.h b/src/version.h index 2c257cd..4fa6d29 100644 --- a/src/version.h +++ b/src/version.h @@ -1,8 +1,10 @@ -#include -#include - #include "kbd.h" #include "../config.h" +#ifdef __klibc__ +#include "klibc_compat.h" +#endif +#include +#include char *progname; diff --git a/src/xmalloc.c b/src/xmalloc.c index 081db0a..a7e02d6 100644 --- a/src/xmalloc.c +++ b/src/xmalloc.c @@ -8,6 +8,10 @@ #include "nls.h" #include "xmalloc.h" +#ifdef __klibc__ +#include "klibc_compat.h" +#endif + extern char *progname; static void attr_noreturn -- 2.7.4