pkgsrc/x11/hanterm/patches/patch-ab

255 lines
6.5 KiB
Text

$NetBSD: patch-ab,v 1.3 2014/09/22 11:56:39 joerg Exp $
- use standard headers
- don't provide own malloc/realloc declarations
- avoid implicit int
- declare void functions void
- fix os conditionals (apparently with respect to VMS)
- don't cast return value of malloc
--- charproc.c.orig 2001-06-06 13:05:15.000000000 +0000
+++ charproc.c
@@ -47,10 +47,13 @@ int eng_descent;
#include <X11/Xmu/CharSet.h>
#include <X11/Xmu/Converters.h>
#include <stdio.h>
+#include <stdlib.h>
#include <errno.h>
#include <setjmp.h>
#include <ctype.h>
#include <X11/keysym.h>
+#include <sys/types.h>
+
#include "hangul.h"
#include "hstrdefs.h"
@@ -81,8 +84,6 @@ extern int font_minus_width_char_byte2;
extern Widget toplevel;
extern void exit();
-extern char *malloc();
-extern char *realloc();
extern void FlushScroll();
extern void InsertLine();
@@ -126,6 +127,11 @@ extern int convert_3_to_utf8();
void set_vt_graphics (/*TScreen *screen*/);
#endif
+static void ansi_modes(XtermWidget, int (*)());
+static void dpmodes(XtermWidget, void (*)());
+static void restoremodes(XtermWidget);
+static void savemodes(XtermWidget);
+static void unparseputn(unsigned int, int);
static void VTallocbuf();
static int finput();
static void dotext();
@@ -1764,7 +1770,7 @@ static void VTparse()
}
}
-static finput()
+static int finput(void)
{
return(doinput());
}
@@ -1774,13 +1780,14 @@ static char *v_buffer; /* pointer to ph
static char *v_bufstr = NULL; /* beginning of area to write */
static char *v_bufptr; /* end of area to write */
static char *v_bufend; /* end of physical buffer */
-#if !defined(linux) && !defined(SVR4) /* dkim@surecom.com */
+#ifdef VMS
#define ptymask() (v_bufptr > v_bufstr ? pty_mask : 0)
#endif
/* Write data to the pty as typed by the user, pasted with the mouse,
or generated by us in response to a query ESC sequence. */
+int
v_write(f, d, len)
int f;
char *d;
@@ -1802,7 +1809,7 @@ v_write(f, d, len)
fprintf(stderr, "\n");
#endif
-#if defined(linux) || defined(SVR4)
+#ifndef VMS
if (f != pty_mask)
#else
if ((1 << f) != pty_mask)
@@ -1927,7 +1934,7 @@ v_write(f, d, len)
return(c);
}
-#if (defined(linux)||defined(SVR4))||(defined(hpux) && OSMAJORVERSION >= 10)
+#ifndef VMS
static fd_set select_mask;
static fd_set write_mask;
#else
@@ -1936,6 +1943,7 @@ static int write_mask;
#endif
static int pty_read_bytes;
+int
in_put()
{
register TScreen *screen = &term->screen;
@@ -1943,7 +1951,7 @@ in_put()
static struct timeval select_timeout;
for( ; ; ) {
-#if defined(linux)||defined(SVR4)||(defined(hpux) && OSMAJORVERSION >= 10)
+#ifndef VMS
if (FD_ISSET(pty_mask, &select_mask) && eventMode == NORMAL) {
#else
if (select_mask & pty_mask && eventMode == NORMAL) {
@@ -2003,7 +2011,7 @@ in_put()
/* stop speed reading at some point to look for X stuff */
/* (4096 is just a random large number.) */
if (pty_read_bytes > 4096) {
-#if defined(linux)||defined(SVR4)||(defined(hpux) && OSMAJORVERSION >= 10)
+#ifndef VMS
FD_CLR(pty_mask, &select_mask);
#else
select_mask &= ~pty_mask;
@@ -2033,7 +2041,7 @@ in_put()
/* Update the masks and, unless X events are already in the queue,
wait for I/O to be possible. */
select_mask = Select_mask;
-#if defined(linux) || defined(SVR4) ||(defined(hpux) && OSMAJORVERSION >= 10)
+#ifndef VMS
if (v_bufptr > v_bufstr)
FD_SET(pty_mask, &write_mask);
else
@@ -2047,7 +2055,7 @@ in_put()
/* by sangil's report */
/* #if defined(linux)||defined(SVR4)
||(defined(hpux) && OSMAJORVERSION >= 10) */
-#if defined(linux)||defined(SVR4)
+#ifndef VMS
if (QLength (screen->display))
{
i = select(max_plus1, (fd_set*) &select_mask, (fd_set*) &write_mask, (fd_set *)NULL, (struct timeval *) &select_timeout);
@@ -2073,7 +2081,7 @@ in_put()
}
/* if there is room to write more data to the pty, go write more */
-#if defined(linux)||defined(SVR4)||(defined(hpux) && OSMAJORVERSION >= 10)
+#ifndef VMS
if ((v_bufptr > v_bufstr) && FD_ISSET(pty_mask, &write_mask)) {
#else
if (write_mask & ptymask()) {
@@ -2083,7 +2091,7 @@ in_put()
/* if there are X events already in our queue, it
counts as being readable */
-#if defined(linux)||defined(SVR4)||(defined(hpux) && OSMAJORVERSION >= 10)
+#ifndef VMS
if (QLength(screen->display) || (FD_ISSET(X_mask, &select_mask))) {
#else
if (QLength(screen->display) || (select_mask & X_mask)) {
@@ -2322,9 +2330,8 @@ WriteText(screen, str, len, flags, fg, b
/*
* process ANSI modes set, reset
*/
-ansi_modes(termw, func)
- XtermWidget termw;
- int (*func)();
+static void
+ansi_modes(XtermWidget termw, int (*func)())
{
register int i;
@@ -2345,9 +2352,8 @@ ansi_modes(termw, func)
/*
* process DEC private modes set, reset
*/
-dpmodes(termw, func)
- XtermWidget termw;
- void (*func)();
+static void
+dpmodes(XtermWidget termw, void (*func)())
{
register TScreen *screen = &termw->screen;
register int i, j;
@@ -2498,8 +2504,8 @@ dpmodes(termw, func)
/*
* process xterm private modes save
*/
-savemodes(termw)
- XtermWidget termw;
+static void
+savemodes(XtermWidget termw)
{
register TScreen *screen = &termw->screen;
register int i;
@@ -2564,8 +2570,8 @@ savemodes(termw)
/*
* process xterm private modes restore
*/
-restoremodes(termw)
- XtermWidget termw;
+static void
+restoremodes(XtermWidget termw)
{
register TScreen *screen = &termw->screen;
register int i, j;
@@ -2711,9 +2717,8 @@ static void bitclr(p, mask)
*p &= ~mask;
}
-unparseseq(ap, fd)
- register ANSI *ap;
- int fd;
+void
+unparseseq(ANSI *ap, int fd)
{
register int c;
register int i;
@@ -2744,9 +2749,8 @@ unparseseq(ap, fd)
}
}
-unparseputn(n, fd)
-unsigned int n;
-int fd;
+static void
+unparseputn(unsigned int n, int fd)
{
unsigned int q;
@@ -2756,6 +2760,7 @@ int fd;
unparseputc((char) ('0' + (n%10)), fd);
}
+void
unparseputc(c, fd)
int c;
int fd;
@@ -2774,6 +2779,7 @@ int fd;
}
}
+void
unparsefputs (s, fd)
register char *s;
int fd;
@@ -4062,7 +4068,7 @@ int LoadNewFont (screen, nfontname, bfon
if (fontnum == fontMenu_fontescape &&
nfontname != screen->menu_font_names[fontnum]) {
- tmpname = (char *) malloc (strlen(nfontname) + 1);
+ tmpname = malloc (strlen(nfontname) + 1);
if (!tmpname) return 0;
strcpy (tmpname, nfontname);
}
@@ -4377,7 +4383,7 @@ set_vt_graphics (screen)
static char gr_valid_code[] = " `ajklmnopqrstuvwx~";
if (!gr_mapping) {
- gr_mapping = (int *)malloc(sizeof(int)*256);
+ gr_mapping = malloc(sizeof(int)*256);
for(i = 0; i < 256; i++) {
gr_mapping[i] = 1;
}