diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2006-07-03 20:00:58 +0400 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2006-07-03 20:00:58 +0400 |
commit | e60e8d3b0ee8b75f3833ba804e385b935b0f4440 (patch) | |
tree | f70e65316985af51fb0889f1da4f38dc42a85262 /winsup | |
parent | 6258d96af8a0181b81d5466d78fb4255f94de009 (diff) |
* Makefile.in: Build setmetamode.exe.
* setmetamode.c: New file.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/utils/ChangeLog | 5 | ||||
-rw-r--r-- | winsup/utils/Makefile.in | 2 | ||||
-rw-r--r-- | winsup/utils/setmetamode.c | 82 |
3 files changed, 88 insertions, 1 deletions
diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog index d73a41c8f..cf54994c9 100644 --- a/winsup/utils/ChangeLog +++ b/winsup/utils/ChangeLog @@ -1,3 +1,8 @@ +2006-07-03 Kazuhiro Fujieda <fujieda@jaist.ac.jp> + + * Makefile.in: Build setmetamode.exe. + * setmetamode.c: New file. + 2006-05-24 Christopher Faylor <cgf@timesys.com> * configure.in: Update to newer autoconf. diff --git a/winsup/utils/Makefile.in b/winsup/utils/Makefile.in index 05962448a..daa8e5fd1 100644 --- a/winsup/utils/Makefile.in +++ b/winsup/utils/Makefile.in @@ -74,7 +74,7 @@ MINGW_CXX:=${patsubst %/cygwin/include,%/mingw/include,${filter-out -I$(newlib_s 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 diff --git a/winsup/utils/setmetamode.c b/winsup/utils/setmetamode.c new file mode 100644 index 000000000..65bd02b78 --- /dev/null +++ b/winsup/utils/setmetamode.c @@ -0,0 +1,82 @@ +/* setmetamode.c + + Copyright 2006 Red Hat Inc. + + Written by Kazuhiro Fujieda <fujieda@jaist.ac.jp> + +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 <stdio.h> +#include <string.h> +#include <sys/ioctl.h> +#include <cygwin/kd.h> + +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; +} |