#include <pwd.h>
#include <netdb.h>
#ifndef lint
-static const char *rcsid_zctl_c = "$Id$";
+static const char rcsid_zctl_c[] = "$Id$";
#endif
#define SUBSATONCE 7
void del_file(short, ZSubscription_t *, int);
void fix_macros(ZSubscription_t *, ZSubscription_t *, int);
void fix_macros2(char *, char **);
+int make_exist(char *);
int
main(int argc,
return;
}
fix_macros(subs,&sub2,1);
- if (retval = (unsub ? ZUnsubscribeTo(&sub2,1,(u_short)wgport) :
- ZSubscribeToSansDefaults(&sub2,1,(u_short)wgport)))
+ retval = (unsub
+ ? ZUnsubscribeTo(&sub2,1,(u_short)wgport)
+ : ZSubscribeToSansDefaults(&sub2,1,(u_short)wgport));
+ if (retval)
ss_perror(sci_idx,retval,
unsub ? "while unsubscribing" :
"while subscribing");
#include <com_err.h>
#ifndef lint
-static char rcsid_zlocate_c[] = "$Id$";
+static const char rcsid_zlocate_c[] = "$Id$";
#endif /* lint */
/*
daytime += gseconds;
whenleave = ctime(&daytime);
- if (fp = fopen(tempfile,"r")) {
+ fp = fopen(tempfile,"r");
+ if (fp) {
if (fscanf(fp, "%d", &oldpid) == 1)
if (!kill(oldpid,9))
printf("Old zleave process killed.\n");
if (cleanname[0] == '#' || cleanname[0] == '\0' ||
cleanname[0] == '\n')
continue; /* ignore comment and empty lines */
- if (comment_ptr = strchr(cleanname, '#'))
+ comment_ptr = strchr(cleanname, '#');
+ if (comment_ptr)
*comment_ptr = '\0'; /* Ignore from # onwards */
/* Get rid of old-style nol entries, just in case */
cp = cleanname + strlen(cleanname) - 1;
#include <netdb.h>
#ifndef lint
-static const char *rcsid_zshutdown_notify_c =
+static const char rcsid_zshutdown_notify_c[] =
"$Id$";
#endif
fprintf(stderr, "%s: can't figure out canonical hostname\n",argv[0]);
exit(1);
}
- if (retval = krb_get_lrealm(rlm, 1)) {
+ retval = krb_get_lrealm(rlm, 1);
+ if (retval) {
fprintf(stderr, "%s: can't get local realm: %s\n",
argv[0], krb_get_err_text(retval));
exit(1);
}
- if (retval = krb_get_svc_in_tkt(SVC_NAME, hn2, rlm,
- SERVER_SERVICE, SERVER_INSTANCE, 1,
- KEYFILE)) {
+ retval = krb_get_svc_in_tkt(SVC_NAME, hn2, rlm,
+ SERVER_SERVICE, SERVER_INSTANCE, 1,
+ KEYFILE);
+ if (retval) {
fprintf(stderr, "%s: can't get tickets: %s\n",
argv[0], krb_get_err_text(retval));
exit(1);
#include <internal.h>
#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
#include "zserver.h"
#if !defined(lint) && !defined(SABER)
void usage(char *);
void do_stat(char *);
+int srv_stat(char *);
+int hm_stat(char *, char *);
RETSIGTYPE
timeout(int ignored)
time_t runtime;
struct tm *tim;
ZNotice_t notice;
-#ifdef _POSIX_VERSION
- struct sigaction sa;
-#endif
if ((inaddr.s_addr = inet_addr(host)) == (unsigned)(-1)) {
if ((hp = gethostbyname(host)) == NULL) {
verbose = quiet = msgarg = nrecips = nocheck = filsys = nodot = 0;
tabexpand = 1;
- if (class = ZGetVariable("zwrite-class")) {
+ class = ZGetVariable("zwrite-class");
+ if (class) {
(void) strcpy(classbfr, class);
class = classbfr;
}
else
class = DEFAULT_CLASS;
- if (inst = ZGetVariable("zwrite-inst")) {
+ inst = ZGetVariable("zwrite-inst");
+ if (inst) {
(void) strcpy(instbfr, inst);
inst = instbfr;
}
else
inst = DEFAULT_INSTANCE;
- if (opcode = ZGetVariable("zwrite-opcode"))
+ opcode = ZGetVariable("zwrite-opcode");
+ if (opcode)
opcode = strcpy(opbfr, opcode);
else
opcode = DEFAULT_OPCODE;
if (!nocheck && nrecips)
send_off(¬ice, 0);
- if (!msgarg && isatty(0))
+ if (!msgarg && isatty(0)) {
if (nodot)
printf("Type your message now. End with the end-of-file character.\n");
else
printf("Type your message now. End with control-D or a dot on a line by itself.\n");
+ }
message = NULL;
msgsize = 0;
message = realloc(message, (unsigned)(msgsize+1));
}
else { /* Use read so you can send binary messages... */
- while (nchars = read(fileno(stdin), bfr, sizeof bfr)) {
+ while ((nchars = read(fileno(stdin), bfr, sizeof bfr))) {
if (nchars == -1) {
fprintf(stderr, "Read error from stdin! Can't continue!\n");
exit(1);
int real)
{
int i, success, retval;
- char bfr[BUFSIZ], realm_recip[BUFSIZ], dest[3 * BUFSIZ], *cp;
+ char bfr[BUFSIZ], realm_recip[BUFSIZ], dest[3 * BUFSIZ];
ZNotice_t retnotice;
success = 0;
static void close_bdump(void* arg);
static Code_t bdump_send_loop(Server *server);
-static Code_t bdump_ask_for(char *inst);
static Code_t bdump_recv_loop(Server *server);
static void bdump_get_v12(ZNotice_t *, int, struct sockaddr_in *,
Server *);
return;
}
if (!bdump_sin.sin_port) {
- int len = sizeof(bdump_sin);
+ unsigned int len = sizeof(bdump_sin);
if (getsockname(bdump_socket,
(struct sockaddr *) &bdump_sin, &len) < 0) {
struct sockaddr_in from;
Server *server;
Code_t retval;
- int fromlen = sizeof(from);
+ unsigned int fromlen = sizeof(from);
int on = 1;
#ifdef _POSIX_VERSION
struct sigaction action;
/* may be moved into kstuff.c */
krb5_principal principal;
krb5_data k5data;
- krb5_ap_rep_enc_part *rep;
krb5_keytab kt;
#endif
#if !defined(HAVE_KRB4) && !defined(HAVE_KRB5)
* at least INST_SZ bytes long. */
static char buf[INST_SZ + 1] = SERVER_INSTANCE;
int retval = 0;
- CREDENTIALS cred;
-#ifndef NOENCRYPTION
- Sched *s;
-#endif
/* have they expired ? */
if (ticket_time < NOW - tkt_lifetime(TKTLIFETIME) + (15L * 60L)) {
#ifndef NOENCRYPTION
retval = read_service_key(SERVER_SERVICE, SERVER_INSTANCE,
ZGetRealm(), 0 /*kvno*/,
- srvtab_file, serv_key);
+ srvtab_file, (char *)serv_key);
if (retval != KSUCCESS) {
syslog(LOG_ERR, "get_tgt: read_service_key: %s",
krb_get_err_text(retval));
Client *client = NULL;
struct sockaddr_in who;
#ifdef HAVE_KRB5
- char buf[512];
+ unsigned char buf[512];
int blen;
#endif
#if defined(HAVE_KRB4) || defined(HAVE_KRB5)
serv_ksched.s, DES_DECRYPT);
}
} else if (*cp == 'Z') { /* Zcode! Long live the new flesh! */
- retval = ZReadZcode(cp, buf, sizeof(buf), &blen);
+ retval = ZReadZcode((unsigned char *)cp, buf, sizeof(buf), &blen);
if (retval != ZERR_NONE) {
syslog(LOG_ERR,"brl bad cblk read: %s (%s)",
error_message(retval), cp);
error_message(retval));
return retval;
}
- } /* else
+ } /* else */
/* Other side tried to send us subs for a realm we didn't
know about, and so we drop them silently */
/* Triplet not present in hash table, insert it. */
triplet = triplet_alloc(dest->classname, dest->inst, dest->recip);
- LIST_INSERT(&triplet_bucket[hashval], triplet);
+ Triplet_insert(&triplet_bucket[hashval], triplet);
return insert_client(triplet, client, realm);
}
if (retval != ZERR_NONE)
return retval;
if (*triplet->clients == NULL && !triplet->acl) {
- LIST_DELETE(triplet);
+ Triplet_delete(triplet);
free_triplet(triplet);
return ZSRV_EMPTYCLASS;
}
if (!triplet)
return ENOMEM;
triplet->acl = acl;
- LIST_INSERT(&triplet_bucket[hashval], triplet);
+ Triplet_insert(&triplet_bucket[hashval], triplet);
return ZERR_NONE;
}
String *recipient)
{
Triplet *triplet;
- Client *clist;
triplet = (Triplet *) malloc(sizeof(Triplet));
if (!triplet)
int wantdefaults)
{
Client *client;
- Code_t retval;
/* chain the client's host onto this server's host list */
client->subs = NULL;
client->realm = NULL;
client->principal = make_string(notice->z_sender, 0);
- LIST_INSERT(&client_bucket[INET_HASH(&client->addr.sin_addr,
- notice->z_port)], client);
+ Client_insert(&client_bucket[INET_HASH(&client->addr.sin_addr,
+ notice->z_port)], client);
}
/* Add default subscriptions only if this is not resulting from a brain
client_deregister(Client *client,
int flush)
{
- LIST_DELETE(client);
+ Client_delete(client);
nack_release(client);
subscr_cancel_client(client);
free_string(client->principal);
if (new_notice.z_kind == SERVACK || new_notice.z_kind == SERVNAK) {
authentic = ZAUTH_YES;
} else {
- if (realm = realm_which_realm(&input_sin)) {
+ realm = realm_which_realm(&input_sin);
+ if (realm) {
authentic = ZCheckRealmAuthentication(&new_notice,
&input_sin,
realm->name);
if (new_notice.z_kind == SERVACK || new_notice.z_kind == SERVNAK) {
authentic = ZAUTH_YES;
} else {
- if (realm = realm_which_realm(&whoisit)) {
+ realm = realm_which_realm(&whoisit);
+ if (realm) {
authentic = ZCheckRealmAuthentication(&new_notice,
&whoisit,
realm->name);
next = nacked->next;
if (nacked->client == client) {
timer_reset(nacked->timer);
- LIST_DELETE(nacked);
+ Unacked_delete(nacked);
free(nacked->packet);
free(nacked);
}
char *savebuf;
Unacked *nacked;
Code_t retval;
- int hashval, sendfail = 0;
+ int sendfail = 0;
retval = ZSendPacket(buf, len, 0);
if (retval != ZERR_NONE) {
nacked->packsz = len;
nacked->uid = notice->z_uid;
nacked->timer = timer_set_rel(rexmit_times[0], rexmit, nacked);
- LIST_INSERT(&nacktab[NACKTAB_HASHVAL(sin, nacked->uid)], nacked);
+ Unacked_insert(&nacktab[NACKTAB_HASHVAL(sin, nacked->uid)], nacked);
return(ZERR_NONE);
}
* same thing with authentic Zephyrs.
*/
if (retval == ZERR_PKTLEN) {
- ZNotice_t partnotice, newnotice;
+ ZNotice_t partnotice;
char multi[64];
char *buffer, *ptr;
- int buffer_len, hdrlen, offset, fragsize, ret_len, message_len;
+ int buffer_len, hdrlen, offset, fragsize, message_len;
int origoffset, origlen;
free(noticepack);
nacked->packsz = packlen;
nacked->uid = notice->z_uid;
nacked->timer = timer_set_rel(rexmit_times[0], rexmit, nacked);
- LIST_INSERT(&nacktab[NACKTAB_HASHVAL(*dest, nacked->uid)], nacked);
+ Unacked_insert(&nacktab[NACKTAB_HASHVAL(*dest, nacked->uid)], nacked);
}
/*
#if 1
syslog(LOG_DEBUG, "rexmit %s/%d #%d time %d",
inet_ntoa(nacked->dest.addr.sin_addr),
- ntohs(nacked->dest.addr.sin_port), nacked->rexmits + 1, NOW);
+ ntohs(nacked->dest.addr.sin_port), nacked->rexmits + 1, (int)NOW);
#endif
nacked->rexmits++;
* nack list before calling client_deregister(), which
* scans the nack list.)
*/
- LIST_DELETE(nacked);
+ Unacked_delete(nacked);
if (nacked->client) {
server_kill_clt(nacked->client);
client_deregister(nacked->client, 1);
ZNotice_t acknotice;
ZPacket_t ackpack;
int packlen;
- int notme = 0;
char *sent_name;
Code_t retval;
nacked->client->last_ack = NOW;
timer_reset(nacked->timer);
free(nacked->packet);
- LIST_DELETE(nacked);
+ Unacked_delete(nacked);
free(nacked);
return;
}
struct sockaddr_in *who,
Server *server)
{
- Server *owner;
char *opcode = notice->z_opcode;
- Code_t retval;
int i, add = 0, remove = 0;
#if 0
realm_shutdown(void)
{
int i, s, newserver;
- struct sockaddr_in sin;
for (i = 0; i < nservers; i++) {
if (i != me_server_idx && otherservers[i].state == SERV_UP)
#ifdef HAVE_KRB4
-static ZChecksum_t compute_checksum __P((ZNotice_t *, C_Block));
-static ZChecksum_t compute_rlm_checksum __P((ZNotice_t *, C_Block));
+static ZChecksum_t compute_checksum(ZNotice_t *, C_Block);
+static ZChecksum_t compute_rlm_checksum(ZNotice_t *, C_Block);
+static Code_t ZCheckAuthentication4(ZNotice_t *notice, struct sockaddr_in *from);
/*
* GetKerberosData
ReadKerberosData(int fd, int *size, char **data, int *proto) {
char p[20];
int i;
- unsigned char *dst;
- Code_t retval;
+ char *dst;
int len = 0;
for (i=0; i<20; i++) {
else if ((len = atoi(p)) > 0)
*proto = 4;
- if (*proto < 4 | *proto > 5) {
+ if ((*proto < 4) | (*proto > 5)) {
syslog(LOG_WARNING, "ReadKerberosData: error parsing authenticator length (\"%s\")", p);
return KFAILURE;
}
GetKrb5Data(int fd, krb5_data *data) {
char p[20];
int i;
- unsigned char *dst;
- Code_t retval;
+ char *dst;
for (i=0; i<20; i++) {
if (read(fd, &p[i], 1) != 1) {
krb5_data cksumbuf;
int valid;
char *cksum0_base, *cksum1_base, *cksum2_base;
- char *svcinst, *x, *y;
- char *asn1_data, *key_data;
+ char *x;
+ unsigned char *asn1_data;
+ unsigned char *key_data;
int asn1_len, key_len, cksum0_len, cksum1_len, cksum2_len;
#ifdef KRB5_AUTH_CON_GETAUTHENTICATOR_TAKES_DOUBLE_POINTER
krb5_authenticator *authenticator;
return ZAUTH_FAILED;
len = strlen(notice->z_ascii_authent)+1;
- authbuf=malloc(len);
+ authbuf = malloc(len);
/* Read in the authentication data. */
- if (ZReadZcode(notice->z_ascii_authent,
- authbuf,
+ if (ZReadZcode((unsigned char *)notice->z_ascii_authent,
+ (unsigned char *)authbuf,
len, &len) == ZERR_BADFIELD) {
return ZAUTH_FAILED;
}
return ZAUTH_FAILED;
}
/* HOLDING: authctx, authenticator, cksumbuf.data, asn1_data */
- result = ZReadZcode(notice->z_ascii_checksum,
+ result = ZReadZcode((unsigned char *)notice->z_ascii_checksum,
asn1_data, asn1_len, &asn1_len);
if (result != ZERR_NONE) {
krb5_free_keyblock(Z_krb5_ctx, keyblock);
struct sockaddr_in *from)
{
#ifdef HAVE_KRB5
- char *authbuf;
+ unsigned char *authbuf;
krb5_principal princ;
krb5_data packet;
krb5_ticket *tkt;
krb5_data cksumbuf;
int valid;
char *cksum0_base, *cksum1_base, *cksum2_base;
- char *svcinst, *x, *y;
- char *asn1_data, *key_data;
+ char *x;
+ unsigned char *asn1_data, *key_data;
int asn1_len, key_len, cksum0_len, cksum1_len, cksum2_len;
#ifdef KRB5_AUTH_CON_GETAUTHENTICATOR_TAKES_DOUBLE_POINTER
krb5_authenticator *authenticator;
#endif
len = strlen(notice->z_ascii_authent)+1;
- authbuf=malloc(len);
+ authbuf = malloc(len);
/* Read in the authentication data. */
- if (ZReadZcode(notice->z_ascii_authent,
+ if (ZReadZcode((unsigned char *)notice->z_ascii_authent,
authbuf,
len, &len) == ZERR_BADFIELD) {
return ZAUTH_FAILED;
}
packet.length = len;
- packet.data = authbuf;
+ packet.data = (char *)authbuf;
result = krb5_kt_resolve(Z_krb5_ctx,
keytab_file, &keytabid);
return ZAUTH_FAILED;
}
/* HOLDING: authctx, authenticator, cksumbuf.data, asn1_data */
- result = ZReadZcode(notice->z_ascii_checksum,
+ result = ZReadZcode((unsigned char *)notice->z_ascii_checksum,
asn1_data, asn1_len, &asn1_len);
if (result != ZERR_NONE) {
krb5_free_keyblock(Z_krb5_ctx, keyblock);
#undef KRB5AUTHENT
-Code_t
+static Code_t
ZCheckAuthentication4(ZNotice_t *notice,
struct sockaddr_in *from)
{
#ifdef HAVE_KRB4
int result;
char srcprincipal[ANAME_SZ+INST_SZ+REALM_SZ+4];
- KTEXT_ST authent, ticket;
+ KTEXT_ST authent;
AUTH_DAT dat;
ZChecksum_t checksum;
- C_Block session_key;
char instance[INST_SZ+1];
if (!notice->z_auth)
cstart = notice->z_default_format + strlen(notice->z_default_format) + 1;
cend = cstart + strlen(cstart) + 1;
- checksum = des_quad_cksum(hstart, NULL, cstart - hstart, 0, session_key);
- checksum ^= des_quad_cksum(cend, NULL, hend - cend, 0, session_key);
- checksum ^= des_quad_cksum(notice->z_message, NULL, notice->z_message_len,
+ checksum = des_quad_cksum((unsigned char *)hstart, NULL, cstart - hstart, 0, session_key);
+ checksum ^= des_quad_cksum((unsigned char *)cend, NULL, hend - cend, 0, session_key);
+ checksum ^= des_quad_cksum((unsigned char *)notice->z_message, NULL, notice->z_message_len,
0, session_key);
return checksum;
#endif
return 0;
#else
ZChecksum_t checksum;
- char *cstart, *cend, *hstart = notice->z_packet, *hend = notice->z_message;
+ char *cstart, *cend, *hstart = notice->z_packet;
cstart = notice->z_default_format + strlen(notice->z_default_format) + 1;
cend = cstart + strlen(cstart) + 1;
- checksum = des_quad_cksum(hstart, NULL, cstart - hstart, 0, session_key);
+ checksum = des_quad_cksum((unsigned char *)hstart, NULL, cstart - hstart, 0, session_key);
return checksum;
#endif
}
static RETSIGTYPE dbug_on(int);
static RETSIGTYPE dbug_off(int);
static RETSIGTYPE sig_dump_db(int);
-static RETSIGTYPE sig_dump_strings(int);
static RETSIGTYPE reset(int);
static RETSIGTYPE reap(int);
static void read_from_dump(char *dumpfile);
static int
initialize(void)
{
- int zero = 0;
if (do_net_setup())
return(1);
int fork_for_dump = 0;
-static RETSIGTYPE
-sig_dump_strings(int sig)
-{
- dump_strings_flag = 1;
-}
-
static void dump_strings(void)
{
char filename[128];
struct sockaddr_in *who)
{
struct sockaddr_in *addr;
- int a, b;
+ int b;
/* loop through the realms */
for (addr = realm->addrs, b = 0; b < realm->count; b++, addr++)
{
int cnt, retval;
for (cnt = 0; cnt < nrealms; cnt++) {
- if (retval = (subscr_send_realm_subs(&otherrealms[cnt])) != ZERR_NONE)
+ retval = subscr_send_realm_subs(&otherrealms[cnt]);
+ if (retval != ZERR_NONE)
return(retval);
}
return ZERR_NONE;
struct sockaddr_in *who)
{
register ZRealm *which = realm_which_realm(who);
- register Unacked *nacked, *next;
- ZPacket_t retval;
+ register Unacked *nacked;
#if 1
zdbug((LOG_DEBUG, "rlm_nack_cancel: %s:%08X,%08X",
/* free the data */
free(nacked->packet);
- LIST_DELETE(nacked);
+ Unacked_delete(nacked);
free(nacked);
return;
}
realm_deathgram(Server *server)
{
ZRealm *realm;
- char rlm_recipient[REALM_SZ + 1];
int jj = 0;
/* Get it out once, and assume foreign servers will share */
{
int jj, found = 0;
ZRealm *realm;
- char rlm_recipient[REALM_SZ + 1];
for (jj = 1; jj < nservers; jj++) { /* skip limbo server */
if (jj != me_server_idx && otherservers[jj].state == SERV_UP)
ZRealm *realm)
{
register char *opcode = notice->z_opcode;
- Code_t status;
if (!auth) {
syslog(LOG_WARNING, "unauth locate msg from %s (%s/%s/%s)",
ZNotice_t *notice,
ZRealm *realm)
{
- struct hostent *hp;
- char suggested_server[MAXHOSTNAMELEN];
unsigned long addr;
ZRealm *rlm;
struct sockaddr_in sinaddr;
} else {
zdbug((LOG_DEBUG, "rlm_new_srv: not switching servers (%s)", inet_ntoa((realm->addrs[realm->idx]).sin_addr)));
}
+ return 0;
}
static Code_t
return ZSRV_NORLM;
realm->idx = realm_get_idx_by_addr(realm, sin);
zdbug((LOG_DEBUG, "rlm_pick_srv: switched servers (%s)", inet_ntoa((realm->addrs[realm->idx]).sin_addr)));
+
+ return 0;
}
void
/* set a timer to retransmit */
nacked->timer = timer_set_rel(rexmit_times[0], rlm_rexmit, nacked);
/* chain in */
- LIST_INSERT(&rlm_nacklist, nacked);
+ Unacked_insert(&rlm_nacklist, nacked);
return;
}
Unacked *nackpacket = (Unacked *) arg;
Code_t retval;
register ZRealm *realm;
- int new_srv_idx;
zdbug((LOG_DEBUG,"rlm_rexmit"));
if (nackpacket->rexmits >= (NUM_REXMIT_TIMES * realm->count)) {
/* give a server ack that the packet is lost/realm dead */
packet_ctl_nack(nackpacket);
- LIST_DELETE(nackpacket);
+ Unacked_delete(nackpacket);
zdbug((LOG_DEBUG, "rlm_rexmit: %s appears dead", realm->name));
realm->state = REALM_DEAD;
int ack_to_sender)
{
char *buffer, *ptr;
- caddr_t pack;
- int buffer_len, hdrlen, offset, fragsize, ret_len, message_len;
+ int buffer_len, hdrlen, offset, fragsize, message_len;
int origoffset, origlen;
Code_t retval;
Unacked *nacked;
- char buf[1024], multi[64];
+ char multi[64];
ZNotice_t partnotice, newnotice;
offset = 0;
nacked->timer = timer_set_rel(rexmit_times[0], rlm_rexmit, nacked);
/* chain in */
- LIST_INSERT(&rlm_nacklist, nacked);
+ Unacked_insert(&rlm_nacklist, nacked);
offset += fragsize;
/* set a timer to retransmit */
nacked->timer = timer_set_rel(rexmit_times[0], rlm_rexmit, nacked);
/* chain in */
- LIST_INSERT(&rlm_nacklist, nacked);
+ Unacked_insert(&rlm_nacklist, nacked);
}
return 0;
}
int pid;
krb5_ccache ccache;
krb5_error_code result;
- krb5_auth_context authctx;
krb5_creds creds_in, *creds;
get_tgt();
auth = 0;
break;
default:
- syslog(LOG_ERR,"Bad server state, server 0x%x\n",which);
+ syslog(LOG_ERR,"Bad server state, server 0x%x\n", (int)which);
abort();
}
/* now he's either TARDY, STARTING, or DEAD
do it this way. */
vers = get_version();
- sprintf(buf, "%d pkts", npackets);
+ sprintf(buf, "%lu pkts", npackets);
pkts = strsave(buf);
- sprintf(buf, "%d seconds operational",NOW - uptime);
+ sprintf(buf, "%ld seconds operational",NOW - uptime);
upt = strsave(buf);
#ifdef OLD_COMPAT
char *pack;
int packlen;
Code_t retval;
- Unacked *nacked;
memset (¬ice, 0, sizeof(notice));
nacked->uid = notice->z_uid;
nacked->timer = timer_set_rel(rexmit_times[0], srv_rexmit, nacked);
hashval = SRV_NACKTAB_HASHVAL(nacked->dest.srv_idx, nacked->uid);
- LIST_INSERT(&srv_nacktab[hashval], nacked);
+ Unacked_insert(&srv_nacktab[hashval], nacked);
}
/*
&& ZCompareUID(&nacked->uid, ¬ice->z_uid)) {
timer_reset(nacked->timer);
free(nacked->packet);
- LIST_DELETE(nacked);
+ Unacked_delete(nacked);
free(nacked);
return;
}
#if 0
zdbug((LOG_DEBUG, "cancelling send to dead server"));
#endif
- LIST_DELETE(packet);
+ Unacked_delete(packet);
free(packet->packet);
srv_nack_release(&otherservers[packet->dest.srv_idx]);
free(packet);
next = nacked->next;
if (nacked->dest.srv_idx == server - otherservers) {
timer_reset(nacked->timer);
- LIST_DELETE(nacked);
+ Unacked_delete(nacked);
free(nacked->packet);
free(nacked);
}
static Destlist *subscr_copy_def_subs(char *person);
static Code_t subscr_realm_sendit(Client *who, Destlist *subs,
ZNotice_t *notice, ZRealm *realm);
-static void subscr_unsub_realms(Destlist *newsubs);
static void subscr_unsub_sendit(Client *who, Destlist *subs,
ZRealm *realm);
-static int cl_match (Destlist*, Client *);
static int defaults_read = 0; /* set to 1 if the default subs
are in memory */
}
} else {
/* If realm, let the REALM_ADD_SUBSCRIBE do insertion */
- LIST_INSERT(&who->subs, subs);
+ Destlist_insert(&who->subs, subs);
}
}
}
Destlist *cancel_subs, *subs, *cancel_next, *client_subs, *client_next;
Code_t retval;
int found = 0;
- int relation;
#if 0
zdbug((LOG_DEBUG,"subscr_cancel"));
for (client_subs = who->subs; client_subs; client_subs = client_next) {
client_next = client_subs->next;
if (ZDest_eq(&client_subs->dest, &subs->dest)) {
- LIST_DELETE(client_subs);
+ Destlist_delete(client_subs);
retval = triplet_deregister(who, &client_subs->dest, NULL);
if (retval == ZSRV_EMPTYCLASS &&
client_subs->dest.recip->string[0] == '@') {
ZNotice_t *notice,
ZRealm *realm)
{
- Client *who;
Destlist *cancel_subs, *subs, *client_subs, *next, *next2;
Code_t retval;
int found = 0;
for (client_subs = realm->subs; client_subs; client_subs = next2) {
next2 = client_subs->next;
if (ZDest_eq(&client_subs->dest, &subs->dest)) {
- LIST_DELETE(client_subs);
+ Destlist_delete(client_subs);
retval = triplet_deregister(realm->client, &client_subs->dest, realm);
free_subscription(client_subs);
found = 1;
Destlist *subs;
#ifdef HAVE_KRB5
char buf[512];
- char *bufp;
+ unsigned char *bufp;
#else
#ifdef HAVE_KRB4
char buf[512];
sub->dest.recip = make_string("", 0);
else
sub->dest.recip = make_string(recip, 0);
- LIST_INSERT(&subs, sub);
+ Destlist_insert(&subs, sub);
}
return subs;
}
subscr_dump_subs(FILE *fp,
Destlist *subs)
{
- char *p;
-
if (!subs) /* no subscriptions to dump */
return;
ZNotice_t snotice;
char *pack;
int packlen;
- int found = 0, i;
char **text;
Code_t retval;
char addr[16]; /* xxx.xxx.xxx.xxx max */
ZRealm *realm,
Destlist *newsubs)
{
- Destlist *subs, *subs2, *subs3, **head;
+ Destlist *subs, *subs2, **head;
Code_t retval;
#if 0
sub->dest.classname->string, sub->dest.inst->string,
sub->dest.recip->string, remrealm->name));
#endif
- LIST_INSERT(&remrealm->remsubs, sub);
+ Destlist_insert(&remrealm->remsubs, sub);
}
}
}
}
- LIST_INSERT(head, subs);
+ Destlist_insert(head, subs);
}
return ZERR_NONE;
}
char **list;
char *pack;
int packlen;
- int found = 0;
Destlist *subsp, *subsn;
for (subsp = realm->remsubs; subsp; subsp = subsn) {
subsp->dest.classname->string, subsp->dest.inst->string,
subsp->dest.recip->string, realm->name));
#endif
- LIST_DELETE(subsp);
+ Destlist_delete(subsp);
free_subscription(subsp);
break;
}
Code_t
subscr_realm_subs(ZRealm *realm)
{
- int i = 0;
Destlist *subs, *next;
- char buf[512];
char *text[2 + NUM_FIELDS];
unsigned short num = 0;
Code_t retval;
ZRealm *realm,
Destlist *newsubs)
{
- Destlist *subs, *subs2, *next;
+ Destlist *subs, *next;
Acl *acl;
char **text;
int found = 0;
return retval;
}
}
- LIST_INSERT(&realm->subs, subs);
+ Destlist_insert(&realm->subs, subs);
}
/* don't send confirmation if we're not the initial server contacted */
if (!(server_which_server(who) || found == 0)) {
ZRealm *realm)
{
Destlist *newsubs, *temp;
- Acl *acl;
Code_t status;
Client *client;
ZNotice_t snotice;
newwho.sin_addr.s_addr = inet_addr(cp);
if (newwho.sin_addr.s_addr == -1) {
- syslog(LOG_ERR, "malformed addr from %s, notice->z_sender");
+ syslog(LOG_ERR, "malformed addr from %s", notice->z_sender);
return(ZERR_NONE);
}
Timer *t;
timer_proc func;
void *arg;
- int valid = 0;
if (num_timers == 0 || heap[0]->abstime > NOW)
return;
static char **ulogin_marshal_locs __P((ZNotice_t *notice, int *found,
int auth));
-static int ul_equiv __P((Location *l1, Location *l2));
-
static void free_loc __P((Location *loc));
static void ulogin_locate_forward __P((ZNotice_t *notice,
struct sockaddr_in *who, ZRealm *realm));
return &locations[i];
}
-static int
-ul_equiv(Location *l1, Location *l2)
-{
- if (l1->machine != l2->machine)
- return 0;
- if (l1->tty != l2->tty)
- return 0;
- return 1;
-}
-
/*
* remove the user specified in notice from the internal table
*/
#define KRB_INT32 ZEPHYR_INT32
#endif
-/* These macros are for insertion into and deletion from a singly-linked list
- * with back pointers to the previous element's next pointer. In order to
- * make these macros act like expressions, they use the comma operator for
- * sequenced evaluations of assignment, and "a && b" for "evaluate assignment
- * b if expression a is true". */
-#define LIST_INSERT(head, elem) \
- ((elem)->next = *(head), \
- (*head) && ((*(head))->prev_p = &(elem)->next), \
- (*head) = (elem), (elem)->prev_p = (head))
-#define LIST_DELETE(elem) \
- (*(elem)->prev_p = (elem)->next, \
- (elem)->next && ((elem)->next->prev_p = (elem)->prev_p))
-
/* Current time as cached by main(); use instead of time(). */
#define NOW t_local.tv_sec
};
/* Function declarations */
+
+/* These macros instantiate inline functions that do the work of the formder
+ LIST_INSERT and LIST_DELETE functions, which unfortunately triggered gcc's
+ pedanticism. The comment before the *former* macros was: */
+/* These macros are for insertion into and deletion from a singly-linked list
+ * with back pointers to the previous element's next pointer. In order to
+ * make these macros act like expressions, they use the comma operator for
+ * sequenced evaluations of assignment, and "a && b" for "evaluate assignment
+ * b if expression a is true". */
+
+#define MAKE_LIST_INSERT(type) inline static void type##_insert(type **head, type *elem) \
+ {\
+ (elem)->next = *(head); \
+ if(*head) (*(head))->prev_p = &(elem)->next; \
+ (*head) = (elem); \
+ (elem)->prev_p = (head); \
+ }
+#define MAKE_LIST_DELETE(type) inline static void type##_delete(type *elem) \
+ {\
+ *(elem)->prev_p = (elem)->next; \
+ if((elem)->next) (elem)->next->prev_p = (elem)->prev_p; \
+ }
+
+MAKE_LIST_INSERT(Destlist);
+MAKE_LIST_DELETE(Destlist);
+MAKE_LIST_INSERT(Client);
+MAKE_LIST_DELETE(Client);
+MAKE_LIST_INSERT(Triplet);
+MAKE_LIST_DELETE(Triplet);
+MAKE_LIST_INSERT(Unacked);
+MAKE_LIST_DELETE(Unacked);
+
/* found in bdump.c */
void bdump_get(ZNotice_t *notice, int auth, struct sockaddr_in *who,
Server *server);
/* found in kstuff.c */
#ifdef HAVE_KRB4
int GetKerberosData (int, struct in_addr, AUTH_DAT *, char *, char *);
+Code_t ReadKerberosData(int, int *, char **, int *);
Code_t SendKerberosData (int, KTEXT, char *, char *);
+Code_t SendKrb5Data(int, krb5_data *);
+Code_t GetKrb5Data(int, krb5_data *);
void sweep_ticket_hash_table(void *);
+Code_t ZCheckRealmAuthentication(ZNotice_t *, struct sockaddr_in *, char *);
#endif
-
-/* found in kopt.c */
-#ifdef HAVE_KRB4
-#ifndef NOENCRYPTION
-Sched *check_key_sched_cache(des_cblock key);
-void add_to_key_sched_cache(des_cblock key, Sched *sched);
-/*int krb_set_key(void *key, int cvt);*/
-/* int krb_rd_req(KTEXT authent, char *service, char *instance,
- unsigned KRB_INT32 from_addr, AUTH_DAT *ad, char *fn); */
-int krb_find_ticket(KTEXT authent, KTEXT ticket);
-int krb_get_lrealm(char *r, int n);
-#endif
-#endif
-
+
/* found in server.c */
void server_timo(void *which);
void server_dump_servers(FILE *fp);
void subscr_dump_subs(FILE *fp, Destlist *subs);
void subscr_reset(void);
Code_t subscr_def_subs(Client *who);
+Code_t subscr_realm(ZRealm *, ZNotice_t *);
+Code_t subscr_send_realm_subs(ZRealm *);
+Code_t subscr_realm_cancel(struct sockaddr_in *, ZNotice_t *, ZRealm *);
/* found in uloc.c */
void uloc_hflush(struct in_addr *addr);
Code_t ulocate_dispatch(ZNotice_t *notice, int auth,
struct sockaddr_in *who, Server *server);
Code_t uloc_send_locations(void);
+void ulogin_relay_locate(ZNotice_t *, struct sockaddr_in *);
+void ulogin_realm_locate(ZNotice_t *, struct sockaddr_in *, ZRealm *);
/* found in realm.c */
int realm_sender_in_realm(char *realm, char *sender);
Server *, ZRealm *);
void realm_shutdown(void);
void realm_deathgram(Server *);
+Code_t realm_send_realms(void);
+Code_t realm_dispatch(ZNotice_t *, int, struct sockaddr_in *, Server *);
+void realm_wakeup(void);
+void kill_realm_pids(void);
+void realm_dump_realms(FILE *);
/* found in version.c */
char *get_version(void);
+/* found in access.c */
+int access_check(char *, Acl *, Access);
+
/* global identifiers */
/* found in main.c */
#ifndef lint
#ifndef SABER
-static char rcsid_queue_c[] = "$Id$";
+static const char rcsid_queue_c[] = "$Id$";
#endif /* SABER */
#endif /* lint */
static int retransmits_enabled = 0;
static Queue *find_notice_in_queue(ZNotice_t *notice);
-static Code_t dump_queue(void);
static void queue_timeout(void *arg);
+extern void new_server(char *);
+
int rexmit_times[] = { 2, 2, 4, 4, 8, -1 };
#ifdef DEBUG
free(entry->packet);
} else {
entry->reply = *repl;
- LIST_INSERT(&hm_queue, entry);
+ /*LIST_INSERT(&hm_queue, entry);*/
+
+ (entry)->next = *(&hm_queue);
+ if (*&hm_queue) ((*(&hm_queue))->prev_p = &(entry)->next);
+ (*&hm_queue) = (entry);
+ (entry)->prev_p = (&hm_queue);
+
}
entry->timer = (retransmits_enabled) ?
timer_set_rel(rexmit_times[0], queue_timeout, entry) : NULL;
if (entry->timer)
timer_reset(entry->timer);
free(entry->packet);
- LIST_DELETE(entry);
+ /*LIST_DELETE(entry);*/
+ *(entry)->prev_p = (entry)->next;
+ if((entry)->next) ((entry)->next->prev_p = (entry)->prev_p);
#ifdef DEBUG
dump_queue();
#endif /* DEBUG */
Timer *t;
timer_proc func;
void *arg;
- int valid = 0;
if (num_timers == 0 || heap[0]->abstime > time(NULL))
return;
static void detach(void);
static void send_stats(ZNotice_t *, struct sockaddr_in *);
static char *strsave(const char *);
+
+extern void send_flush_notice(char *);
+extern void server_manager(ZNotice_t *);
+extern void send_boot_notice(char *);
+extern void find_next_server(char *);
extern int optind;
static RETSIGTYPE
ZNotice_t notice;
ZPacket_t packet;
Code_t ret;
- int opt, pak_len, i, j = 0, fd, count;
+ int opt, pak_len, fd, count;
fd_set readers;
struct timeval tv;
/* detach from terminal and fork. */
register int i, x = ZGetFD();
register long size;
-
- if (i = fork()) {
+
+ i = fork();
+ if (i) {
if (i < 0)
perror("fork");
exit(0);
#include <zephyr/mit-copyright.h>
#include <internal.h>
#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
#include <sys/time.h>
#include "timer.h"
#ifndef lint
#ifndef SABER
-static char rcsid_hm_client_c[] = "$Id$";
+static const char rcsid_hm_client_c[] = "$Id$";
#endif /* SABER */
#endif /* lint */
extern int no_server, nclt, deactivated, noflushflag;
extern struct sockaddr_in cli_sin, serv_sin, from;
+extern void send_flush_notice(char *);
+extern void new_server(char *sugg_serv);
+
void transmission_tower(ZNotice_t *notice,
char *packet,
int pak_len)
#ifndef lint
#ifndef SABER
-static char rcsid_hm_server_c[] = "$Id$";
+static const char rcsid_hm_server_c[] = "$Id$";
#endif /* SABER */
#endif /* lint */
#include "X_gram.h"
#include "xselect.h"
#include "unsigned_long_dictionary.h"
+#include "zephyr.h"
char *app_instance;
/*
* Get XENVIRONMENT resources, if they exist, and merge
*/
- if (filename = getenv("XENVIRONMENT"))
+ filename = getenv("XENVIRONMENT");
+ if (filename)
{
temp_db3 = XrmGetFileDatabase(filename);
XrmMergeDatabases(temp_db3, &temp_db1);
/*
* For now, set some useful variables using resources:
*/
- if (sync=get_bool_resource("synchronous", "Synchronous", 0))
- XSynchronize(dpy,sync);
- if (temp = get_string_resource("geometry", "Geometry"))
+ sync = get_bool_resource("synchronous", "Synchronous", 0);
+ if (sync)
+ XSynchronize(dpy, sync);
+ temp = get_string_resource("geometry", "Geometry");
+ if (temp)
var_set_variable("default_X_geometry", temp);
temp=strrchr(argv[0],'/');
char *family,*fontname;
XFontStruct *fontst;
- if (family=get_family(style,substyle))
- if (fontname=get_fontname(family,size,face))
- if (fontst=get_fontst(dpy,fontname))
+ if ((family=get_family(style,substyle)))
+ if ((fontname=get_fontname(family,size,face)))
+ if ((fontst=get_fontst(dpy,fontname)))
return(fontst);
/* If any part fails, */
return(NULL);
if (size == SPECIAL_SIZE) {
/* attempt to process @font explicitly */
- if (fontst=get_fontst(dpy,substyle))
+ if ((fontst = get_fontst(dpy, substyle)))
return(fontst);
} else {
- if (family=get_family(style,substyle)) {
- if (fontname=get_fontname(family,size,face))
- if (fontst=get_fontst(dpy,fontname))
+ if ((family = get_family(style, substyle))) {
+ if ((fontname = get_fontname(family, size,face)))
+ if ((fontst = get_fontst(dpy, fontname)))
return(fontst);
} else {
- if (fontname=get_fontname(substyle,size,face))
- if (fontst=get_fontst(dpy,fontname))
+ if ((fontname = get_fontname(substyle, size, face)))
+ if ((fontst = get_fontst(dpy, fontname)))
return(fontst);
}
of substyle being the fontfamily didn't happen, either. */
fontst=NULL;
- if (!(fontst=complete_get_fontst(dpy,style,"text",size,face)))
- if (!(fontst=complete_get_fontst(dpy,"default",substyle,size,face)))
- if (!(fontst=complete_get_fontst(dpy,"default","text",size,face)))
- if (fontname=get_fontname("default",size,face))
- fontst=get_fontst(dpy,fontname);
+ if (!(fontst = complete_get_fontst(dpy,style,"text",size,face)))
+ if (!(fontst = complete_get_fontst(dpy,"default",substyle,size,face)))
+ if (!(fontst = complete_get_fontst(dpy,"default","text",size,face)))
+ if ((fontname = get_fontname("default",size,face)))
+ fontst = get_fontst(dpy,fontname);
if (fontst) return(fontst);
}
/* If all else fails, try fixed */
- if (fontst=get_fontst(dpy,"fixed")) return(fontst);
+ if ((fontst=get_fontst(dpy,"fixed"))) return(fontst);
/* No fonts available. Die. */
default_fgcolor = default_bgcolor;
default_bgcolor = tc;
}
- if (temp = get_string_resource("foreground","Foreground"))
- default_fgcolor = x_string_to_color(temp,default_fgcolor);
- if (temp = get_string_resource("background","Background"))
- default_bgcolor = x_string_to_color(temp,default_bgcolor);
+ temp = get_string_resource("foreground", "Foreground");
+ if (temp)
+ default_fgcolor = x_string_to_color(temp, default_fgcolor);
+ temp = get_string_resource("background", "Background");
+ if (temp)
+ default_bgcolor = x_string_to_color(temp, default_bgcolor);
default_bordercolor = default_fgcolor;
- if (temp = get_string_resource("borderColor","BorderColor"))
- default_bordercolor = x_string_to_color(temp,default_bordercolor);
+ temp = get_string_resource("borderColor", "BorderColor");
+ if (temp)
+ default_bordercolor = x_string_to_color(temp, default_bordercolor);
- temp = get_string_resource("minTimeToLive","MinTimeToLive");
+ temp = get_string_resource("minTimeToLive", "MinTimeToLive");
if (temp && atoi(temp)>=0)
ttl = atoi(temp);
xpos = WidthOfScreen(DefaultScreenOfDisplay(dpy)) - xpos - xsize
- 2*border_width;
else if (xalign == 0)
- xpos = (WidthOfScreen(DefaultScreenOfDisplay(dpy)) - xsize
- - 2*border_width)>>1 + xpos;
+ xpos = ((WidthOfScreen(DefaultScreenOfDisplay(dpy)) - xsize
+ - 2*border_width)>>1) + xpos;
if (yalign<0)
ypos = HeightOfScreen(DefaultScreenOfDisplay(dpy)) - ypos - ysize
- 2*border_width;
else if (yalign == 0)
- ypos = (HeightOfScreen(DefaultScreenOfDisplay(dpy)) - ysize
- - 2*border_width)>>1 + ypos;
+ ypos = ((HeightOfScreen(DefaultScreenOfDisplay(dpy)) - ysize
+ - 2*border_width)>>1) + ypos;
/*
* Create the window:
extern void xshow(Display *, desctype *, int, int);
extern void xcut(Display *, XEvent *, XContext);
extern void x_get_input(Display *);
+extern void xshowinit(void);
#endif
(void) memset(cache, 0, sizeof(cache));
for (i=0; i<strlen(str); i++)
- cache[str[i]] = 1;
+ cache[(int)str[i]] = 1;
return(cache);
}
char *result;
struct passwd *passwd_entry;
- if (result = getenv("HOME"))
+ result = getenv("HOME");
+ if (result)
return(result);
if (!(passwd_entry = getpwuid(getuid())))
}
if (home_dir_filename) {
- if (filename = get_home_directory()) {
+ filename = get_home_directory();
+ if (filename) {
filename = string_Concat(filename, "/");
filename = string_Concat2(filename, home_dir_filename);
result = fopen(filename, "r");
not_contains(string str,
const character_class set)
{
- while (*str && ! set[*str]) str++;
+ while (*str && ! set[(int)*str]) str++;
return (! *str);
}
#ifdef DEBUG
abort();
#endif
+ return 0;
}
/* the char * that str points to is free'd by this function.
temp[templen-2] = *str++;
char_stack_pop(chs);
temp[templen-1] = '\0';
- } else if (len = pure_text_length(str,tos)) {
+ } else if ((len = pure_text_length(str,tos))) {
if (tos) {
/* if the block is text in an environment, just copy it */
terminator = char_stack_top(terminators);
char_stack_pop(terminators);
curstr++;
- } else if (len=text_length(curstr,terminator)) { /* if there is a text
- block here */
+ } else if ((len=text_length(curstr, terminator))) { /* if there is a text
+ block here */
here->code=DT_STR;
here->str=curstr;
here->len=len;
if (c!='\n')
unput(c);
- if (yylval.text = eat_til_endshow(start_line_no))
+ yylval.text = eat_til_endshow(start_line_no);
+ if (yylval.text)
return(SHOW);
else
return(ERROR);
* Handle constant strings:
*/
case '"':
- if (yylval.text = eat_string(yylineno))
+ yylval.text = eat_string(yylineno);
+ if (yylval.text)
return(STRING);
else
return(ERROR);
ZNotice_t notice;
struct timezone tz;
char msgbuf[BUFSIZ];
+ extern void Z_gettimeofday(struct _ZTimeval *, struct timezone *);
var_set_variable("version", zwgc_version_string);
dprintf("Got a message\n");
- if (control_opcode = decode_notice(notice, hostname)) {
+ control_opcode = decode_notice(notice, hostname);
+ if (control_opcode) {
#ifdef DEBUG
printf("got control opcode <%s>.\n", control_opcode);
#endif
* of finding the session leader; otherwise use the process group of
* the parent process, which is a good guess. */
#if defined(HAVE_GETSID)
+
setpgid(0, getsid(0));
#elif defined(HAVE_GETPGID)
setpgid(0, getpgid(getppid()));
#endif
/* fork off and let parent exit... */
- if (i = fork()) {
+ i = fork();
+ if (i) {
if (i < 0) {
perror("zwgc: cannot fork, aborting:");
exit(1);
if (!close_input_proc)
return;
- if (error = close_input_proc(p))
+ error = close_input_proc(p);
+ if (error)
var_set_variable("error", error);
}
if (!close_output_proc)
return;
- if (error = close_output_proc(p))
+ error = close_output_proc(p);
+ if (error)
var_set_variable("error", error);
}
current++; *pargc -= 2;
if (!*current)
usage();
- if (p = get_standard_port_info((string) *current))
+ p = get_standard_port_info((string) *current);
+ if (p)
p->port_setup_status = DISABLED;
} else if (string_Eq((string) *current, "-default")) {
current++; *pargc -= 2;
if (!*current)
usage();
default_port = (string) *current;
- if (p = get_standard_port_info((string) *current))
+ p = get_standard_port_info((string) *current);
+ if (p)
p->port_setup_status = DEFAULT_OK;
} else if (string_Eq((string) *current, "-ttymode")) {
default_port = (string) "tty";
(*pargc)--;
- if (p = get_standard_port_info(default_port)) {
+ p = get_standard_port_info(default_port);
+ if (p) {
p->port_setup_status = DEFAULT_OK;
- if (p = get_standard_port_info ((string) "X"))
+ p = get_standard_port_info ((string) "X");
+ if (p)
p->port_setup_status = DISABLED;
}
} else
*/
#if (!defined(lint) && !defined(SABER))
-static char rcsid_string_dictionary_aux_c[] = "$Id$";
+static const char rcsid_string_dictionary_aux_c[] = "$Id$";
#endif
/*
*/
#if (!defined(lint) && !defined(SABER))
-static char rcsid_subscriptions_c[] = "$Id$";
+static const char rcsid_subscriptions_c[] = "$Id$";
#endif
/****************************************************************************/
/* Parse line */
/* <<<>>>
* The below does NOT work is the recipient field is "":
- */
- if (temp = strchr(line, '#'))
+ */
+ temp = strchr(line, '#');
+ if (temp)
*temp = '\0';
for (temp=line; *temp && *temp==' '; temp++) ;
if (!*temp || *temp=='\n')
*/
#if (!defined(lint) && !defined(SABER))
-static char rcsid_substitute_c[] = "$Id$";
+static const char rcsid_substitute_c[] = "$Id$";
#endif
#include <zephyr/mit-copyright.h>
string result, whats_left;
char *p = *text_ptr;
- while (*p && !set[*p]) p++;
+ while (*p && !set[(int)*p]) p++;
result = string_CreateFromData(*text_ptr, p - *text_ptr);
whats_left = string_Copy(p);
string result, whats_left;
char *p = *text_ptr;
- while (*p && set[*p]) p++;
+ while (*p && set[(int)*p]) p++;
result = string_CreateFromData(*text_ptr, p - *text_ptr);
whats_left = string_Copy(p);
string text = *text_ptr;
char *p = text + strlen(text);
- while (text<p && !set[p[-1]]) p--;
+ while (text<p && !set[(int)p[-1]]) p--;
result = string_Copy(p);
whats_left = string_CreateFromData(text, p - text);
string text = *text_ptr;
char *p = text + strlen(text);
- while (text<p && set[p[-1]]) p--;
+ while (text<p && set[(int)p[-1]]) p--;
result = string_Copy(p);
whats_left = string_CreateFromData(text, p - text);
/****************************************************************************/
#ifdef HAVE_TERMCAP_H
#include <termcap.h>
+#else
+#ifdef HAVE_TERM_H
+#include <term.h>
+#endif
#endif
#include "new_memory.h"
tmp = tgetstr("pc", &p);
PC = (tmp) ? *tmp : 0;
- if (tmp = tgetstr("md",&p)) { /* bold ? */
+ tmp = tgetstr("md", &p);
+ if (tmp) { /* bold ? */
EXPAND("B.bold");
tmp = tgetstr("me",&p);
EXPAND("E.bold");
}
- if (tmp = tgetstr("mr",&p)) { /* reverse video? */
+ tmp = tgetstr("mr", &p);
+ if (tmp) { /* reverse video? */
EXPAND("B.rw");
- tmp = tgetstr("me",&p);
+ tmp = tgetstr("me", &p);
EXPAND("E.rw");
}
- if (tmp = tgetstr("bl",&p)) { /* Bell ? */
+ tmp = tgetstr("bl", &p);
+ if (tmp) { /* Bell ? */
EXPAND("B.bell");
TD_SET("E.bell", NULL);
}
- if (tmp = tgetstr("mb",&p)) { /* Blink ? */
+ tmp = tgetstr("mb", &p);
+ if (tmp) { /* Blink ? */
EXPAND("B.blink");
- tmp = tgetstr("me",&p);
+ tmp = tgetstr("me", &p);
EXPAND("E.blink");
}
- if (tmp = tgetstr("us",&p)) { /* Underline ? */
+ tmp = tgetstr("us", &p);
+ if (tmp) { /* Underline ? */
EXPAND("B.u");
- tmp = tgetstr("ue",&p);
+ tmp = tgetstr("ue", &p);
EXPAND("E.u");
}
- if (tmp = tgetstr("so",&p)) { /* Standout ? */
+ tmp = tgetstr("so", &p);
+ if (tmp) { /* Standout ? */
EXPAND("B.so");
- tmp = tgetstr("se",&p);
+ tmp = tgetstr("se", &p);
EXPAND("E.so");
}
}
/* Step 2: alias others to the nearest substitute */
/* Bold = so, else rv, else ul */
- if (NULL == string_dictionary_Lookup(termcap_dict,"B.bold")) {
- if(b = string_dictionary_Lookup(termcap_dict,"B.so")) {
- TD_SET("B.bold",b->value);
+ if (NULL == string_dictionary_Lookup(termcap_dict, "B.bold")) {
+ if((b = string_dictionary_Lookup(termcap_dict, "B.so"))) {
+ TD_SET("B.bold", b->value);
TD_SET("E.bold",
- string_dictionary_Lookup(termcap_dict,"E.so")->value);
- } else if (b = string_dictionary_Lookup(termcap_dict,"B.rv")) {
- TD_SET("B.bold",b->value);
+ string_dictionary_Lookup(termcap_dict, "E.so")->value);
+ } else if ((b = string_dictionary_Lookup(termcap_dict, "B.rv"))) {
+ TD_SET("B.bold", b->value);
TD_SET("E.bold",
- string_dictionary_Lookup(termcap_dict,"E.rv")->value);
- } else if (b = string_dictionary_Lookup(termcap_dict,"B.u")) {
- TD_SET("B.bold",b->value);
+ string_dictionary_Lookup(termcap_dict, "E.rv")->value);
+ } else if ((b = string_dictionary_Lookup(termcap_dict,"B.u"))) {
+ TD_SET("B.bold", b->value);
TD_SET("E.bold",
- string_dictionary_Lookup(termcap_dict,"E.u")->value);
+ string_dictionary_Lookup(termcap_dict, "E.u")->value);
}
}
/* Bell = ^G */
- if (NULL == string_dictionary_Lookup(termcap_dict,"B.bell")) {
- TD_SET("B.bell","\007");
- TD_SET("E.bell",NULL);
+ if (NULL == string_dictionary_Lookup(termcap_dict, "B.bell")) {
+ TD_SET("B.bell", "\007");
+ TD_SET("E.bell", NULL);
}
/* Underline -> nothing */
item = string_Copy("");
if (info->bold_p && use_fonts) {
- if (temp = string_dictionary_Fetch(termcap_dict, "B.bold"))
+ temp = string_dictionary_Fetch(termcap_dict, "B.bold");
+ if (temp)
item = string_Concat2(item, temp);
} else if (info->italic_p && use_fonts) {
- if (temp = string_dictionary_Fetch(termcap_dict, "B.u"))
+ temp = string_dictionary_Fetch(termcap_dict, "B.u");
+ if (temp)
item = string_Concat2(item, temp);
}
temp = string_CreateFromData(info->str, info->len);
free(temp);
if (info->bold_p && use_fonts) {
- if (temp = string_dictionary_Fetch(termcap_dict, "E.bold"))
+ temp = string_dictionary_Fetch(termcap_dict, "E.bold");
+ if (temp)
item = string_Concat2(item, temp);
} else if (info->italic_p && use_fonts) {
- if (temp = string_dictionary_Fetch(termcap_dict, "E.u"))
+ temp = string_dictionary_Fetch(termcap_dict, "E.u");
+ if (temp)
item = string_Concat2(item, temp);
}
static string last_get_field_call_result = NULL;
if (is_number_variable(name)) {
- if (result = string_dictionary_Fetch(number_variable_dict, name))
+ result = string_dictionary_Fetch(number_variable_dict, name);
+ if (result)
return(result);
/*
#include "xmark.h"
#include "error.h"
#include "xrevstack.h"
+#include "X_driver.h"
/*
*
*/
#if (!defined(lint) && !defined(SABER))
-static char rcsid_xmark_c[] = "$Id$";
+static const char rcsid_xmark_c[] = "$Id$";
#endif
#include <zephyr/mit-copyright.h>
#define _XREVSTACK_H_
#if (!defined(lint) && !defined(SABER))
-static char rcsid_xrevstack_h[] = "$Id$";
+static const char rcsid_xrevstack_h[] = "$Id$";
#endif
#include <zephyr/mit-copyright.h>
} else if (target==XA_STRING) {
char *selected;
- if (selected = getSelectedText()) {
+ selected = getSelectedText();
+ if (selected) {
ChangeProp(XA_STRING,8,selected,string_Length(selected));
} else {
/* This should only happen if the pasting client is out of
#endif
if ((ownership_start == CurrentTime) ||
- ((selreq->time != CurrentTime) &&
- (selreq->time < ownership_start) ||
+ (((selreq->time != CurrentTime) &&
+ (selreq->time < ownership_start)) ||
((ownership_end != CurrentTime) &&
(ownership_end > ownership_start) &&
(selreq->time > ownership_end))))
#define max(a,b) ((a)>(b)?(a):(b))
XContext desc_context;
-static pointer_dictionary colorname_dict = NULL;
extern int internal_border_width;
extern unsigned long default_bgcolor;
static char buffer[40];
char *temp;
- if (temp = getenv("WGFILE"))
+ temp = getenv("WGFILE");
+ if (temp)
return(temp);
else {
sprintf(buffer, "/tmp/wg.%d", getuid());
* not one of the allowed ones, print an error and treat it as
* EXPOSE_NONE.
*/
- if (temp = ZGetVariable("exposure")) {
+ temp = ZGetVariable("exposure");
+ if (temp) {
if (!(exposure = ZParseExposureLevel(temp))) {
ERROR2("invalid exposure level %s, using exposure level none instead.\n", temp);
exposure = EXPOSE_NONE;
#ifndef zephyr_MODULE
#define zephyr_MODULE
+#include <zephyr/zephyr.h>
+
extern void zephyr_init(void(*)(ZNotice_t *));
extern void finalize_zephyr(void);
extern void write_wgfile(void);