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

Revision 9039, 1.5 KB checked in by ghudson, 28 years ago (diff)
Correct style to be consistent with surrounding code.
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: ghudson $
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.6 1996-10-04 04:01:08 ghudson Exp $";
13#endif lint
14
15#include "globalmessage.h"
16#include <pwd.h>
17#include <stdio.h>
18#include <stdlib.h>
19#include <syslog.h>
20
21void view_message_by_zephyr(message)
22     char *message;
23{
24  char *whoami, *getlogin();
25  char *ptr;
26 
27  whoami = getenv("USER");
28 
29  if(!whoami)
30    whoami = getlogin();
31 
32  if(!whoami) {
33    struct passwd *pw;
34    pw = getpwuid(getuid());
35    if(pw) {
36      whoami = pw->pw_name;
37    } else {
38      fprintf(stderr,
39              "get_message: couldn't find username to send zephyr notice\n");
40      exit(2);
41    }
42  }
43  /* skip magic headers */
44  ptr = strchr(message, '\n')+1;
45 
46  /* check that there is *something* after the headers */
47  if(*ptr) {
48    /* don't even fork... this just exits anyway... */
49    execl("/usr/athena/bin/zwrite",
50          "zwrite", "-d", "-q", "-n",  whoami, "-m", ptr, 0);
51    /* put logging here in case the exec fails. */
52    syslog(LOG_INFO, "GMS client execl of zwrite failed [%s]",
53           error_message(errno));
54  }
55}
Note: See TracBrowser for help on using the repository browser.