diff options
author | Karl Ramm <kcr@mit.edu> | 2009-03-15 18:39:20 +0000 |
---|---|---|
committer | Karl Ramm <kcr@mit.edu> | 2009-03-15 18:39:20 +0000 |
commit | ff385ade8355ce6c685bbabd83c550fbb3c58f82 (patch) | |
tree | e4b064412a940072b9910e23be6bda6947166efe | |
parent | b3e575112d05c12cb7f3ef280bd268e18744f8ed (diff) |
charset in zwrite, incomplete in zwgc
-rw-r--r-- | clients/zwrite/zwrite.c | 18 | ||||
-rw-r--r-- | h/zephyr/zephyr.h | 2 | ||||
-rw-r--r-- | lib/Makefile.in | 2 | ||||
-rw-r--r-- | zwgc/notice.c | 1 |
4 files changed, 16 insertions, 7 deletions
diff --git a/clients/zwrite/zwrite.c b/clients/zwrite/zwrite.c index 1774aaf..034ef09 100644 --- a/clients/zwrite/zwrite.c +++ b/clients/zwrite/zwrite.c @@ -38,14 +38,14 @@ void usage(char *); void send_off(ZNotice_t *, int); int -main(int argc, - char *argv[]) +main(int argc, char *argv[]) { int retval, arg, nocheck, nchars, msgsize, filsys, tabexpand; char *message, *signature = NULL, *format = NULL; static char bfr[BUFSIZ], classbfr[BUFSIZ], instbfr[BUFSIZ], sigbfr[BUFSIZ]; static char opbfr[BUFSIZ]; static ZNotice_t notice; + char *charset = NULL; whoami = argv[0]; @@ -90,7 +90,7 @@ main(int argc, arg = 1; - for (;arg<argc&&!msgarg;arg++) { + for (;arg<argc && !msgarg; arg++) { if (*argv[arg] != '-') { recips[nrecips++] = argv[arg]; continue; @@ -183,6 +183,12 @@ main(int argc, case 'C': cc = 1; break; + case 'x': + if (arg == argc-1) + usage(whoami); + arg++; + charset = argv[arg]; + break; default: usage(whoami); } @@ -228,6 +234,7 @@ main(int argc, notice.z_sender = 0; notice.z_message_len = 0; notice.z_recipient = ""; + notice.z_charset = ZGetCharset(charset); if (format) notice.z_default_format = format; else if (filsys == 1) @@ -343,8 +350,7 @@ main(int argc, } void -send_off(ZNotice_t *notice, - int real) +send_off(ZNotice_t *notice, int real) { int i, success, retval; char bfr[BUFSIZ], realm_recip[BUFSIZ], dest[3 * BUFSIZ]; @@ -454,7 +460,7 @@ usage(char *s) fprintf(stderr, "Usage: %s [-a] [-o] [-d] [-v] [-q] [-n] [-t] [-u] [-l]\n\ \t[-c class] [-i inst] [-O opcode] [-f fsname] [-s signature] [-C]\n\ -\t[user ...] [-F format] [-r realm] [-m message]\n", s); +\t[user ...] [-F format] [-r realm] [-x charset] [-m message]\n", s); fprintf(stderr,"\t-f and -c are mutually exclusive\n\ \t-f and -i are mutually exclusive\n\ \trecipients must be specified unless -c or -f specifies a class\n\ diff --git a/h/zephyr/zephyr.h b/h/zephyr/zephyr.h index 9dab437..a19f050 100644 --- a/h/zephyr/zephyr.h +++ b/h/zephyr/zephyr.h @@ -234,6 +234,8 @@ Code_t ZUnsubscribeTo(ZSubscription_t *sublist, int nitems, Code_t ZCancelSubscriptions(unsigned int port); int ZPending(void); Code_t ZReceiveNotice(ZNotice_t *notice, struct sockaddr_in *from); +unsigned short ZGetCharset(char *charset); +const char *ZCharsetToString(unsigned short charset); #ifdef Z_DEBUG void Z_debug(const char *, ...); #endif diff --git a/lib/Makefile.in b/lib/Makefile.in index 1e80f84..8a9cd2d 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -40,7 +40,7 @@ OBJS = zephyr_err.lo ZAsyncLocate.lo ZCkAuth.lo ZCkIfNot.lo ZClosePort.lo \ ZRecvNot.lo ZRecvPkt.lo ZRetSubs.lo ZSendList.lo ZSendNot.lo \ ZSendPkt.lo ZSendRaw.lo ZSendRLst.lo ZSetDest.lo ZSetFD.lo ZSetSrv.lo \ ZSubs.lo ZVariables.lo ZWait4Not.lo Zinternal.lo ZMakeZcode.lo \ - ZReadZcode.lo ZCkZAut.lo quad_cksum.lo + ZReadZcode.lo ZCkZAut.lo quad_cksum.lo charset.lo .SUFFIXES: .lo diff --git a/zwgc/notice.c b/zwgc/notice.c index b3a660c..ca257cd 100644 --- a/zwgc/notice.c +++ b/zwgc/notice.c @@ -265,6 +265,7 @@ decode_notice(ZNotice_t *notice, var_set_variable("instance", notice->z_class_inst); var_set_variable("opcode", notice->z_opcode); var_set_variable("default", notice->z_default_format); + var_set_variable("charset", ZCharsetToString(notice->z_charset)); var_set_variable("recipient", (notice->z_recipient[0] ? notice->z_recipient : "*")); var_set_variable("fullsender", notice->z_sender); |