home *** CD-ROM | disk | FTP | other *** search
- Subject: v15i029: Network message system, sort of like wall
- Newsgroups: comp.sources.unix
- Approved: rsalz@uunet.UU.NET
-
- Submitted-by: Paul Davison <cs.qmc.ac.uk!pd>
- Posting-number: Volume 15, Issue 29
- Archive-name: net-notify
-
- Here's a message sending program for distributed networks that I thought
- you might be interested in. Full documentation and a Makefile are
- included. I am the author, and I declare it to be in the public domain.
-
- In our lab, it soon became obvious to me that some quick and efficient way
- of sending short messages to users of the network was needed, without the
- sender having to be aware of the physical location of the recipient.
- Therefore I wrote a network-wide message system, which is presented here.
- It is a one-shot mechanism, similar to "wall", expect that it can be sent
- to specific users or specific machines.
-
- The server is invoked from inetd, so appropriate entries have to be
- inserted in either "inetd.conf" or "servers", depending on the machine,
- and also in "services", of course. I have found this software extremely
- useful and hope that others find it so as well.
-
- The program has been tested under Sequent's DYNIX, 4.2BSD, Sun 3.4, and
- Whitechapel 42nix. It won't work with System V.
-
- Cheers,
- Paul Davison.
- --
- Paul Davison
-
- UUCP: pd@qmc-cs.uucp or ...seismo!mcvax!ukc!qmc-cs!pd
- Internet: pd@cs.qmc.ac.uk Post: Dept of Computer Science
- JANET: pd@uk.ac.qmc.cs Queen Mary College
- Easylink: 19019285 University of London
- Telex: 893750 QMCUOL G Mile End Road
- Fax: +44 1 981 7517 London E1 4NS
- Voice: +44 1 980 4811 x3950 England
-
- # This is a shar archive.
- # Remove everything above and including the cut line.
- # Then run the rest of the file through sh.
- #--------cut--------cut--------cut--------cut--------cut--------
- #! /bin/sh
- # shar: Shell Archiver
- # Run the following with /bin/sh to create:
- # README
- # inform.1
- # notifyd.8
- # Makefile
- # in.notifyd.c
- # inform.c
- # init_socket_out.c
- # wcwin.notifyd.c
- # notify.h
- # services
- # servers
- # inetd.conf
- echo shar: extracting "README" '('996 chars')'
- if test -f README
- then
- echo shar: will not overwrite existing file "README"
- else
- cat << \SHAR_EOF > README
- Here at QMC we run a large network of machines, with a VAX, a Sequent
- Balance, and some Suns serving files via NFS. The undergradute lab
- consists of 43 Whitechapel MG1's, all providing the same "virtual"
- system to the users. It became obvious to me that some quick and
- efficient way of sending short messages to users of the network was
- needed, without the sender having to be aware of the physical location of the
- recipient. Therefore I wrote a network-wide message system, which is
- presented here. It is a one-shot mechanism, similar to "wall", expect
- that it can be sent to specific users or specific machines.
-
- The server is invoked from inetd, so appropriate entries have to be
- inserted in either "inetd.conf" or "servers", depending on the machine, and
- also in "services", of course. I have found this software extremely
- useful and hope that others find it so as well.
-
- The program has been tested under Sequent's DYNIX, 4.2BSD, Sun 3.4, and
- Whitechapel 42nix. It won't work with System V.
- SHAR_EOF
- if test 996 -ne `wc -c < README`
- then
- echo shar: error transmitting "README" '('should be 996 chars')'
- else
- echo README
- fi
- fi
- echo shar: extracting "inform.1" '('1909 chars')'
- if test -f inform.1
- then
- echo shar: will not overwrite existing file "inform.1"
- else
- cat << \SHAR_EOF > inform.1
- .TH INFORM 1 LOCAL "18th March 1988"
- .SH NAME
- inform \- network message sender
- .SH SYNOPSIS
- .B inform
- [
- .B -m
- ][
- .B -s
- ][
- .B -w
- ][
- .B -v
- ]
- .I "users or machines..."
- .SH DESCRIPTION
- .I Inform
- is used to send one-off messages either to a list of people who are
- logged in somewhere on the network, or to a list of machines on the net.
- The standard action is to send to users. The
- .B -m
- flag causes
- .I inform
- to expect machine names instead.
- .PP
- The message is typed in directly, and ends either with a CTRL-D or a
- line containing a single ".".
- .I Inform
- then forks itself and sits in the background sending the messages to all
- appropriate machines. The information in the
- .I rwho
- directory is used to ascertain who is logged on where.
- The
- .B -v
- flag sets verbose mode, so that the program doesn't fork and tells you
- which machines are being sent to. The
- .B -w
- flag sets visual mode for the recipient. Currently this only works on
- Whitechapels, but versions for other machines could be written. The
- Whitechapel visual mode bounces an icon around the screen, which then
- opens up into a window containing the message.
- .PP
- Finally, the
- .B -s
- flag prevents the normal "Message from pd@sequent ..." style of message
- header from being printed. This is useful for messages generated
- automatically by programs; it is used at QMC for mail notification and
- network status information.
- .SH BUGS
- The
- .I rwho
- data structures set a limit of 41 users on each machine in the network.
- If there are more than this on any machine then only the first 41 are
- written into the database. This means that if you are the 42nd or higher
- user, you will not receive the messages. This is extremely frustrating!
- .SH FILES
- /usr/spool/rwho for information on who is logged in, on which machine.
- .SH SEE ALSO
- notifyd(8)
- .SH AUTHOR
- Paul Davison at Queen Mary College, University of London. I would love
- to hear about any bugs or improvements.
- SHAR_EOF
- if test 1909 -ne `wc -c < inform.1`
- then
- echo shar: error transmitting "inform.1" '('should be 1909 chars')'
- else
- echo inform.1
- fi
- fi
- echo shar: extracting "notifyd.8" '('1425 chars')'
- if test -f notifyd.8
- then
- echo shar: will not overwrite existing file "notifyd.8"
- else
- cat << \SHAR_EOF > notifyd.8
- .TH NOTIFYD 8 LOCAL "18th March 1988"
- .SH NAME
- in.notifyd
- .SH SYNOPSIS
- in.notifyd is run from
- .I inetd.
- .SH DESCRIPTION
- The
- .I notifyd
- daemon runs on a machine at the receiving end of a message generated by
- .I inform.
- Depending on the type of message, it either sends it to all logged in
- users, or to a particular one. The messages are written irrespective of
- the user's tty permissions. Therefore it is sensible to restrict
- execution of
- .I inform
- to an appropriate group such as
- .B operator
- or
- .B wheel,
- unless all your users are very responsible.
- .PP
- Another version of
- .I notifyd
- for Whitechapel MG1's can be used to provide a visual message if the
- .I -w
- option is used in
- .I inform.
- This expects to find an icon in /usr/lib/icons entitled "not.icn", which
- is the default. If the icon has a text box, this will be filled in with
- the sender's name. If an icon exists in /usr/lib/icons with the name of
- the sender appended with "icn" (such as "pd.icn") then this icon is used
- instead. This is used for personal icons, and is used at QMC for mail
- notification purposes.
- .PP
- The files
- .I /etc/servers
- or
- .I /etc/inetd.conf,
- and
- .I /etc/servcices
- must be updated to make this software work. Example entries are included
- in the distribution.
- .SH BUGS
- None that I can remember!
- .SH SEE ALSO
- inform(1)
- .SH AUTHOR
- Paul Davison at Queen Mary College, University of London. I would love
- to hear about any bugs or improvements.
- SHAR_EOF
- if test 1425 -ne `wc -c < notifyd.8`
- then
- echo shar: error transmitting "notifyd.8" '('should be 1425 chars')'
- else
- echo notifyd.8
- fi
- fi
- echo shar: extracting "Makefile" '('411 chars')'
- if test -f Makefile
- then
- echo shar: will not overwrite existing file "Makefile"
- else
- cat << \SHAR_EOF > Makefile
- all: inform in.notifyd
-
- in.notifyd: notify.h in.notifyd.o
- cc in.notifyd.o -o in.notifyd
-
- wcwin.notifyd: wcwin.notifyd.c
- ccg wcwin.notifyd.c -o wcwin.notifyd
-
- inform: notify.h inform.o init_socket_out.o
- cc inform.o init_socket_out.o -o inform
-
- install:
- strip in.notifyd
- cp in.notifyd /usr/etc
- strip inform
- cp inform /usr/local/bin
- cp inform.1 /usr/man/man1
- cp notifyd.8 /usr/man/man8
-
- .c.o:
- cc -c $*.c
- SHAR_EOF
- if test 411 -ne `wc -c < Makefile`
- then
- echo shar: error transmitting "Makefile" '('should be 411 chars')'
- else
- echo Makefile
- fi
- fi
- echo shar: extracting "in.notifyd.c" '('1444 chars')'
- if test -f in.notifyd.c
- then
- echo shar: will not overwrite existing file "in.notifyd.c"
- else
- cat << \SHAR_EOF > in.notifyd.c
- #include "notify.h"
- #include <utmp.h>
- #include <sys/file.h>
-
- #define UTMP "/etc/utmp"
-
- int my_socket = 0; /* inetd gives us fd 0 */
- notify data;
- int debug = 0; /* set to 1 for debug output on fp 'out' */
- char *progname;
- FILE *out;
-
- main(argc,argv)
- int argc;
- char *argv[];
- {
- int c,fromlen;
- struct sockaddr_in from;
- out = stderr; /* or fopen ("/dev/console","w"); */
- progname = argv[0];
- c = recvfrom(my_socket, &data, sizeof(notify), 0,
- (struct sockaddr *) &from, &fromlen);
- if(debug)
- fprintf(out,"RECVD to %s data %s ID %s type %d size %d\n",
- data.to, data.mess, data.id, data.type, c);
- if (c != sizeof(notify)) exit(0);
- if(debug)
- fprintf(out,"Size OK\n");
- if(!strcmp(data.id,"notify")) show(data);
- if(debug)
- fprintf(out,"Showed data OK\n");
- exit (0);
- }
-
- show(data) /* this version ignores the windowing options */
- notify data;
- {
- int fd;
- FILE *fp;
- struct utmp entry;
- char tty[20];
-
- fd = open(UTMP,O_RDONLY,NULL);
- if (fd < 0) return;
- while (read(fd, &entry, sizeof(struct utmp)) > 0) {
- if ((data.type == MACHINE_WIDE) ||
- (data.type == MACH_AND_WIN)||
- (!strncmp(data.to,entry.ut_name,8))) {
- strcpy(tty,"/dev/");
- if (strncmp("tty",entry.ut_line,3)) continue;
- if (*entry.ut_name == '\0') continue;
- strncat(tty,entry.ut_line,8);
- fp = fopen(tty,"w");
- if (debug) fprintf(out,"Trying %s\n",tty);
- if (fp == NULL) continue;
- fprintf(fp,"%s",data.mess);
- fclose(fp);
- }
- }
- close(fd);
- }
- SHAR_EOF
- if test 1444 -ne `wc -c < in.notifyd.c`
- then
- echo shar: error transmitting "in.notifyd.c" '('should be 1444 chars')'
- else
- echo in.notifyd.c
- fi
- fi
- echo shar: extracting "inform.c" '('3859 chars')'
- if test -f inform.c
- then
- echo shar: will not overwrite existing file "inform.c"
- else
- cat << \SHAR_EOF > inform.c
- #include "notify.h"
- #include <pwd.h>
- #include <protocols/rwhod.h>
- #include <sys/dir.h>
- #include <sys/time.h>
-
- notify data;
- int debug = 0, verbose=0, windowed=0;
- char *progname;
- int listlen;
- char hostlist[500][32];
- int silent=0, broadcast=0;
-
- struct whod wd;
-
- #define WHDRSIZE (sizeof(wd) - sizeof(wd.wd_we))
- #define RWHODIR "/usr/spool/rwho"
-
- extern int my_socket;
- extern struct sockaddr_in all;
-
- main(argc,argv)
- int argc;
- char *argv[];
- {
- int i,j;
- int c,pid;
- char *p = data.mess;
- char host[32];
- struct passwd *entry = getpwuid(getuid());
- struct tm *loctime;
- struct timeval tp;
-
- progname = argv[0];
- if (argc <2) {
- fprintf(stderr, "Usage: %s [-m][-s][-w] user/machine [user ..]\n",argv[0]);
- exit(1);
- }
- strncpy(data.from,entry->pw_name,8);
- for (i=1;i<argc;i++) {
- if(!strcmp(argv[i],"-s"))
- silent++;
- else if (!strcmp(argv[i],"-m"))
- broadcast++;
- else if (!strcmp(argv[i],"-v"))
- verbose++;
- else if (!strcmp(argv[i],"-w"))
- windowed++;
- else if (!strncmp(argv[i],"-o",2))
- strncpy(data.from,&argv[i][2],8);
- }
- if (*data.from == '\0') strcpy(data.from, "anon");
-
- if(broadcast && !windowed) data.type = MACHINE_WIDE;
- else if(windowed && !broadcast) data.type = WINDOWED;
- else if(windowed && broadcast) data.type = MACH_AND_WIN;
- else data.type = PERSON_ONLY;
-
- gettimeofday(&tp, (struct timezone *)NULL);
- loctime = localtime(&tp);
-
- if(!silent) {
- gethostname(host,32);
- sprintf(data.mess,"\n\rMessage from %.8s@%s [%02d:%02d]... \n\r\n\r%c",
- data.from,host,loctime->tm_hour,loctime->tm_min,7);
- p = &data.mess[strlen(data.mess)];
- }
- while((c=getc(stdin)) != EOF) {
- *p++ = c;
- if (c == '\n') *p++ = '\r';
- if((p - data.mess) >= MESS_SIZE) {
- fprintf(stderr,"%s: message too long\n",argv[0]);
- exit(1);
- }
- if (!strncmp((p-5),"\n\r.\n\r",5)) {
- fclose (stdin);
- p -= 3;
- }
- }
- *p = NULL;
- if (debug) printf("Data is %s\n",data.mess);
-
- if(!verbose) {
- while ((pid=fork()) < 0) sleep(5);
- if (pid) exit(0); /* fork child to save delays */
- }
-
- strcpy(data.id,"notify");
-
- if (verbose && broadcast)
- printf("Broadcasting to");
- for(i=1;i<argc;i++) {
- listlen=0;
- if (*argv[i]=='-') continue;
- if (!broadcast) {
- makehostlist(argv[i]);
- strncpy(data.to, argv[i], 8);
- if (verbose)
- printf("For %s writing to machines",argv[i]);
- for(j=0;j<listlen;j++) {
- init_socket(0,hostlist[j]);
- if (verbose) {
- printf(" %s",hostlist[j]);
- fflush(stdout);
- }
- sendto(my_socket, &data, sizeof(notify),0,
- &all, sizeof(all));
- }
- } else {
- if (verbose) {
- printf(" %s",argv[i]);
- fflush(stdout);
- }
- init_socket(0,argv[i]);
- strcpy(data.to,"nobody");
- sendto(my_socket, &data, sizeof(notify),0,
- &all, sizeof(all));
- }
- if (!broadcast && verbose) printf(".\n");
- if (debug)
- printf("TO %s ID %s MESS %s\n",data.to, data.id,
- data.mess);
- close(my_socket);
- }
- if (verbose && broadcast) printf(".\n");
- }
-
- makehostlist(name)
- char *name;
- {
- int i,cc,f,n;
- DIR *rwhodir;
- struct direct *dp;
- register struct whod *w = &wd;
- register struct whoent *we;
-
- if(chdir(RWHODIR) <0) {
- perror(RWHODIR);
- exit(1);
- }
- rwhodir = opendir(".");
- if (rwhodir == NULL) {
- perror(RWHODIR);
- exit(1);
- }
-
- listlen=0;
- while (dp=readdir(rwhodir)) {
- if(dp->d_ino == 0)
- continue;
- if(strncmp(dp->d_name,"whod.",5))
- continue;
- f = open(dp->d_name,0);
- if (f < 0) continue;
- cc = read(f,(char *)&wd,sizeof(struct whod));
- if (cc < WHDRSIZE) {
- close(f);
- continue;
- }
- we = w->wd_we;
- cc -= WHDRSIZE;
- for(n=cc/sizeof(struct whoent); n>0; n--) {
- if(!strncmp(we->we_utmp.out_name,name,8)) {
- addtolist(w->wd_hostname);
- break;
- }
- we++;
- }
- close(f);
- }
- closedir(rwhodir);
- }
-
- addtolist(host)
- char *host;
- {
- register int i;
- for(i=0;i<listlen;i++)
- if(!strcmp(host,hostlist[i])) return;
- strcpy(hostlist[listlen++],host);
- }
- SHAR_EOF
- if test 3859 -ne `wc -c < inform.c`
- then
- echo shar: error transmitting "inform.c" '('should be 3859 chars')'
- else
- echo inform.c
- fi
- fi
- echo shar: extracting "init_socket_out.c" '('1842 chars')'
- if test -f init_socket_out.c
- then
- echo shar: will not overwrite existing file "init_socket_out.c"
- else
- cat << \SHAR_EOF > init_socket_out.c
- #include "notify.h"
- #include <netdb.h>
-
- int my_socket;
- struct sockaddr_in my_address;
- struct sockaddr_in all; /* broadcast address */
-
- extern char *progname;
- extern int debug;
-
- init_socket(trigger,rhost)
- int trigger;
- char *rhost;
- {
- char host[128];
- char *service_name;
- long host_net;
- struct in_addr *host_addr, *tohost_addr;
-
- struct hostent *hp, *tohp;
- struct servent *sp;
- int bound;
-
- my_socket = socket(AF_INET, SOCK_DGRAM, 0, 0);
- if (my_socket < 0) {
- perror(progname);
- exit(-1);
- }
-
- /* Get any old local port and the local address */
-
- my_address.sin_addr.s_addr = INADDR_ANY;
- my_address.sin_port = 0;
-
- bound = bind(my_socket, &my_address, sizeof(my_address), 0);
- if (bound < 0) {
- perror(progname);
- exit(-1);
- }
-
- /* Now create the broadcast address with the well known
- * port number - use a different number according to the
- * value of "trigger".
- */
-
- gethostname(host, sizeof(host));
-
- hp = gethostbyname(host);
- if (hp == NULL) {
- fprintf(stderr,"%s: couldn't get hostent ", progname);
- perror(host);
- }
- tohp = gethostbyname(rhost);
- if (tohp == NULL) {
- fprintf(stderr,"%s: couldn't get hostent ", progname);
- perror(rhost);
- }
-
- host_addr = (struct in_addr *) hp->h_addr;
- host_net = inet_netof(host_addr->s_addr);
-
- tohost_addr = (struct in_addr *) tohp->h_addr;
-
- service_name = SERVICE_NAME;
- sp = getservbyname(service_name, "udp");
- if (sp == NULL) {
- perror(progname);
- }
-
- all.sin_family = AF_INET;
- all.sin_addr = *(struct in_addr *)(tohp -> h_addr);
- all.sin_port = sp->s_port;
-
- if (debug) {
- printf("Broadcast address = (%08x) = %s, %d (family %d)\n",
- all.sin_addr.s_addr,
- inet_ntoa(all.sin_addr),
- htons(all.sin_port),
- all.sin_family);
- }
- }
- SHAR_EOF
- if test 1842 -ne `wc -c < init_socket_out.c`
- then
- echo shar: error transmitting "init_socket_out.c" '('should be 1842 chars')'
- else
- echo init_socket_out.c
- fi
- fi
- echo shar: extracting "wcwin.notifyd.c" '('4554 chars')'
- if test -f wcwin.notifyd.c
- then
- echo shar: will not overwrite existing file "wcwin.notifyd.c"
- else
- cat << \SHAR_EOF > wcwin.notifyd.c
- #include "notify.h"
- #include <utmp.h>
- #include <sys/file.h>
- #include <win.h>
- #include <pen.h>
- #include <signal.h>
- #include <icon.h>
- #include <pen.h>
- #include <rfont.h>
-
- static int panel;
- static RSize posn, ipos;
- static RSize size;
- static Raster * raster;
- static Window * window;
- static Pen * pen;
- static Raster * RasterCreate ();
- static Window * WinCreate ();
- static Pen * PenCreate ();
- static IconList *iconlist;
- void pdIconWriteLabels();
-
- int pageno = 0;
- int stopit();
-
- #define UTMP "/etc/utmp"
-
- int my_socket = 0;
- notify data;
- int debug = 0;
- char *progname;
- FILE *out;
-
- main(argc,argv)
- int argc;
- char *argv[];
- {
- int c,fromlen;
- struct sockaddr_in from;
-
- out = stdout;
- progname = argv[0];
- c = recvfrom(my_socket, &data, sizeof(notify), 0,
- (struct sockaddr *) &from, &fromlen);
- if(fork() >0) exit(0);
- if(debug)
- fprintf(out,"RECVD to %s data %s ID %s type %d size %d\n",
- data.to, data.mess, data.id, data.type, c);
- if (c != sizeof(notify)) exit(0);
- if(debug)
- fprintf(out,"Size OK\n");
- if(!strcmp(data.id,"notify")) show(data);
- if(debug)
- fprintf(out,"Showed data OK\n");
- exit (0);
- }
-
- show(data)
- notify data;
- {
- int fd, showit=0;
- FILE *fp;
- struct utmp entry;
- char tty[20];
-
- fd = open(UTMP,O_RDONLY,NULL);
- if (fd < 0) return;
- while (read(fd, &entry, sizeof(struct utmp)) > 0) {
- if ((data.type == MACHINE_WIDE) ||
- (data.type == MACH_AND_WIN) ||
- (!strncmp(data.to,entry.ut_name,8))) {
- strcpy(tty,"/dev/");
- if (strncmp("tty",entry.ut_line,3)) continue;
- if (*entry.ut_name == '\0') continue;
- if (((data.type == WINDOWED)||
- (data.type == MACH_AND_WIN)) &&
- (entry.ut_line[3]=='v')) {
- showit++;
- continue;
- }
- strncat(tty,entry.ut_line,8);
- fp = fopen(tty,"w");
- if (debug) fprintf(out,"Trying %s\n",tty);
- if (fp == NULL) continue;
- fprintf(fp,"%s",data.mess);
- fclose(fp);
- }
- }
- close(fd);
-
- if(showit) {
- MGblast(data.mess, data.from);
- }
- }
-
- MGblast(buf,from)
- char *buf, *from;
- {
- int i=0,j;
- int lineno = 10;
- Event event;
-
- show_page(pageno,from,buf);
- at(5,lineno);
- for (j=0;j<strlen(buf);j++) {
- if((++i % 115) == 0 || (buf[j] == '\n')) {
- at(5,lineno);
- lineno += 10;
- i = 1;
- }
- else if ((buf[j] > 31) && (buf[j] < 128))
- writech(buf[j]);
- }
- page_update();
- signal(SIGALRM,stopit);
- alarm(600); /* 10 minutes */
- PanelRead(panel,&event,1);
- }
-
-
- show_page (pos,sentfrom,mess)
- int pos;
- char *sentfrom, *mess;
- {
- int i;
- char iconname[80];
- posn.w = 160;
- posn.h = 300;
- size.w = 700;
- size.h = 10*linecount(mess)+5;
- if(size.h <40) size.h = 40;
- ipos.w = 980;
- ipos.h = 0;
- raster = RasterCreate (size.w, size.h, 0, R_PIXD (1));
- pen = PenCreate (raster);
- strcpy(iconname,sentfrom);
- strcat(iconname,".icn");
- iconlist = (IconList *)IconListRead(iconname,NULL);
- if(iconlist == NULL)
- iconlist = (IconList *)IconListRead("not.icn",NULL);
- pdIconWriteLabels(iconlist,sentfrom);
- window = WinCreate (&posn, &size, 0, &ipos, NULL, 1, iconlist,
- sentfrom, NULL, W_FULL_TYPE);
- panel = WinGetPanel (window);
- PanelSetMask(panel,E_CLICK_CLASS | E_SEL_CLASS);
- PageDefine (panel, 0, raster, NULL, NULL);
- PageSelect (panel, 0);
- PanelUpdate (panel, 0, 1);
- WinDisplay (window);
- }
-
- kill_page () {
- WinDestroy (window);
- PenDestroy (pen);
- RasterDestroy (raster);
- }
-
- writech(c) char c;
- {
- TextWritef(pen,"%c",c);
- }
-
-
- page_update () {
- PanelUpdate(panel,0,1);
- ipos.w = 0;
- IconSetPosition(WinGetID(window), &ipos);
- ipos.h = 760;
- IconSetPosition(WinGetID(window), &ipos);
- ipos.w = 980;
- IconSetPosition(WinGetID(window), &ipos);
- ipos.h = 0;
- IconSetPosition(WinGetID(window), &ipos);
- IconShow(WinGetID(window));
- WindowUnstow(WinGetID(window));
- }
-
- at (x, y)
- int x,
- y;
- {
- PenSetXY (pen, x, y);
- }
-
- int linecount(s)
- char *s;
- { int lines=0;
- while(*s != NULL)
- if(*(s++) == '\n') lines++;
- return lines;
- }
-
- int stopit()
- {
- exit(0);
- }
-
- static Pen *mypen = 0;
-
- void pdIconWriteLabels (ilist, label)
- IconList *ilist;
- char *label;
- {
- register Icon *ip = ilist->Icons;
- int i;
- RFont *font;
-
- if (!mypen)
- mypen = PenCreate (ip->Image);
- font = (RFont *)FontAcquire("stdicon","i",8);
- PenSetFont(mypen,font);
-
- for (i = ilist->Count; i != 0; i--, ip++) {
- PenSetSheet (mypen, ip->Image);
-
- if (ip->TextBox.size.w != 0 && ip->TextBox.size.h != 0) {
- PenSetPos (mypen, &ip->TextBox.pos);
- TextCentreStr (mypen, label, &ip->TextBox.size);
- }
- }
- }
- SHAR_EOF
- if test 4554 -ne `wc -c < wcwin.notifyd.c`
- then
- echo shar: error transmitting "wcwin.notifyd.c" '('should be 4554 chars')'
- else
- echo wcwin.notifyd.c
- fi
- fi
- echo shar: extracting "notify.h" '('471 chars')'
- if test -f notify.h
- then
- echo shar: will not overwrite existing file "notify.h"
- else
- cat << \SHAR_EOF > notify.h
- #include <stdio.h>
- #include <sys/types.h>
- #include <sys/socket.h>
- #include <netinet/in.h>
- #include <arpa/inet.h>
-
- #define SERVICE_NAME "notify"
- #define MESS_SIZE 1000
-
- #define MACHINE_WIDE 0
- #define PERSON_ONLY 1
- #define WINDOWED 2
- #define MACH_AND_WIN 3
-
- typedef struct {
- char id[8];
- char mess[MESS_SIZE]; /* The message */
- char to[9]; /* who it's to */
- char from[9]; /* who it's from */
- char type; /* MACHINE_WIDE, PERSON or WINDOWED */
- } notify;
- SHAR_EOF
- if test 471 -ne `wc -c < notify.h`
- then
- echo shar: error transmitting "notify.h" '('should be 471 chars')'
- else
- echo notify.h
- fi
- fi
- echo shar: extracting "services" '('54 chars')'
- if test -f services
- then
- echo shar: will not overwrite existing file "services"
- else
- cat << \SHAR_EOF > services
- notify 1113/udp # for pd notify stuff
- SHAR_EOF
- if test 54 -ne `wc -c < services`
- then
- echo shar: error transmitting "services" '('should be 54 chars')'
- else
- echo services
- fi
- fi
- echo shar: extracting "servers" '('51 chars')'
- if test -f servers
- then
- echo shar: will not overwrite existing file "servers"
- else
- cat << \SHAR_EOF > servers
- notify udp /usr/etc/in.notifyd in.notifyd
- SHAR_EOF
- if test 51 -ne `wc -c < servers`
- then
- echo shar: error transmitting "servers" '('should be 51 chars')'
- else
- echo servers
- fi
- fi
- echo shar: extracting "inetd.conf" '('70 chars')'
- if test -f inetd.conf
- then
- echo shar: will not overwrite existing file "inetd.conf"
- else
- cat << \SHAR_EOF > inetd.conf
- notify dgram udp wait root /usr/etc/in.notifyd notifyd
- SHAR_EOF
- if test 70 -ne `wc -c < inetd.conf`
- then
- echo shar: error transmitting "inetd.conf" '('should be 70 chars')'
- else
- echo inetd.conf
- fi
- fi
- # End of shar archive
- exit 0
-
-
-