xmodmap 1.0.6.
This commit is contained in:
parent
47da6fad47
commit
b8f254f1fb
|
@ -10,6 +10,7 @@ x11-xserver-utils (7.6+4) UNRELEASED; urgency=low
|
||||||
* xcmsdb 1.0.4.
|
* xcmsdb 1.0.4.
|
||||||
* xgamma 1.0.5.
|
* xgamma 1.0.5.
|
||||||
* xhost 1.0.5.
|
* xhost 1.0.5.
|
||||||
|
* xmodmap 1.0.6.
|
||||||
|
|
||||||
[ Moritz Muehlenhoff ]
|
[ Moritz Muehlenhoff ]
|
||||||
* Enable hardened build flags (closes: #655503)
|
* Enable hardened build flags (closes: #655503)
|
||||||
|
|
|
@ -1,3 +1,111 @@
|
||||||
|
commit b355a23e6787f348db97faaa48085428277c659b
|
||||||
|
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||||
|
Date: Thu Mar 22 23:04:32 2012 -0700
|
||||||
|
|
||||||
|
xmodmap 1.0.6
|
||||||
|
|
||||||
|
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||||
|
|
||||||
|
commit d0dfd2128e6111b967c51136d97093d3b53ee6d6
|
||||||
|
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||||
|
Date: Fri Nov 11 21:07:30 2011 -0800
|
||||||
|
|
||||||
|
Replace chk_malloc + sprintf with asprintf
|
||||||
|
|
||||||
|
Includes local private copy of asprintf for OS'es without it in libc.
|
||||||
|
Removes chk_malloc as no callers remain anymore.
|
||||||
|
|
||||||
|
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||||
|
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
|
||||||
|
|
||||||
|
commit fecb1f5a0c2121de6d9209fc9525ac7d9b9555ea
|
||||||
|
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||||
|
Date: Fri Nov 11 20:46:00 2011 -0800
|
||||||
|
|
||||||
|
Free copy of input line at end of process_line instead of leaking it
|
||||||
|
|
||||||
|
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||||
|
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
|
||||||
|
|
||||||
|
commit 66c09c83aa2f64b31dc657f90447c269621545b7
|
||||||
|
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||||
|
Date: Fri Nov 11 20:40:18 2011 -0800
|
||||||
|
|
||||||
|
Fix gcc -Wwrite-strings warnings
|
||||||
|
|
||||||
|
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||||
|
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
|
||||||
|
|
||||||
|
commit 8751095511c7d9065ab12a40e90e38bdd9d728e4
|
||||||
|
Author: Jeremy Huddleston <jeremyhu@apple.com>
|
||||||
|
Date: Fri Nov 11 11:22:43 2011 -0800
|
||||||
|
|
||||||
|
Add missing _X_NORETURN to functions that need it
|
||||||
|
|
||||||
|
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
|
||||||
|
|
||||||
|
commit c71811ebe193cecc4add4c2d9cec751fc721343b
|
||||||
|
Author: Jeremy Huddleston <jeremyhu@apple.com>
|
||||||
|
Date: Fri Nov 11 11:21:45 2011 -0800
|
||||||
|
|
||||||
|
Include strings.h for strcasecmp
|
||||||
|
|
||||||
|
Our minimum requirement for X11 is currently Unix98. Unix98 provides
|
||||||
|
strcasecmp in <strings.h>. This commit fixes implicit declarations
|
||||||
|
of this function on systems that closely adhere to the standard.
|
||||||
|
|
||||||
|
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
|
||||||
|
|
||||||
|
commit b6b5bc9e9874934dd1c1b80a1aa0c0b1c454eab2
|
||||||
|
Author: Jeremy Huddleston <jeremyhu@apple.com>
|
||||||
|
Date: Sat May 7 22:05:16 2011 -0700
|
||||||
|
|
||||||
|
Improve error handling in copy_to_scratch
|
||||||
|
|
||||||
|
handle.c:95:5: warning: Array access (from variable 'buf') results in a null pointer dereference
|
||||||
|
buf[len] = '\0';
|
||||||
|
^~~
|
||||||
|
|
||||||
|
Found-by: clang static analyzer
|
||||||
|
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
|
||||||
|
|
||||||
|
commit 1f801eea5f4d17b83aee1170423d65a74e01a138
|
||||||
|
Author: Jeremy Huddleston <jeremyhu@apple.com>
|
||||||
|
Date: Sat May 7 21:45:22 2011 -0700
|
||||||
|
|
||||||
|
Dead code removal
|
||||||
|
|
||||||
|
xmodmap.c:159:5: warning: Value stored to 'status' is never read
|
||||||
|
status = 0;
|
||||||
|
^ ~
|
||||||
|
|
||||||
|
Found-by: clang static analyzer
|
||||||
|
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
|
||||||
|
|
||||||
|
commit d427337286e0a8ac061d5acbc326e7bdb8b056a3
|
||||||
|
Author: Gaetan Nadon <memsize@videotron.ca>
|
||||||
|
Date: Fri Mar 4 20:50:41 2011 -0500
|
||||||
|
|
||||||
|
man: replace hard coded section with __appmansuffix__
|
||||||
|
|
||||||
|
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
|
||||||
|
|
||||||
|
commit 65011e8a86f64d5f7e9f39052e04e5ee7e57ce1b
|
||||||
|
Author: Gaetan Nadon <memsize@videotron.ca>
|
||||||
|
Date: Wed Jan 12 16:28:02 2011 -0500
|
||||||
|
|
||||||
|
config: replace deprecated AM_CONFIG_HEADER with AC_CONFIG_HEADERS
|
||||||
|
|
||||||
|
This silences an Autoconf warning
|
||||||
|
|
||||||
|
commit ec2cab2dc9b6e7c804984320d8f560adbc3477ff
|
||||||
|
Author: Jesse Adkins <jesserayadkins@gmail.com>
|
||||||
|
Date: Tue Sep 28 13:29:50 2010 -0700
|
||||||
|
|
||||||
|
Purge cvs tags.
|
||||||
|
|
||||||
|
Signed-off-by: Jesse Adkins <jesserayadkins@gmail.com>
|
||||||
|
|
||||||
commit 3fe64746bb6c3ede67c9967ebd216a8a39cdb2ea
|
commit 3fe64746bb6c3ede67c9967ebd216a8a39cdb2ea
|
||||||
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
|
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||||
Date: Fri Sep 24 11:53:40 2010 -0700
|
Date: Fri Sep 24 11:53:40 2010 -0700
|
||||||
|
|
|
@ -162,6 +162,7 @@ AUTOCONF = @AUTOCONF@
|
||||||
AUTOHEADER = @AUTOHEADER@
|
AUTOHEADER = @AUTOHEADER@
|
||||||
AUTOMAKE = @AUTOMAKE@
|
AUTOMAKE = @AUTOMAKE@
|
||||||
AWK = @AWK@
|
AWK = @AWK@
|
||||||
|
BASE_CFLAGS = @BASE_CFLAGS@
|
||||||
CC = @CC@
|
CC = @CC@
|
||||||
CCDEPMODE = @CCDEPMODE@
|
CCDEPMODE = @CCDEPMODE@
|
||||||
CFLAGS = @CFLAGS@
|
CFLAGS = @CFLAGS@
|
||||||
|
@ -215,6 +216,7 @@ PKG_CONFIG = @PKG_CONFIG@
|
||||||
SED = @SED@
|
SED = @SED@
|
||||||
SET_MAKE = @SET_MAKE@
|
SET_MAKE = @SET_MAKE@
|
||||||
SHELL = @SHELL@
|
SHELL = @SHELL@
|
||||||
|
STRICT_CFLAGS = @STRICT_CFLAGS@
|
||||||
STRIP = @STRIP@
|
STRIP = @STRIP@
|
||||||
VERSION = @VERSION@
|
VERSION = @VERSION@
|
||||||
XMODMAP_CFLAGS = @XMODMAP_CFLAGS@
|
XMODMAP_CFLAGS = @XMODMAP_CFLAGS@
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,8 @@
|
||||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `asprintf' function. */
|
||||||
|
#undef HAVE_ASPRINTF
|
||||||
|
|
||||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||||
#undef HAVE_INTTYPES_H
|
#undef HAVE_INTTYPES_H
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -23,7 +23,7 @@ dnl Process this file with autoconf to create configure.
|
||||||
|
|
||||||
AC_PREREQ([2.60])
|
AC_PREREQ([2.60])
|
||||||
AC_INIT([xmodmap],
|
AC_INIT([xmodmap],
|
||||||
[1.0.5],
|
[1.0.6],
|
||||||
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
|
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
|
||||||
[xmodmap])
|
[xmodmap])
|
||||||
AM_INIT_AUTOMAKE([foreign dist-bzip2])
|
AM_INIT_AUTOMAKE([foreign dist-bzip2])
|
||||||
|
@ -35,12 +35,12 @@ m4_ifndef([XORG_MACROS_VERSION],
|
||||||
XORG_MACROS_VERSION(1.8)
|
XORG_MACROS_VERSION(1.8)
|
||||||
XORG_DEFAULT_OPTIONS
|
XORG_DEFAULT_OPTIONS
|
||||||
|
|
||||||
AM_CONFIG_HEADER(config.h)
|
AC_CONFIG_HEADERS([config.h])
|
||||||
|
|
||||||
AC_CHECK_FUNCS([strncasecmp])
|
AC_CHECK_FUNCS([strncasecmp asprintf])
|
||||||
|
|
||||||
# Checks for pkg-config packages
|
# Checks for pkg-config packages
|
||||||
PKG_CHECK_MODULES(XMODMAP, x11)
|
PKG_CHECK_MODULES(XMODMAP, x11 xproto >= 7.0.17)
|
||||||
|
|
||||||
dnl Allow checking code with lint, sparse, etc.
|
dnl Allow checking code with lint, sparse, etc.
|
||||||
XORG_WITH_LINT
|
XORG_WITH_LINT
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
/* $XdotOrg: exec.c,v 1.4 2001/02/09 02:05:56 xorgcvs Exp $ */
|
|
||||||
/* $Xorg: exec.c,v 1.4 2001/02/09 02:05:56 xorgcvs Exp $ */
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
Copyright 1988, 1998 The Open Group
|
Copyright 1988, 1998 The Open Group
|
||||||
|
@ -55,7 +53,6 @@ from The Open Group.
|
||||||
* Author: Jim Fulton, MIT X Consortium; derived from parts of the
|
* Author: Jim Fulton, MIT X Consortium; derived from parts of the
|
||||||
* original xmodmap, written by David Rosenthal, of Sun Microsystems.
|
* original xmodmap, written by David Rosenthal, of Sun Microsystems.
|
||||||
*/
|
*/
|
||||||
/* $XFree86: xc/programs/xmodmap/exec.c,v 1.5 2001/12/14 20:02:13 dawes Exp $ */
|
|
||||||
|
|
||||||
#include <X11/Xos.h>
|
#include <X11/Xos.h>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
@ -283,7 +280,7 @@ PrintKeyTable(Bool exprs, FILE *fp)
|
||||||
max--;
|
max--;
|
||||||
for (j = 0; j <= max; j++) {
|
for (j = 0; j <= max; j++) {
|
||||||
register KeySym ks = keymap[j];
|
register KeySym ks = keymap[j];
|
||||||
char *s;
|
const char *s;
|
||||||
if (ks != NoSymbol)
|
if (ks != NoSymbol)
|
||||||
s = XKeysymToString (ks);
|
s = XKeysymToString (ks);
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
/* $Xorg: handle.c,v 1.6 2001/02/09 02:05:56 xorgcvs Exp $ */
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
Copyright 1988, 1998 The Open Group
|
Copyright 1988, 1998 The Open Group
|
||||||
|
@ -26,7 +25,6 @@ other dealings in this Software without prior written authorization
|
||||||
from The Open Group.
|
from The Open Group.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
/* $XFree86: xc/programs/xmodmap/handle.c,v 3.6 2001/07/25 15:05:27 dawes Exp $ */
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <X11/Xos.h>
|
#include <X11/Xos.h>
|
||||||
|
@ -37,6 +35,10 @@ from The Open Group.
|
||||||
#include "wq.h"
|
#include "wq.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_STRNCASECMP
|
||||||
|
#include <strings.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
static XModifierKeymap *map = NULL;
|
static XModifierKeymap *map = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
@ -84,17 +86,22 @@ copy_to_scratch(const char *s, int len)
|
||||||
static char *buf = NULL;
|
static char *buf = NULL;
|
||||||
static int buflen = 0;
|
static int buflen = 0;
|
||||||
|
|
||||||
if (len > buflen) {
|
if (len < 0)
|
||||||
|
len = 0;
|
||||||
|
|
||||||
|
if (len >= buflen) {
|
||||||
if (buf) free (buf);
|
if (buf) free (buf);
|
||||||
buflen = (len < 40) ? 80 : (len * 2);
|
buflen = (len < 40) ? 80 : (len * 2);
|
||||||
buf = (char *) malloc (buflen+1);
|
buf = (char *) malloc (buflen+1);
|
||||||
|
if (!buf) {
|
||||||
|
fprintf (stderr, "attempt to allocate %d byte scratch buffer\n", buflen + 1);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (len > 0)
|
|
||||||
strncpy (buf, s, len);
|
|
||||||
else
|
|
||||||
len = 0;
|
|
||||||
|
|
||||||
|
strncpy (buf, s, len);
|
||||||
buf[len] = '\0';
|
buf[len] = '\0';
|
||||||
|
|
||||||
return (buf);
|
return (buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +144,7 @@ static int skip_chars ( const char *s, int len );
|
||||||
static int skip_space ( const char *s, int len );
|
static int skip_space ( const char *s, int len );
|
||||||
|
|
||||||
static struct dt {
|
static struct dt {
|
||||||
char *command; /* name of input command */
|
const char *command; /* name of input command */
|
||||||
int length; /* length of command */
|
int length; /* length of command */
|
||||||
void (*proc)(char *, int); /* handler */
|
void (*proc)(char *, int); /* handler */
|
||||||
} dispatch_table[] = {
|
} dispatch_table[] = {
|
||||||
|
@ -270,7 +277,7 @@ add_to_work_queue(union op *p) /* this can become a macro someday */
|
||||||
static Bool
|
static Bool
|
||||||
parse_number(const char *str, unsigned long *val)
|
parse_number(const char *str, unsigned long *val)
|
||||||
{
|
{
|
||||||
char *fmt = "%ld";
|
const char *fmt = "%ld";
|
||||||
|
|
||||||
if (*str == '0') {
|
if (*str == '0') {
|
||||||
str++;
|
str++;
|
||||||
|
@ -317,7 +324,7 @@ static void
|
||||||
do_keycode(char *line, int len)
|
do_keycode(char *line, int len)
|
||||||
{
|
{
|
||||||
int dummy;
|
int dummy;
|
||||||
char *fmt = "%d";
|
const char *fmt = "%d";
|
||||||
KeyCode keycode;
|
KeyCode keycode;
|
||||||
|
|
||||||
if (len < 3 || !line || *line == '\0') { /* 5=a minimum */
|
if (len < 3 || !line || *line == '\0') { /* 5=a minimum */
|
||||||
|
|
|
@ -110,6 +110,7 @@ AUTOCONF = @AUTOCONF@
|
||||||
AUTOHEADER = @AUTOHEADER@
|
AUTOHEADER = @AUTOHEADER@
|
||||||
AUTOMAKE = @AUTOMAKE@
|
AUTOMAKE = @AUTOMAKE@
|
||||||
AWK = @AWK@
|
AWK = @AWK@
|
||||||
|
BASE_CFLAGS = @BASE_CFLAGS@
|
||||||
CC = @CC@
|
CC = @CC@
|
||||||
CCDEPMODE = @CCDEPMODE@
|
CCDEPMODE = @CCDEPMODE@
|
||||||
CFLAGS = @CFLAGS@
|
CFLAGS = @CFLAGS@
|
||||||
|
@ -163,6 +164,7 @@ PKG_CONFIG = @PKG_CONFIG@
|
||||||
SED = @SED@
|
SED = @SED@
|
||||||
SET_MAKE = @SET_MAKE@
|
SET_MAKE = @SET_MAKE@
|
||||||
SHELL = @SHELL@
|
SHELL = @SHELL@
|
||||||
|
STRICT_CFLAGS = @STRICT_CFLAGS@
|
||||||
STRIP = @STRIP@
|
STRIP = @STRIP@
|
||||||
VERSION = @VERSION@
|
VERSION = @VERSION@
|
||||||
XMODMAP_CFLAGS = @XMODMAP_CFLAGS@
|
XMODMAP_CFLAGS = @XMODMAP_CFLAGS@
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.\" $Xorg: xmodmap.man,v 1.4 2001/02/09 02:05:56 xorgcvs Exp $
|
|
||||||
.\"
|
|
||||||
.\" Copyright (c) 1987, 2010, Oracle and/or its affiliates. All rights reserved.
|
.\" Copyright (c) 1987, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||||
.\"
|
.\"
|
||||||
.\" Permission is hereby granted, free of charge, to any person obtaining a
|
.\" Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
@ -45,8 +43,6 @@
|
||||||
.\" other dealings in this Software without prior written authorization
|
.\" other dealings in this Software without prior written authorization
|
||||||
.\" from The Open Group.
|
.\" from The Open Group.
|
||||||
.\"
|
.\"
|
||||||
.\" $XFree86: xc/programs/xmodmap/xmodmap.man,v 1.11 2002/10/12 16:06:48 herrb Exp $
|
|
||||||
.\"
|
|
||||||
.de EX \"Begin example
|
.de EX \"Begin example
|
||||||
.ne 5
|
.ne 5
|
||||||
.if n .sp 1
|
.if n .sp 1
|
||||||
|
@ -102,7 +98,7 @@ This option turns off the verbose logging. This is the default.
|
||||||
This option indicates that
|
This option indicates that
|
||||||
.I xmodmap
|
.I xmodmap
|
||||||
should not change the mappings, but should display what it would do, like
|
should not change the mappings, but should display what it would do, like
|
||||||
\fImake(1)\fP does when given this option.
|
\fImake(__appmansuffix__)\fP does when given this option.
|
||||||
.TP 8
|
.TP 8
|
||||||
.B \-e \fIexpression\fB
|
.B \-e \fIexpression\fB
|
||||||
This option specifies an expression to be executed. Any number of expressions
|
This option specifies an expression to be executed. Any number of expressions
|
||||||
|
|
25
xmodmap/pf.c
25
xmodmap/pf.c
|
@ -1,4 +1,3 @@
|
||||||
/* $Xorg: pf.c,v 1.4 2001/02/09 02:05:56 xorgcvs Exp $ */
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
Copyright 1988, 1998 The Open Group
|
Copyright 1988, 1998 The Open Group
|
||||||
|
@ -31,6 +30,7 @@ from The Open Group.
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include "xmodmap.h"
|
#include "xmodmap.h"
|
||||||
|
|
||||||
#define NOTINFILEFILENAME "commandline"
|
#define NOTINFILEFILENAME "commandline"
|
||||||
|
@ -79,27 +79,29 @@ void process_file (const char *filename) /* NULL means use stdin */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void process_line (char *buffer)
|
void process_line (const char *line)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
int i;
|
int i;
|
||||||
char *cp;
|
char *cp, *buffer;
|
||||||
|
|
||||||
/* copy buffer since it may point to unwritable date */
|
/* copy line to buffer since it may point to unwritable data */
|
||||||
len = strlen(buffer);
|
len = strlen(line);
|
||||||
cp = chk_malloc(len + 1);
|
cp = buffer = strdup(line);
|
||||||
strcpy(cp, buffer);
|
if (buffer == NULL) {
|
||||||
buffer = cp;
|
fprintf(stderr, "%s: Could not allocate %d bytes\n", ProgramName, len);
|
||||||
|
Exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < len; i++) { /* look for blank lines */
|
for (i = 0; i < len; i++) { /* look for blank lines */
|
||||||
register char c = buffer[i];
|
register char c = buffer[i];
|
||||||
if (!(isspace(c) || c == '\n')) break;
|
if (!(isspace(c) || c == '\n')) break;
|
||||||
}
|
}
|
||||||
if (i == len) return;
|
if (i == len) goto done;
|
||||||
|
|
||||||
cp = &buffer[i];
|
cp = &buffer[i];
|
||||||
|
|
||||||
if (*cp == '!') return; /* look for comments */
|
if (*cp == '!') goto done; /* look for comments */
|
||||||
len -= (cp - buffer); /* adjust len by how much we skipped */
|
len -= (cp - buffer); /* adjust len by how much we skipped */
|
||||||
|
|
||||||
/* pipe through cpp */
|
/* pipe through cpp */
|
||||||
|
@ -117,4 +119,7 @@ void process_line (char *buffer)
|
||||||
|
|
||||||
/* handle input */
|
/* handle input */
|
||||||
handle_line (cp, len);
|
handle_line (cp, len);
|
||||||
|
|
||||||
|
done:
|
||||||
|
free(buffer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
/* $Xorg: wq.h,v 1.4 2001/02/09 02:05:56 xorgcvs Exp $ */
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
Copyright 1988, 1998 The Open Group
|
Copyright 1988, 1998 The Open Group
|
||||||
|
@ -26,7 +25,6 @@ other dealings in this Software without prior written authorization
|
||||||
from The Open Group.
|
from The Open Group.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
/* $XFree86: xc/programs/xmodmap/wq.h,v 1.4 2001/01/17 23:46:21 dawes Exp $ */
|
|
||||||
|
|
||||||
#ifndef _WQ_H
|
#ifndef _WQ_H
|
||||||
#define _WQ_H
|
#define _WQ_H
|
||||||
|
@ -137,7 +135,7 @@ extern struct wq {
|
||||||
|
|
||||||
|
|
||||||
extern struct modtab {
|
extern struct modtab {
|
||||||
char *name;
|
const char *name;
|
||||||
int length;
|
int length;
|
||||||
int value;
|
int value;
|
||||||
} modifier_table[];
|
} modifier_table[];
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
/* $Xorg: xmodmap.c,v 1.4 2001/02/09 02:05:56 xorgcvs Exp $ */
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
Copyright 1988, 1998 The Open Group
|
Copyright 1988, 1998 The Open Group
|
||||||
|
@ -26,13 +25,13 @@ other dealings in this Software without prior written authorization
|
||||||
from The Open Group.
|
from The Open Group.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
/* $XFree86: xc/programs/xmodmap/xmodmap.c,v 1.8tsi Exp $ */
|
|
||||||
|
|
||||||
#include <X11/Xos.h>
|
#include <X11/Xos.h>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <stdarg.h>
|
||||||
#include "xmodmap.h"
|
#include "xmodmap.h"
|
||||||
|
|
||||||
const char *ProgramName;
|
const char *ProgramName;
|
||||||
|
@ -41,7 +40,8 @@ int min_keycode, max_keycode;
|
||||||
Bool verbose = False;
|
Bool verbose = False;
|
||||||
Bool dontExecute = False;
|
Bool dontExecute = False;
|
||||||
|
|
||||||
static void
|
void
|
||||||
|
_X_NORETURN
|
||||||
Exit(int status)
|
Exit(int status)
|
||||||
{
|
{
|
||||||
if (dpy) {
|
if (dpy) {
|
||||||
|
@ -51,17 +51,55 @@ Exit(int status)
|
||||||
exit (status);
|
exit (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *
|
static void _X_NORETURN
|
||||||
chk_malloc(size_t n_bytes)
|
FatalError(const char *message)
|
||||||
{
|
{
|
||||||
void *buf = malloc(n_bytes);
|
fprintf(stderr, "%s: %s\n", ProgramName, message);
|
||||||
if (!buf) {
|
Exit(-1);
|
||||||
fprintf(stderr, "%s: Could not allocate %d bytes\n", ProgramName, (int)n_bytes);
|
|
||||||
Exit(-1);
|
|
||||||
}
|
|
||||||
return buf;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef HAVE_ASPRINTF
|
||||||
|
/* sprintf variant found in newer libc's which allocates string to print to */
|
||||||
|
static int _X_ATTRIBUTE_PRINTF(2,3)
|
||||||
|
asprintf(char ** ret, const char *format, ...)
|
||||||
|
{
|
||||||
|
char buf[256];
|
||||||
|
int len;
|
||||||
|
va_list ap;
|
||||||
|
|
||||||
|
va_start(ap, format);
|
||||||
|
len = vsnprintf(buf, sizeof(buf), format, ap);
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
|
if (len < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (len < sizeof(buf))
|
||||||
|
{
|
||||||
|
*ret = strdup(buf);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*ret = malloc(len + 1); /* snprintf doesn't count trailing '\0' */
|
||||||
|
if (*ret != NULL)
|
||||||
|
{
|
||||||
|
va_start(ap, format);
|
||||||
|
len = vsnprintf(*ret, len + 1, format, ap);
|
||||||
|
va_end(ap);
|
||||||
|
if (len < 0) {
|
||||||
|
free(*ret);
|
||||||
|
*ret = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*ret == NULL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
#endif /* HAVE_ASPRINTF */
|
||||||
|
|
||||||
static const char help_message[] =
|
static const char help_message[] =
|
||||||
"\nwhere options include:\n"
|
"\nwhere options include:\n"
|
||||||
" -display host:dpy X server to use\n"
|
" -display host:dpy X server to use\n"
|
||||||
|
@ -78,6 +116,7 @@ static const char help_message[] =
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
_X_NORETURN
|
||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "usage: %s [-options ...] [filename]\n", ProgramName);
|
fprintf (stderr, "usage: %s [-options ...] [filename]\n", ProgramName);
|
||||||
|
@ -107,6 +146,7 @@ static const char grammar_message[] =
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
_X_NORETURN
|
||||||
grammar_usage(void)
|
grammar_usage(void)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "%s accepts the following input expressions:\n\n",
|
fprintf (stderr, "%s accepts the following input expressions:\n\n",
|
||||||
|
@ -158,7 +198,6 @@ main(int argc, char *argv[])
|
||||||
* the display being open.
|
* the display being open.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
status = 0;
|
|
||||||
for (i = 1; i < argc; i++) {
|
for (i = 1; i < argc; i++) {
|
||||||
char *arg = argv[i];
|
char *arg = argv[i];
|
||||||
|
|
||||||
|
@ -247,11 +286,11 @@ main(int argc, char *argv[])
|
||||||
char *cmd;
|
char *cmd;
|
||||||
didAnything = True;
|
didAnything = True;
|
||||||
if (++i >= argc) usage ();
|
if (++i >= argc) usage ();
|
||||||
cmd = chk_malloc (strlen ("remove control = ") + strlen (argv[i]) + 1);
|
if (asprintf (&cmd, "remove %s = %s",
|
||||||
(void) sprintf (cmd, "remove %s = %s",
|
|
||||||
((arg[1] == 's') ? "shift" :
|
((arg[1] == 's') ? "shift" :
|
||||||
((arg[1] == 'l') ? "lock" :
|
((arg[1] == 'l') ? "lock" :
|
||||||
"control")), argv[i]);
|
"control")), argv[i]) == -1)
|
||||||
|
FatalError("Could not allocate memory for remove cmd");
|
||||||
process_line (cmd);
|
process_line (cmd);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -269,8 +308,8 @@ main(int argc, char *argv[])
|
||||||
char *cmd;
|
char *cmd;
|
||||||
didAnything = True;
|
didAnything = True;
|
||||||
if (++i >= argc) usage ();
|
if (++i >= argc) usage ();
|
||||||
cmd = chk_malloc (strlen ("add modX = ") + strlen (argv[i]) + 1);
|
if (asprintf (&cmd, "add mod%c = %s", arg[1], argv[i]) == -1)
|
||||||
(void) sprintf (cmd, "add mod%c = %s", arg[1], argv[i]);
|
FatalError("Could not allocate memory for add cmd");
|
||||||
process_line (cmd);
|
process_line (cmd);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -285,11 +324,11 @@ main(int argc, char *argv[])
|
||||||
char *cmd;
|
char *cmd;
|
||||||
didAnything = True;
|
didAnything = True;
|
||||||
if (++i >= argc) usage ();
|
if (++i >= argc) usage ();
|
||||||
cmd = chk_malloc (strlen ("add control = ") + strlen (argv[i]) + 1);
|
if (asprintf (&cmd, "add %s = %s",
|
||||||
(void) sprintf (cmd, "add %s = %s",
|
|
||||||
((arg[1] == 's') ? "shift" :
|
((arg[1] == 's') ? "shift" :
|
||||||
((arg[1] == 'l') ? "lock" :
|
((arg[1] == 'l') ? "lock" :
|
||||||
"control")), argv[i]);
|
"control")), argv[i]) == -1)
|
||||||
|
FatalError("Could not allocate memory for remove cmd");
|
||||||
process_line (cmd);
|
process_line (cmd);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
/* $Xorg: xmodmap.h,v 1.4 2001/02/09 02:05:56 xorgcvs Exp $ */
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
Copyright 1988, 1998 The Open Group
|
Copyright 1988, 1998 The Open Group
|
||||||
|
@ -26,7 +25,10 @@ other dealings in this Software without prior written authorization
|
||||||
from The Open Group.
|
from The Open Group.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
/* $XFree86: xc/programs/xmodmap/xmodmap.h,v 1.4 2001/01/17 23:46:21 dawes Exp $ */
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
extern const char *ProgramName;
|
extern const char *ProgramName;
|
||||||
extern Display *dpy;
|
extern Display *dpy;
|
||||||
|
@ -39,7 +41,7 @@ extern int parse_errors;
|
||||||
|
|
||||||
extern void initialize_map(void);
|
extern void initialize_map(void);
|
||||||
extern void process_file(const char *filename);
|
extern void process_file(const char *filename);
|
||||||
extern void process_line(char *buffer);
|
extern void process_line(const char *buffer);
|
||||||
extern void handle_line(char *line, int len);
|
extern void handle_line(char *line, int len);
|
||||||
extern void print_work_queue(void);
|
extern void print_work_queue(void);
|
||||||
extern int execute_work_queue(void);
|
extern int execute_work_queue(void);
|
||||||
|
@ -57,4 +59,4 @@ extern void PrintKeyTable(Bool exprs, FILE *fp);
|
||||||
extern void PrintPointerMap(FILE *fp);
|
extern void PrintPointerMap(FILE *fp);
|
||||||
extern int SetPointerMap(unsigned char *map, int n);
|
extern int SetPointerMap(unsigned char *map, int n);
|
||||||
|
|
||||||
extern void *chk_malloc(size_t n_bytes);
|
extern void _X_NORETURN Exit(int status);
|
||||||
|
|
Loading…
Reference in New Issue