//config: default y
//config: select PLATFORM_LINUX
//config: help
-//config: This program loads a console font from standard input.
+//config: This program loads a console font from standard input.
//config:
//config:config SETFONT
//config: bool "setfont (26 kb)"
//config: default y
//config: select PLATFORM_LINUX
//config: help
-//config: Allows to load console screen map. Useful for i18n.
+//config: Allows to load console screen map. Useful for i18n.
//config:
//config:config FEATURE_SETFONT_TEXTUAL_MAP
//config: bool "Support reading textual screen maps"
//config: default y
//config: depends on SETFONT
//config: help
-//config: Support reading textual screen maps.
+//config: Support reading textual screen maps.
//config:
//config:config DEFAULT_SETFONT_DIR
//config: string "Default directory for console-tools files"
//config: default ""
//config: depends on SETFONT
//config: help
-//config: Directory to use if setfont's params are simple filenames
-//config: (not /path/to/file or ./file). Default is "" (no default directory).
+//config: Directory to use if setfont's params are simple filenames
+//config: (not /path/to/file or ./file). Default is "" (no default directory).
//config:
//config:comment "Common options for loadfont and setfont"
//config: depends on LOADFONT || SETFONT
//config: default y
//config: depends on LOADFONT || SETFONT
-//applet:IF_LOADFONT(APPLET(loadfont, BB_DIR_USR_SBIN, BB_SUID_DROP))
-//applet:IF_SETFONT(APPLET(setfont, BB_DIR_USR_SBIN, BB_SUID_DROP))
+//applet:IF_LOADFONT(APPLET_NOEXEC(loadfont, loadfont, BB_DIR_USR_SBIN, BB_SUID_DROP, loadfont))
+//applet:IF_SETFONT(APPLET_NOEXEC(setfont, setfont, BB_DIR_USR_SBIN, BB_SUID_DROP, setfont))
//kbuild:lib-$(CONFIG_LOADFONT) += loadfont.o
//kbuild:lib-$(CONFIG_SETFONT) += loadfont.o
-//usage:#define loadfont_trivial_usage
-//usage: "< font"
-//usage:#define loadfont_full_usage "\n\n"
-//usage: "Load a console font from stdin"
-/* //usage: "\n -C TTY Affect TTY instead of /dev/tty" */
-//usage:
-//usage:#define loadfont_example_usage
-//usage: "$ loadfont < /etc/i18n/fontname\n"
-//usage:
-//usage:#define setfont_trivial_usage
-//usage: "FONT [-m MAPFILE] [-C TTY]"
-//usage:#define setfont_full_usage "\n\n"
-//usage: "Load a console font\n"
-//usage: "\n -m MAPFILE Load console screen map"
-//usage: "\n -C TTY Affect TTY instead of /dev/tty"
-//usage:
-//usage:#define setfont_example_usage
-//usage: "$ setfont -m koi8-r /etc/i18n/fontname\n"
-
#include "libbb.h"
#include <sys/kd.h>
#if ENABLE_LOADFONT
+//usage:#define loadfont_trivial_usage
+//usage: "< font"
+//usage:#define loadfont_full_usage "\n\n"
+//usage: "Load a console font from stdin"
+/* //usage: "\n -C TTY Affect TTY instead of /dev/tty" */
+//usage:
+//usage:#define loadfont_example_usage
+//usage: "$ loadfont < /etc/i18n/fontname\n"
int loadfont_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int loadfont_main(int argc UNUSED_PARAM, char **argv)
{
unsigned char *buffer;
// no arguments allowed!
- opt_complementary = "=0";
- getopt32(argv, "");
+ getopt32(argv, "^" "" "\0" "=0");
/*
* We used to look at the length of the input file
}
#endif
-#if ENABLE_SETFONT
-
-/*
-kbd-1.12:
+#if ENABLE_SETFONT
+/* kbd-1.12:
setfont [-O font+umap.orig] [-o font.orig] [-om cmap.orig]
[-ou umap.orig] [-N] [font.new ...] [-m cmap] [-u umap] [-C console]
[-hNN] [-v] [-V]
-v Verbose
-V Version
*/
+//usage:#define setfont_trivial_usage
+//usage: "FONT [-m MAPFILE] [-C TTY]"
+//usage:#define setfont_full_usage "\n\n"
+//usage: "Load a console font\n"
+//usage: "\n -m MAPFILE Load console screen map"
+//usage: "\n -C TTY Affect TTY instead of /dev/tty"
+//usage:
+//usage:#define setfont_example_usage
+//usage: "$ setfont -m koi8-r /etc/i18n/fontname\n"
-#if ENABLE_FEATURE_SETFONT_TEXTUAL_MAP
+# if ENABLE_FEATURE_SETFONT_TEXTUAL_MAP
static int ctoi(char *s)
{
if (s[0] == '\'' && s[1] != '\0' && s[2] == '\'' && s[3] == '\0')
return -1;
return xstrtoul(s, 0);
}
-#endif
+# endif
int setfont_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int setfont_main(int argc UNUSED_PARAM, char **argv)
char *mapfilename;
const char *tty_name = CURRENT_TTY;
- opt_complementary = "=1";
- opts = getopt32(argv, "m:C:", &mapfilename, &tty_name);
+ opts = getopt32(argv, "^" "m:C:" "\0" "=1", &mapfilename, &tty_name);
argv += optind;
fd = xopen_nonblocking(tty_name);
if (len == 2*E_TABSZ)
mode = PIO_UNISCRNMAP;
}
-#if ENABLE_FEATURE_SETFONT_TEXTUAL_MAP
+# if ENABLE_FEATURE_SETFONT_TEXTUAL_MAP
// assume textual Unicode console maps:
// 0x00 U+0000 # NULL (NUL)
// 0x01 U+0001 # START OF HEADING (SOH)
}
#undef unicodes
}
-#endif // ENABLE_FEATURE_SETFONT_TEXTUAL_MAP
+# endif // ENABLE_FEATURE_SETFONT_TEXTUAL_MAP
// do set screen map
xioctl(fd, mode, map);