source: trunk/athena/bin/gms/view_message_by_zephyr.c @ 7288

Revision 7288, 1.5 KB checked in by vrt, 30 years ago (diff)
Ultrix changes for 4.3 style syslog
Line 
1/* This file is part of the Project Athena Global Message System.
2 * Created by: Mark W. Eichin <eichin@athena.mit.edu>
3 * $Source: /afs/dev.mit.edu/source/repository/athena/bin/gms/view_message_by_zephyr.c,v $
4 * $Author: vrt $
5 *
6 *      Copyright (c) 1988 by the Massachusetts Institute of Technology.
7 *      For copying and distribution information, see the file
8 *      "mit-copyright.h".
9 */
10#include <mit-copyright.h>
11#ifndef lint
12static char rcsid_view_message_by_zephyr_c[] = "$Header: /afs/dev.mit.edu/source/repository/athena/bin/gms/view_message_by_zephyr.c,v 1.2 1994-04-30 13:17:44 vrt Exp $";
13#endif lint
14
15#include "globalmessage.h"
16#include <pwd.h>
17#include <stdio.h>
18#include <strings.h>
19#ifndef ultrix
20#include <syslog.h>
21#else
22#include <nsyslog.h>
23#endif
24
25void view_message_by_zephyr(message)
26     char *message;
27{
28  char *whoami, *getlogin();
29  char *ptr;
30 
31  whoami = getlogin();
32
33  if(!whoami) {
34    struct passwd *pw;
35    pw = getpwuid(getuid());
36    if(pw) {
37      whoami = pw->pw_name;
38    } else {
39      fprintf(stderr,
40              "get_message: couldn't find username to send zephyr notice\n");
41      exit(2);
42    }
43  }
44  /* skip magic headers */
45  ptr = index(message, '\n')+1;
46 
47  /* check that there is *something* after the headers */
48  if(*ptr) {
49    /* don't even fork... this just exits anyway... */
50    execl("/usr/athena/zwrite",
51          "zwrite", "-d", "-q", "-n",  whoami, "-m", ptr, 0);
52    /* put logging here in case the exec fails. */
53    syslog(LOG_INFO, "GMS client execl of zwrite failed [%s]",
54           error_message(errno));
55  }
56}
Note: See TracBrowser for help on using the repository browser.