Index: utils/Makefile.in =================================================================== RCS file: /cvs/src/src/winsup/utils/Makefile.in,v retrieving revision 1.62 diff -u -r1.62 Makefile.in --- utils/Makefile.in 18 Jan 2006 15:57:55 -0000 1.62 +++ utils/Makefile.in 2 Jul 2006 15:33:40 -0000 @@ -74,7 +74,7 @@ PROGS:= cygcheck.exe cygpath.exe getfacl.exe kill.exe mkgroup.exe \ mkpasswd.exe mount.exe passwd.exe ps.exe regtool.exe setfacl.exe \ - ssp.exe strace.exe umount.exe ipcrm.exe ipcs.exe + setmetamode.exe ssp.exe strace.exe umount.exe ipcrm.exe ipcs.exe CLEAN_PROGS:=$(PROGS) ifndef build_dumper --- /dev/null 2006-07-03 00:34:58.640625000 +0900 +++ utils/setmetamode.c 2005-09-21 08:54:51.593750000 +0900 @@ -0,0 +1,82 @@ +/* setmetamode.c + + Copyright 2005 Red Hat Inc. + + Written by Kazuhiro Fujieda + +This file is part of Cygwin. + +This software is a copyrighted work licensed under the terms of the +Cygwin license. Please consult the file "CYGWIN_LICENSE" for +details. */ + +#include +#include +#include +#include + +static const char version[] = "$Revision$"; +static char *prog_name; + +static void +usage (void) +{ + fprintf (stderr, "Usage: %s [metabit|escprefix]\n" + " Without argument, it shows the current meta key mode.\n" + " metabit|meta|bit The meta key sets the top bit of the character.\n" + " escprefix|esc|prefix The meta key sends an escape prefix.\n", + prog_name); +} + +static void +error (void) +{ + fprintf (stderr, + "%s: The standard input isn't a console device.\n", + prog_name); +} + +int +main (int ac, char *av[]) +{ + int param; + + prog_name = strrchr (av[0], '/'); + if (!prog_name) + prog_name = strrchr (av[0], '\\'); + if (!prog_name) + prog_name = av[0]; + else + prog_name++; + + if (ac < 2) + { + if (ioctl (0, KDGKBMETA, ¶m) < 0) + { + error (); + return 1; + } + if (param == 0x03) + puts ("metabit"); + else + puts ("escprefix"); + return 0; + } + if (!strcmp ("meta", av[1]) || !strcmp ("bit", av[1]) + || !strcmp ("metabit", av[1])) + param = 0x03; + else if (!strcmp ("esc", av[1]) || !strcmp ("prefix", av[1]) + || !strcmp ("escprefix", av[1])) + param = 0x04; + else + { + usage (); + return 1; + } + if (ioctl (0, KDSKBMETA, param) < 0) + { + error (); + return 1; + } + return 0; +}