summaryrefslogtreecommitdiff
path: root/zwgc
diff options
context:
space:
mode:
authorGravatar Karl Ramm <kcr@mit.edu>2009-03-22 17:34:39 +0000
committerGravatar Karl Ramm <kcr@mit.edu>2009-03-22 17:34:39 +0000
commit47b229d79ffe0f24ddfbe6cf437c4c1367f39b5c (patch)
treebfcfdedd5054e7ee442e47a4077eeac59cc3d0d5 /zwgc
parent441fec9c67f3f0b5154bcc39cbc5f7083c7a462b (diff)
clean up and modernize some of the CMU patch fallout
Diffstat (limited to 'zwgc')
-rw-r--r--zwgc/main.c7
-rw-r--r--zwgc/main.h4
-rw-r--r--zwgc/mux.c3
-rw-r--r--zwgc/plus.c72
-rw-r--r--zwgc/plus.h26
-rw-r--r--zwgc/standard_ports.c2
-rw-r--r--zwgc/subscriptions.c2
-rw-r--r--zwgc/xcut.c7
-rw-r--r--zwgc/xshow.c21
9 files changed, 65 insertions, 79 deletions
diff --git a/zwgc/main.c b/zwgc/main.c
index b4886ad..84e087d 100644
--- a/zwgc/main.c
+++ b/zwgc/main.c
@@ -56,9 +56,6 @@ static void signal_exit(int);
#ifdef HAVE_ARES
static void notice_callback(void *, int, int, char *, char *);
#endif
-#ifdef CMU_ZWGCPLUS
-void reprocess_notice(ZNotice_t *notice, char *hostname);
-#endif
/*
* Global zwgc-wide variables:
@@ -585,8 +582,8 @@ process_notice(ZNotice_t *notice,
}
#ifdef CMU_ZWGCPLUS
-void reprocess_notice(ZNotice_t *notice,
- char *hostname)
+void
+reprocess_notice(ZNotice_t *notice, char *hostname)
{
list_add_notice(notice);
process_notice(notice, hostname);
diff --git a/zwgc/main.h b/zwgc/main.h
index 3d6ea05..9257ac6 100644
--- a/zwgc/main.h
+++ b/zwgc/main.h
@@ -35,6 +35,10 @@ extern char *location_override;
extern void usage(void);
+#ifdef CMU_ZWGCPLUS
+extern void reprocess_notice(ZNotice_t *notice, char *hostname);
+#endif
+
/* USRDESC points to a file (relative to user's homedir) which has a user's
description file */
diff --git a/zwgc/mux.c b/zwgc/mux.c
index eb6232f..55d5e3e 100644
--- a/zwgc/mux.c
+++ b/zwgc/mux.c
@@ -29,6 +29,9 @@ static const char rcsid_mux_c[] = "$Id$";
#include "error.h"
#include "zwgc.h"
#include "pointer.h"
+#ifdef CMU_ZWGCPLUS
+#include "plus.h"
+#endif
#ifdef _AIX
#include <sys/select.h>
diff --git a/zwgc/plus.c b/zwgc/plus.c
index 303c2fc..313dda9 100644
--- a/zwgc/plus.c
+++ b/zwgc/plus.c
@@ -10,7 +10,7 @@
#include <sysdep.h>
#ifdef CMU_ZWGCPLUS
#if (!defined(lint) && !defined(SABER))
-static char rcsid_plus_c[] = "$Id$";
+static const char rcsid_plus_c[] = "$Id$";
#endif
#include <zephyr/mit-copyright.h>
@@ -27,6 +27,7 @@ static char rcsid_plus_c[] = "$Id$";
#include "notice.h"
#include "X_gram.h"
#include "xrevstack.h"
+#include "main.h"
#include "plus.h"
int get_full_names = 0;
@@ -53,10 +54,10 @@ static ZNotice_t *stored_notice;
static notnode *notlist[HASHSIZE];
TimeNode *timeq_head = NULL;
-TimeNode
-*addtimenode(head, node)
- TimeNode *head;
- TimeNode *node;
+int list_hash_fun(ZNotice_t *notice);
+
+TimeNode *
+addtimenode(TimeNode *head, TimeNode *node)
{
if(head == NULL) {
#ifdef DEBUG_TIMEQUEUE
@@ -79,11 +80,8 @@ TimeNode
}
void
-handle_timeq_event(event)
- TimeNode *event;
+handle_timeq_event(TimeNode *event)
{
- char *tmp;
-
char buf[128];
notnode *pt;
int bx = list_hash_fun(event->notice);
@@ -115,10 +113,7 @@ handle_timeq_event(event)
}
void
-schedule_event(secs, name, notice)
- long secs;
- char *name;
- ZNotice_t *notice;
+schedule_event(long secs, char *name, ZNotice_t *notice)
{
time_t eventtime = (time(NULL)) + secs;
TimeNode *newnode;
@@ -152,8 +147,7 @@ schedule_event(secs, name, notice)
}
void
-free_timenode(node)
- TimeNode *node;
+free_timenode(TimeNode *node)
{
#ifdef DEBUG_TIMEQUEUE
fprintf(stderr, "free_timenode(%s)\n", node->event_name);
@@ -165,9 +159,7 @@ free_timenode(node)
/* returns the number of notices destroyed */
int
-destroy_timeq_notice(notice, name)
- ZNotice_t *notice;
- char *name;
+destroy_timeq_notice(ZNotice_t *notice, char *name)
{
TimeNode *curr = timeq_head;
TimeNode *prev = NULL;
@@ -202,7 +194,7 @@ destroy_timeq_notice(notice, name)
}
long
-plus_timequeue_events()
+plus_timequeue_events(void)
{
/* returns number of seconds to the next event or 0L */
/* if there are no events remaining to be processed */
@@ -230,9 +222,7 @@ plus_timequeue_events()
}
void
-plus_set_hname(notice, hname)
- ZNotice_t *notice;
- char *hname;
+plus_set_hname(ZNotice_t *notice, char *hname)
{
notnode *pt;
int bx;
@@ -247,8 +237,7 @@ plus_set_hname(notice, hname)
}
void
-plus_queue_notice(notice)
- ZNotice_t *notice;
+plus_queue_notice(ZNotice_t *notice)
{
char *val;
int howlong = 0;
@@ -283,8 +272,7 @@ plus_queue_notice(notice)
}
int
-list_hash_fun(notice)
- ZNotice_t *notice;
+list_hash_fun(ZNotice_t *notice)
{
int ix;
int res = 0, val = 1, ptval;
@@ -303,7 +291,7 @@ list_hash_fun(notice)
/* initialize hash table */
void
-init_noticelist()
+init_noticelist(void)
{
int ix;
@@ -315,7 +303,7 @@ init_noticelist()
}
void
-dump_noticelist()
+dump_noticelist(void)
{
notnode *pt;
int bx;
@@ -329,8 +317,7 @@ dump_noticelist()
/* add notice to table. Either generate a new entry, or increment ref count. */
void
-list_add_notice(notice)
- ZNotice_t *notice;
+list_add_notice(ZNotice_t *notice)
{
notnode *pt;
int bx = list_hash_fun(notice);
@@ -360,8 +347,7 @@ list_add_notice(notice)
/* remove notice from table. If refcount reaches 0, return 1; if refcount is
still positive, return 0; if notice not there, return -1. */
int
-list_del_notice(notice)
- ZNotice_t *notice;
+list_del_notice(ZNotice_t *notice)
{
notnode *pt, **ppt;
int bx = list_hash_fun(notice);
@@ -399,9 +385,7 @@ list_del_notice(notice)
}
void
-set_notice_fake(notice, val)
- ZNotice_t *notice;
- int val;
+set_notice_fake(ZNotice_t *notice, int val)
{
notnode *pt;
int bx = list_hash_fun(notice);
@@ -414,8 +398,7 @@ set_notice_fake(notice, val)
}
int
-get_notice_fake(notice)
- ZNotice_t *notice;
+get_notice_fake(ZNotice_t *notice)
{
notnode *pt;
int bx = list_hash_fun(notice);
@@ -430,8 +413,7 @@ get_notice_fake(notice)
}
int
-get_list_refcount(notice)
- ZNotice_t *notice;
+get_list_refcount(ZNotice_t *notice)
{
notnode *pt;
int bx = list_hash_fun(notice);
@@ -449,8 +431,8 @@ get_list_refcount(notice)
}
/* export a reference to the current notice. */
-char
-*get_stored_notice()
+char *
+get_stored_notice(void)
{
if (!stored_notice)
return NULL;
@@ -461,17 +443,13 @@ char
}
void
-set_stored_notice(notice)
- ZNotice_t *notice;
+set_stored_notice(ZNotice_t *notice)
{
stored_notice = notice;
}
void
-plus_retry_notice(notice, ch, metaflag)
- ZNotice_t *notice;
- char ch;
- int metaflag;
+plus_retry_notice(ZNotice_t *notice, char ch, int metaflag)
{
char buf[128];
char *tmp;
diff --git a/zwgc/plus.h b/zwgc/plus.h
index 2347174..72408eb 100644
--- a/zwgc/plus.h
+++ b/zwgc/plus.h
@@ -10,17 +10,17 @@
extern int get_full_names;
extern int zwgcplus;
-extern void init_noticelist();
-extern void dump_noticelist();
-extern void list_add_notice();
-extern int list_del_notice();
-extern int get_list_refcount();
-extern void set_notice_fake();
-extern int get_notice_fake();
-extern char *get_stored_notice();
-extern void plus_retry_notice();
-extern void set_stored_notice();
-extern void plus_window_deletions();
+extern void init_noticelist(void);
+extern void dump_noticelist(void);
+extern void list_add_notice(ZNotice_t *notice);
+extern int list_del_notice(ZNotice_t *notice);
+extern int get_list_refcount(ZNotice_t *notice);
+extern void set_notice_fake(ZNotice_t *notice, int val);
+extern int get_notice_fake(ZNotice_t *notice);
+extern char *get_stored_notice(void);
+extern void plus_retry_notice(ZNotice_t *notice, char ch, int metaflag);
+extern void set_stored_notice(ZNotice_t *notice);
+extern void plus_window_deletions(ZNotice_t *notice); /* actually in xshow.c */
-extern void plus_queue_notice();
-extern long plus_timequeue_events();
+extern void plus_queue_notice(ZNotice_t *notice);
+extern long plus_timequeue_events(void);
diff --git a/zwgc/standard_ports.c b/zwgc/standard_ports.c
index 1c6d1ce..fa535da 100644
--- a/zwgc/standard_ports.c
+++ b/zwgc/standard_ports.c
@@ -25,12 +25,12 @@ static const char rcsid_standard_ports_c[] = "$Id$";
/* */
/****************************************************************************/
+#include <zephyr/zephyr.h>
#include "new_memory.h"
#include "port.h"
#include "variables.h"
#include "error.h"
#include "main.h"
-#include <zephyr/zephyr.h>
extern char *tty_filter(string, int);
extern int tty_filter_init(char *, char, int *, char **);
diff --git a/zwgc/subscriptions.c b/zwgc/subscriptions.c
index 198fa7e..33ff801 100644
--- a/zwgc/subscriptions.c
+++ b/zwgc/subscriptions.c
@@ -93,7 +93,7 @@ int puntable_address_p(string class,
init_puntable_dict();
temp = address_to_string(class, instance, recipient);
- ret = int_dictionary_Lookup(puntable_addresses_dict, temp);
+ ret = (int)int_dictionary_Lookup(puntable_addresses_dict, temp);
free(temp);
if (ret)
return 1;;
diff --git a/zwgc/xcut.c b/zwgc/xcut.c
index 22a94c9..e1ce7c7 100644
--- a/zwgc/xcut.c
+++ b/zwgc/xcut.c
@@ -29,6 +29,7 @@ static const char rcsid_xcut_c[] = "$Id$";
#include <X11/Xlib.h>
#include <X11/Xutil.h>
+#include <zephyr/zephyr.h>
#include "new_memory.h"
#include "new_string.h"
#include "X_gram.h"
@@ -38,8 +39,10 @@ static const char rcsid_xcut_c[] = "$Id$";
#include "error.h"
#include "xrevstack.h"
#include "X_driver.h"
+#include "xcut.h"
#ifdef CMU_ZWGCPLUS
#include "plus.h"
+#include "variables.h"
#endif
/*
@@ -213,7 +216,7 @@ xcut(Display *dpy,
char c;
char *plusvar;
int res, metaflag;
- res = XLookupString(event, &c, 1, NULL, NULL);
+ res = XLookupString(&(event->xkey), &c, 1, NULL, NULL);
metaflag = event->xkey.state & Mod1Mask;
/* Recheck if zwgcplus is turned on;
@@ -221,7 +224,7 @@ xcut(Display *dpy,
*/
zwgcplus = 1;
- plusvar = (char *)ZGetVariable("zwgcplus") ? (char *)ZGetVariable("zwgcplus") : (char *)var_get_variable("zwgcplus");
+ plusvar = ZGetVariable("zwgcplus") ? ZGetVariable("zwgcplus") : (char *)var_get_variable("zwgcplus");
if ((plusvar[0]=='\0') || (strcmp(plusvar,"no") == 0))
zwgcplus = 0;
diff --git a/zwgc/xshow.c b/zwgc/xshow.c
index 98bab3a..bb7415f 100644
--- a/zwgc/xshow.c
+++ b/zwgc/xshow.c
@@ -38,6 +38,7 @@ static const char rcsid_xshow_c[] = "$Id$";
#include <zephyr/zephyr.h>
#include "xrevstack.h"
#include "plus.h"
+#include "xcut.h"
#endif
#define max(a,b) ((a)>(b)?(a):(b))
@@ -609,7 +610,7 @@ plus_window_deletions(ZNotice_t *notice)
if (tmp->notice == (char *)notice) {
fry = tmp;
tmp = tmp->above;
- xdestroygram(dpy, fry->w, desc_context, fry, 1);
+ xdestroygram(dpy, fry->w, desc_context, fry);
done = 0;
} else {
tmp = tmp->above;
@@ -627,7 +628,7 @@ plus_window_deletions(ZNotice_t *notice)
if (!strcasecmp(((ZNotice_t *)(tmp->notice))->z_sender, class_nm)) {
fry = tmp;
tmp = tmp->above;
- xdestroygram(dpy, fry->w, desc_context, fry, 1);
+ xdestroygram(dpy, fry->w, desc_context, fry);
done = 0;
} else {
tmp = tmp->above;
@@ -645,7 +646,7 @@ plus_window_deletions(ZNotice_t *notice)
if (!!strcasecmp(((ZNotice_t *)(tmp->notice))->z_sender, class_nm)) {
fry = tmp;
tmp = tmp->above;
- xdestroygram(dpy, fry->w, desc_context, fry, 1);
+ xdestroygram(dpy, fry->w, desc_context, fry);
done = 0;
} else {
tmp = tmp->above;
@@ -662,7 +663,7 @@ plus_window_deletions(ZNotice_t *notice)
if (!strcasecmp(((ZNotice_t *)(tmp->notice))->z_recipient, recip_nm)) {
fry = tmp;
tmp = tmp->above;
- xdestroygram(dpy, fry->w, desc_context, fry, 1);
+ xdestroygram(dpy, fry->w, desc_context, fry);
done = 0;
} else {
tmp = tmp->above;
@@ -679,7 +680,7 @@ plus_window_deletions(ZNotice_t *notice)
if (!!strcasecmp(((ZNotice_t *)(tmp->notice))->z_recipient, recip_nm)) {
fry = tmp;
tmp = tmp->above;
- xdestroygram(dpy, fry->w, desc_context, fry, 1);
+ xdestroygram(dpy, fry->w, desc_context, fry);
done = 0;
} else {
tmp = tmp->above;
@@ -701,7 +702,7 @@ plus_window_deletions(ZNotice_t *notice)
{
fry = tmp;
tmp = tmp->above;
- xdestroygram(dpy, fry->w, desc_context, fry, 1);
+ xdestroygram(dpy, fry->w, desc_context, fry);
done = 0;
} else {
tmp = tmp->above;
@@ -721,7 +722,7 @@ plus_window_deletions(ZNotice_t *notice)
{
fry = tmp;
tmp = tmp->above;
- xdestroygram(dpy, fry->w, desc_context, fry, 1);
+ xdestroygram(dpy, fry->w, desc_context, fry);
done = 0;
} else {
tmp = tmp->above;
@@ -741,7 +742,7 @@ plus_window_deletions(ZNotice_t *notice)
{
fry = tmp;
tmp = tmp->above;
- xdestroygram(dpy, fry->w, desc_context, fry, 1);
+ xdestroygram(dpy, fry->w, desc_context, fry);
done = 0;
} else {
tmp = tmp->above;
@@ -758,7 +759,7 @@ plus_window_deletions(ZNotice_t *notice)
if (!strcasecmp(((ZNotice_t *)(tmp->notice))->z_class, class_nm)) {
fry = tmp;
tmp = tmp->above;
- xdestroygram(dpy, fry->w, desc_context, fry, 1);
+ xdestroygram(dpy, fry->w, desc_context, fry);
done = 0;
} else {
tmp = tmp->above;
@@ -768,7 +769,7 @@ plus_window_deletions(ZNotice_t *notice)
}
else if (!strcmp(val, "all")) {
while (bottom_gram) {
- xdestroygram(dpy, bottom_gram->w, desc_context, bottom_gram, 1);
+ xdestroygram(dpy, bottom_gram->w, desc_context, bottom_gram);
}
}
}