summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--psgeom.c28
-rw-r--r--utils.h24
-rw-r--r--xkbprint.c18
-rw-r--r--xkbprint.h5
-rw-r--r--xkbprint.man4
5 files changed, 33 insertions, 46 deletions
diff --git a/psgeom.c b/psgeom.c
index db1bd8f..40f2172 100644
--- a/psgeom.c
+++ b/psgeom.c
@@ -24,7 +24,7 @@
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
-/* $XFree86: xc/programs/xkbprint/psgeom.c,v 1.5 2001/07/25 15:05:25 dawes Exp $ */
+/* $XFree86: xc/programs/xkbprint/psgeom.c,v 1.6 2003/04/22 14:01:49 pascal Exp $ */
#define XK_TECHNICAL
#define XK_PUBLISHING
@@ -807,7 +807,7 @@ int p,baseline;
PSSetFont(out,state,FONT_LATIN1,14,False);
}
if (state->args->label==LABEL_SYMBOLS) {
- char buf[40],*sName= NULL;
+ char buf[40],*sName= NULL, *lbuf;
Atom sAtom;
if (state->args->nLabelGroups==1)
@@ -827,12 +827,17 @@ int p,baseline;
if (sName==NULL)
sName= "(unknown)";
- sprintf(buf,"Layout: %s",sName);
- fprintf(out,"kbx kbdscalewidth 0 (%s) centeroffset pop add\n",buf);
+ lbuf = uAlloc(10+strlen(sName));
+ if (!lbuf) {
+ uFatalError("Can't allocate memory for string\n");
+ }
+ sprintf(lbuf,"Layout: %s",sName);
+ fprintf(out,"kbx kbdscalewidth 0 (%s) centeroffset pop add\n",lbuf);
fprintf(out," kby kbdscaleheight add %d add\n",baseline);
fprintf(out," moveto\n");
- fprintf(out,"1 -1 scale (%s) show 1 -1 scale\n",buf);
+ fprintf(out,"1 -1 scale (%s) show 1 -1 scale\n",lbuf);
baseline+= 16;
+ free(lbuf);
}
if (name!=NULL) {
fprintf(out,"kbx kbdscalewidth 0 (%s) centeroffset pop add\n",name);
@@ -842,7 +847,7 @@ int p,baseline;
baseline+= 16;
}
if (state->args->label==LABEL_KEYCODE) {
- char buf[40],*sName= NULL;
+ char *sName= NULL, *lbuf;
Atom sAtom;
if (xkb->names!=NULL) sAtom= xkb->names->keycodes;
@@ -852,12 +857,17 @@ int p,baseline;
if (sName==NULL)
sName= "(unknown)";
- sprintf(buf,"Keycodes: %s",sName);
- fprintf(out,"kbx kbdscalewidth 0 (%s) centeroffset pop add\n",buf);
+ lbuf = uAlloc(12+strlen(sName));
+ if (!lbuf) {
+ uFatalError("Can't allocate memory for string\n");
+ }
+ sprintf(lbuf,"Keycodes: %s",sName);
+ fprintf(out,"kbx kbdscalewidth 0 (%s) centeroffset pop add\n",lbuf);
fprintf(out," kby kbdscaleheight add %d add\n",baseline);
fprintf(out," moveto\n");
- fprintf(out,"1 -1 scale (%s) show 1 -1 scale\n",buf);
+ fprintf(out,"1 -1 scale (%s) show 1 -1 scale\n",lbuf);
baseline+= 16;
+ free(lbuf);
}
if (state->args->copies>1) {
for (p=1;p<state->args->copies;p++)
diff --git a/utils.h b/utils.h
index d73bdd5..b675d06 100644
--- a/utils.h
+++ b/utils.h
@@ -27,7 +27,7 @@
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
\*/
-/* $XFree86: xc/programs/xkbprint/utils.h,v 1.5 2001/07/25 15:05:25 dawes Exp $ */
+/* $XFree86: xc/programs/xkbprint/utils.h,v 1.6 2003/11/17 22:20:53 dawes Exp $ */
/***====================================================================***/
@@ -86,34 +86,24 @@ typedef union {
/***====================================================================***/
extern Opaque uAlloc(
-#if NeedFunctionPrototypes
unsigned /* size */
-#endif
);
extern Opaque uCalloc(
-#if NeedFunctionPrototypes
unsigned /* n */,
unsigned /* size */
-#endif
);
extern Opaque uRealloc(
-#if NeedFunctionPrototypes
Opaque /* old */,
unsigned /* newSize */
-#endif
);
extern Opaque uRecalloc(
-#if NeedFunctionPrototypes
Opaque /* old */,
unsigned /* nOld */,
unsigned /* nNew */,
unsigned /* newSize */
-#endif
);
extern void uFree(
-#if NeedFunctionPrototypes
Opaque /* ptr */
-#endif
);
#define uTypedAlloc(t) ((t *)uAlloc((unsigned)sizeof(t)))
@@ -152,25 +142,19 @@ extern void uInternalError ( char *s, ... );
#define uStrCasePrefix(p,s) (strncasecmp(p,s,strlen(p))==0)
#else
extern int uStrCaseCmp(
-#if NeedFunctionPrototypes
char * /* s1 */,
char * /* s2 */
-#endif
);
extern int uStrCasePrefix(
-#if NeedFunctionPrototypes
char * /* p */,
char * /* str */
-#endif
);
#endif
#ifdef HAVE_STRDUP
#define uStringDup(s1) (strdup(s1))
#else
extern char *uStringDup(
-#if NeedFunctionPrototypes
char * /* s1 */
-#endif
);
#endif
@@ -197,9 +181,7 @@ unsigned int DEBUG_VAR;
extern void uDebug( char *s, ... );
extern void uDebugNOI( char *s, ... ); /* no indent */
extern Boolean uSetDebugFile(
-#if NeedFunctionPrototypes
char *name
-#endif
);
extern FILE *uDebugFile;
extern int uDebugIndentLevel;
@@ -235,15 +217,11 @@ extern int uDebugIndentSize;
#endif
extern Boolean uSetEntryFile(
-#if NeedFunctionPrototypes
char *name
-#endif
);
extern void uEntry(int l, char *s, ... );
extern void uExit(
-#if NeedFunctionPrototypes
int l,char *rtVal
-#endif
);
#ifdef ENTRY_TRACKING_ON
#define ENTRY_BIT 0x10
diff --git a/xkbprint.c b/xkbprint.c
index 8d21b94..4862a81 100644
--- a/xkbprint.c
+++ b/xkbprint.c
@@ -24,7 +24,7 @@
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
-/* $XFree86: xc/programs/xkbprint/xkbprint.c,v 3.9 2001/07/25 15:05:25 dawes Exp $ */
+/* $XFree86: xc/programs/xkbprint/xkbprint.c,v 3.11 2003/09/24 02:43:38 dawes Exp $ */
#include <stdio.h>
#include <ctype.h>
@@ -67,7 +67,6 @@ static char *fileTypeExt[] = {
};
#endif
-static unsigned inputFormat= INPUT_UNKNOWN;
static unsigned outputFormat= WANT_DEFAULT;
static char * wantLocale= "C";
static char * rootDir;
@@ -77,7 +76,9 @@ static char * outputFont= NULL;
static char * inDpyName,*outDpyName;
static Display * inDpy;
static Display * outDpy;
+#ifdef NOTYET
static Bool computeDflts= False;
+#endif
static XKBPrintArgs args;
unsigned warningLevel= 5;
Bool synch;
@@ -186,7 +187,9 @@ register int i;
}
#endif
else if (strcmp(argv[i],"-dflts")==0) {
+#ifdef NOTYET
computeDflts= True;
+#endif
uWarning("Compute defaults not implemented yet\n");
}
else if (strcmp(argv[i],"-diffs")==0) {
@@ -385,7 +388,9 @@ register int i;
warningLevel= 0;
}
else {
- sscanf(argv[++i],"%i",&warningLevel);
+ int itmp;
+ if (sscanf(argv[++i],"%i",&itmp))
+ warningLevel = itmp;
}
}
else {
@@ -441,19 +446,17 @@ register int i;
return False;
}
else if (uStringEqual(inputFile,"-")) {
- inputFormat= INPUT_XKM;
+ /* Nothing */
}
else if (strchr(inputFile,':')==0) {
int len= strlen(inputFile);
if ((len>4)&&(strcmp(&inputFile[len-4],".xkm")==0)) {
- inputFormat= INPUT_XKM;
+ /* Nothing */
}
else {
FILE *file;
file= fopen(inputFile,"r");
if (file) {
- if (XkmProbe(file)) inputFormat= INPUT_XKM;
- else inputFormat= INPUT_XKB;
fclose(file);
}
else {
@@ -465,7 +468,6 @@ register int i;
else {
inDpyName= inputFile;
inputFile= NULL;
- inputFormat= INPUT_XKM;
}
if (outputFormat==WANT_DEFAULT)
diff --git a/xkbprint.h b/xkbprint.h
index d0e7dd6..32b09ab 100644
--- a/xkbprint.h
+++ b/xkbprint.h
@@ -27,6 +27,7 @@
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/xkbprint/xkbprint.h,v 1.2 2003/11/17 22:20:53 dawes Exp $ */
#define LABEL_AUTO -1
#define LABEL_NONE 0
@@ -58,19 +59,15 @@ typedef struct _XKBPrintArgs {
extern Bool
DumpInternalFont(
-#if NeedFunctionPrototypes
FILE * /* out */,
char * /* fontName */
-#endif
);
extern Bool
GeometryToPostScript(
-#if NeedFunctionPrototypes
FILE * /* out */,
XkbFileInfo * /* result */,
XKBPrintArgs * /* args */
-#endif
);
#endif /* _XKBPRINT_H_ */
diff --git a/xkbprint.man b/xkbprint.man
index 2e81645..2fcbbbb 100644
--- a/xkbprint.man
+++ b/xkbprint.man
@@ -1,6 +1,6 @@
.\" $Xorg: xkbprint.man,v 1.3 2000/08/17 19:54:50 cpqbld Exp $
.\"
-.\" $XFree86: xc/programs/xkbprint/xkbprint.man,v 1.7 2001/01/27 18:21:16 dawes Exp $
+.\" $XFree86: xc/programs/xkbprint/xkbprint.man,v 1.8 2003/05/29 21:48:12 herrb Exp $
.\"
.TH XKBPRINT 1 __xorgversion__
.SH NAME
@@ -13,7 +13,7 @@ xkbprint \- print an XKB keyboard description
The
.I xkbprint
comman generates a printable or encapsulated PostScript description of the
-XKB keyboard description specifed by \fIsource\fP. The \fIsource\fP can be
+XKB keyboard description specified by \fIsource\fP. The \fIsource\fP can be
any compiled keymap (.xkm) file that includes a geometry description or an
X display specification. If an \fIoutput_file\fP is specified, xkbprint
writes to it. If no output file is specified, xkbprint creates replaces