[27693] in Source-Commits

home help back first fref pref prev next nref lref last post

get_message commit: Deprecate the C get_message

daemon@ATHENA.MIT.EDU (Alexander Chernyakhovsky)
Mon Feb 10 20:50:03 2014

Date: Mon, 10 Feb 2014 20:49:56 -0500
From: Alexander Chernyakhovsky <achernya@MIT.EDU>
Message-Id: <201402110149.s1B1nu3e001967@drugstore.mit.edu>
To: source-commits@MIT.EDU

https://github.com/mit-athena/get_message/commit/08f97a1df298a24af3904ac0b3df9b2c36d0c426
commit 08f97a1df298a24af3904ac0b3df9b2c36d0c426
Author: Alexander Chernyakhovsky <achernya@mit.edu>
Date:   Sat Sep 7 16:47:44 2013 -0400

    Deprecate the C get_message
    
    The python version (based on gms.py) contains all the necessary
    functionality.

 Makefile.in               |   58 -----------------
 check_viewable.c          |  113 ---------------------------------
 configure.in              |   20 ------
 get_a_message.c           |   58 -----------------
 get_fallback_file.c       |   55 ----------------
 get_message.1             |   69 --------------------
 get_message.c             |   88 --------------------------
 get_message_from_server.c |  130 --------------------------------------
 get_servername.c          |   61 ------------------
 gethost_err.et            |   32 ---------
 gethost_errors.c          |   39 ------------
 hesiod_err.et             |   33 ----------
 hesiod_errors.c           |   40 ------------
 put_fallback_file.c       |  153 ---------------------------------------------
 read_to_memory.c          |   56 ----------------
 view_message_by_tty.c     |   28 --------
 view_message_by_zephyr.c  |   61 ------------------
 17 files changed, 0 insertions(+), 1094 deletions(-)

diff --git a/Makefile.in b/Makefile.in
deleted file mode 100644
index c2c7e3c..0000000
--- a/Makefile.in
+++ /dev/null
@@ -1,58 +0,0 @@
-# $Id: Makefile.in,v 1.1 1999-12-08 22:06:43 danw Exp $
-
-SHELL=/bin/sh
-VPATH=@srcdir@
-INSTALL=@INSTALL@
-INSTALL_PROGRAM=@INSTALL_PROGRAM@
-srcdir=@srcdir@
-top_srcdir=@top_srcdir@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-bindir=@bindir@
-mandir=@mandir@
-
-CC=@CC@
-DEFS=@DEFS@
-CPPFLAGS=@CPPFLAGS@
-CFLAGS=@CFLAGS@ ${WARN_CFLAGS} ${ERROR_CFLAGS}
-LDFLAGS=@LDFLAGS@
-LIBS=-lhesiod -lcom_err -lgms @LIBS@
-ALL_CFLAGS=${CPPFLAGS} ${CFLAGS} ${DEFS}
-
-all: get_message
-
-OBJS=	get_message.o check_viewable.o gethost_err.o \
-	gethost_errors.o get_a_message.o get_fallback_file.o \
-	get_message_from_server.o get_servername.o \
-	hesiod_err.o hesiod_errors.o \
-	put_fallback_file.o read_to_memory.o \
-	view_message_by_tty.o view_message_by_zephyr.o
-
-get_message: ${OBJS}
-	${CC} ${LDFLAGS} -o get_message ${OBJS} ${LIBS}
-
-gethost_err.h gethost_err.c: gethost_err.et
-	compile_et ${srcdir}/gethost_err.et
-
-hesiod_err.h hesiod_err.c: hesiod_err.et
-	compile_et ${srcdir}/hesiod_err.et
-
-.c.o:
-	${CC} -c ${ALL_CFLAGS} $<
-
-install:
-	${top_srcdir}/mkinstalldirs ${DESTDIR}${bindir}
-	${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man1
-	${INSTALL_PROGRAM} get_message ${DESTDIR}${bindir}
-	${INSTALL} -m 444 ${srcdir}/get_message.1 ${DESTDIR}${mandir}/man1
-
-clean:
-	rm -f get_message ${OBJS}
-	rm -f gethost_err.c gethost_err.h
-	rm -f hesiod_err.c hesiod_err.h
-
-distclean: clean
-	rm -f config.cache config.log config.status Makefile
-
-gethost_errors.o: gethost_err.h
-hesiod_errors.o get_servername.o: hesiod_err.h
diff --git a/check_viewable.c b/check_viewable.c
deleted file mode 100644
index c0a7ce7..0000000
--- a/check_viewable.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/* Copyright 1988, 1998 by the Massachusetts Institute of Technology.
- *
- * Permission to use, copy, modify, and distribute this
- * software and its documentation for any purpose and without
- * fee is hereby granted, provided that the above copyright
- * notice appear in all copies and that both that copyright
- * notice and this permission notice appear in supporting
- * documentation, and that the name of M.I.T. not be used in
- * advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- * M.I.T. makes no representations about the suitability of
- * this software for any purpose.  It is provided "as is"
- * without express or implied warranty.
- */
-
-static const char rcsid[] = "$Id: check_viewable.c,v 1.1 1999-12-08 22:06:43 danw Exp $";
-
-#include "globalmessage.h"
-#include <sys/types.h>
-#include <sys/file.h>
-#include <pwd.h>
-
-Code_t check_viewable(char *message, int checktime, int updateuser)
-{
-  char *ptr, *usertfile;
-  time_t ftime, utime;
-  int status, usersize, ufd;
-  char *usertfilename;
-  
-  if(strncmp(message, GMS_VERSION_STRING, GMS_VERSION_STRING_LEN)) {
-    return(GMS_SERVER_VERSION);
-  }
-
-  ptr = strchr(message, '\n');
-  if(!ptr) {
-    return(GMS_SERVER_GARBLED);
-  }
-  
-  ftime = atol(&message[GMS_VERSION_STRING_LEN+1]);
-
-  {
-    struct passwd *pw;
-    char *userdir;
-
-    pw = getpwuid(getuid());
-      
-    if(pw) {
-      userdir = pw->pw_dir;
-    } else {
-      /* couldn't check user's file, probably better send it. */
-      return(0);
-    }
-
-    usertfilename = malloc(GMS_USERFILE_NAME_LEN+strlen(userdir)+1);
-    strcpy(usertfilename, userdir);
-    strcat(usertfilename, GMS_USERFILE_NAME);
-
-    ufd = open(usertfilename, O_RDONLY, 0666);
-  }
-  
-  if(ufd != -1) {
-    /* read the file and close it */
-    status = read_to_memory(&usertfile, &usersize, ufd);
-    /* check the version string */
-    if(!status) {
-      if(!strncmp(usertfile, GMS_VERSION_STRING, GMS_VERSION_STRING_LEN)) {
-	/* now check for end of first line */
-	ptr = strchr(usertfile, '\n');
-	if(ptr) {
-	  /* now we check the time stamp */
-	  utime = atol(&usertfile[GMS_VERSION_STRING_LEN+1]);
-	  if(ftime <= utime) {
-	    /* user has already seen, we punt. */
-	    free(usertfile);
-	    free(usertfilename);
-	    /* but we only punt if they have asked for it... */
-	    if(checktime) {
-	      return(GMS_OLD_MESSAGE);
-	    } else {
-	      return(0);
-	    }
-	  }
-	}
-      }
-      /* only valid if read_to_memory worked... */
-      free(usertfile);
-    }
-  }
-
-  /* only write out the new time stamp if they want it. */
-  if(updateuser) {
-    /* now, reopen/create the file to write new timestamp */
-    ufd = open(usertfilename, O_WRONLY|O_CREAT|O_TRUNC, 0666);
-    if(ufd != -1) {
-      char *msg = &message[GMS_VERSION_STRING_LEN];
-    
-      /* write out the version number */
-      write(ufd, GMS_VERSION_STRING, GMS_VERSION_STRING_LEN);
-    
-      /* write out the timestring from the message file */
-      ptr = strchr(message, '\n')+1;
-      write(ufd, msg, ptr - msg);
-      close(ufd);
-    }
-  }
-  /* filename no longer needed... */
-  free(usertfilename);
-  /* if we tried to write, we want to print... */
-  return(0);
-}
-  
-
-
diff --git a/configure.in b/configure.in
deleted file mode 100644
index b948e3b..0000000
--- a/configure.in
+++ /dev/null
@@ -1,20 +0,0 @@
-dnl Process this file with autoconf to produce a configure script.
-AC_INIT(get_message.c)
-
-AC_PROG_CC
-AC_PROG_INSTALL
-
-AC_SEARCH_LIBS(gethostbyname, nsl)
-AC_SEARCH_LIBS(socket, socket)
-
-# Solaris 2.6 only declares utimes if you define _XPG4_2, but there
-# doesn't seem to be any way to define that and not get lots of
-# header warnings.
-AC_PROG_CPP
-AC_MSG_CHECKING(if sys/time.h declares utimes)
-AC_EGREP_HEADER(utimes, sys/time.h, [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no); AC_DEFINE(NEED_UTIMES_PROTO)])
-
-ATHENA_UTIL_COM_ERR
-ATHENA_HESIOD_REQUIRED
-
-AC_OUTPUT(Makefile)
diff --git a/get_a_message.c b/get_a_message.c
deleted file mode 100644
index c8a6cbe..0000000
--- a/get_a_message.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/* Copyright 1988, 1998 by the Massachusetts Institute of Technology.
- *
- * Permission to use, copy, modify, and distribute this
- * software and its documentation for any purpose and without
- * fee is hereby granted, provided that the above copyright
- * notice appear in all copies and that both that copyright
- * notice and this permission notice appear in supporting
- * documentation, and that the name of M.I.T. not be used in
- * advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- * M.I.T. makes no representations about the suitability of
- * this software for any purpose.  It is provided "as is"
- * without express or implied warranty.
- */
-
-static const char rcsid[] = "$Id: get_a_message.c,v 1.1 1999-12-08 22:06:44 danw Exp $";
-
-#include "globalmessage.h"
-#include <syslog.h>
-#include <com_err.h>
-
-
-/* return 0 status if the message is returned at all, else an error
- * code of some sort.
- */
-
-Code_t get_a_message(char **buf)
-{
-  Code_t status;
-  int size;
-  char **server;
-
-  status = get_servername(&server);
-  if(!status) {
-    status = get_message_from_server(buf, &size, server[0]);
-  }
-
-  if(status){
-    syslog(LOG_INFO, "GMS get server failed, %s", error_message(status));
-  }
-
-  if(!status) {
-    status = put_fallback_file(*buf, size, GMS_MESSAGE_NAME);
-    /* but we don't really care what it is, the message is ok */
-    if(status)
-      syslog(LOG_INFO, "GMS put failed, %s", error_message(status));
-    return(0);
-  }
-
-  status = get_fallback_file(buf, &size, GMS_MESSAGE_NAME);
-  if(status) {
-    syslog(LOG_INFO, "GMS put failed, %s", error_message(status));
-    /* we have no message at all... */
-    return(status);
-  } else {
-    return(0);
-  }
-}
diff --git a/get_fallback_file.c b/get_fallback_file.c
deleted file mode 100644
index 2855463..0000000
--- a/get_fallback_file.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/* Copyright 1988, 1998 by the Massachusetts Institute of Technology.
- *
- * Permission to use, copy, modify, and distribute this
- * software and its documentation for any purpose and without
- * fee is hereby granted, provided that the above copyright
- * notice appear in all copies and that both that copyright
- * notice and this permission notice appear in supporting
- * documentation, and that the name of M.I.T. not be used in
- * advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- * M.I.T. makes no representations about the suitability of
- * this software for any purpose.  It is provided "as is"
- * without express or implied warranty.
- */
-
-static const char rcsid[] = "$Id: get_fallback_file.c,v 1.1 1999-12-08 22:06:44 danw Exp $";
-
-#include "globalmessage.h"
-#include <sys/types.h>
-
-Code_t get_fallback_file(char **ret_data, int *ret_size,
-			 char *message_filename)
-{
-  char *message_data;
-  int message_filedesc;
-  int message_size;
-  int readstat;
-
-  /* guard against NULL arguments */
-  if((!ret_data)||(!ret_size)||(!message_filename)) {
-    return(GMS_NULL_ARG_ERR);
-  }
-
-  /* the return time stamp and version stuff is saved with the local
-   * anyway...
-   */
-  message_filedesc = open(message_filename, O_RDONLY, 0);
-  
-  if(message_filedesc == -1) {
-    /* handle open failure, use unix errors */
-    return(errno);
-  }
-
-  readstat = read_to_memory(&message_data, &message_size, message_filedesc);
-  close(message_filedesc);	/* regardless of errors */
-
-  if(readstat) {
-    /* handle read_to_memory errors, clean up timestamp */
-    return(readstat);
-  }
-  
-  *ret_data = message_data;
-  *ret_size = message_size;
-  return(0);
-}
diff --git a/get_message.1 b/get_message.1
deleted file mode 100644
index 581a73d..0000000
--- a/get_message.1
+++ /dev/null
@@ -1,69 +0,0 @@
-.\" $Id: get_message.1,v 1.1 1999-12-08 22:06:44 danw Exp $
-.\"
-.\" Copyright 1988, 1998 by the Massachusetts Institute of Technology.
-.\"
-.\" Permission to use, copy, modify, and distribute this
-.\" software and its documentation for any purpose and without
-.\" fee is hereby granted, provided that the above copyright
-.\" notice appear in all copies and that both that copyright
-.\" notice and this permission notice appear in supporting
-.\" documentation, and that the name of M.I.T. not be used in
-.\" advertising or publicity pertaining to distribution of the
-.\" software without specific, written prior permission.
-.\" M.I.T. makes no representations about the suitability of
-.\" this software for any purpose.  It is provided "as is"
-.\" without express or implied warranty.
-.\"
-.TH GET_MESSAGE 1 "September 28, 1988" "MIT Project Athena"
-.ds ]W MIT Project Athena
-.SH NAME
-get_message \- display the Athena Global Message of the Day
-.SH SYNOPSIS
-.B get_message
-[
-.BI -z[ephyr]
-] [
-.BI -n[ew]
-] [
-.BI -l[ogin]
-]
-.SH DESCRIPTION
-.I get_message
-finds the Athena Global Message server, requests the current message,
-and displays it if necessary. If any errors occur, a cached copy is
-consulted.
-.TP 12
-.B \-z[ephyr]
-indicates that the message (if any) should be displayed as a Zephyr
-Windowgram (see
-.I zephyr(1)
-for details.)
-.TP
-.B \-n[ew]
-indicates that the message should be only be displayed if the user has
-not seen it before.
-.TP
-.B \-l[ogin]
-is normally passed to 
-.I get_message
-by
-.I /bin/login
-to indicate that the user might not see this message, and that it
-should not be considered when the 
-.I \-new
-argument is later used.
-.SH FILES
-.TP 12
-.B ~/.message_times
-to hold the version number of the last message seen by the user.
-.TP
-.B /var/cache/libgms/messages
-to hold the cached copy of the message during network outages.
-.SH SEE ALSO
-zephyr(1), zwrite(1)
-.SH AUTHOR
-.PP
-Mark W. Eichin <eichin@athena.mit.edu>
-.SH RESTRICTIONS
-Copyright (c) 1988 by the Massachusetts Institute of Technology.
-All Rights Reserved.
diff --git a/get_message.c b/get_message.c
deleted file mode 100644
index 4212dc3..0000000
--- a/get_message.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/* Copyright 1988, 1998 by the Massachusetts Institute of Technology.
- *
- * Permission to use, copy, modify, and distribute this
- * software and its documentation for any purpose and without
- * fee is hereby granted, provided that the above copyright
- * notice appear in all copies and that both that copyright
- * notice and this permission notice appear in supporting
- * documentation, and that the name of M.I.T. not be used in
- * advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- * M.I.T. makes no representations about the suitability of
- * this software for any purpose.  It is provided "as is"
- * without express or implied warranty.
- */
-
-static const char rcsid[] = "$Id: get_message.c,v 1.1 1999-12-08 22:06:44 danw Exp $";
-
-#include "globalmessage.h"
-void Usage(char *pname, char *errname);
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <syslog.h>
-#include <com_err.h>
-
-int main(int argc, char **argv)
-{
-  char **xargv = argv;
-  int xargc = argc;
-  Code_t status;
-  char *message;
-  int zephyr_p = 0, new_p = 0, login_p = 0;
-  
-  openlog(argv[0], LOG_PID, LOG_USER);
-  syslog(LOG_INFO, "GMS client started...");
-
-  init_gms_err_tbl();
-
-  /* Argument Processing:
-   * 	-z or -zephyr: send the message as a zephyrgram.
-   * 	-n or -new: only send if the message is newer
-   */
-  if(argc>3) {
-    Usage(argv[0], "too many arguments");
-    exit(1);
-  }
-  /* Only one valid argument: -zephyr or -z */
-  while(--xargc) {
-    xargv++;
-    if((!strcmp(xargv[0],"-zephyr"))||(!strcmp(xargv[0],"-z"))) {
-      zephyr_p = 1;
-    } else if((!strcmp(xargv[0],"-new"))||(!strcmp(xargv[0],"-n"))) {
-      new_p = 1;
-    } else if((!strcmp(xargv[0],"-login"))||(!strcmp(xargv[0],"-l"))) {
-      login_p = 1;
-    } else {
-      Usage(argv[0], xargv[0]);
-      exit(1);
-    }      
-  }
-  
-  status = get_a_message(&message);
-  if(!status) {
-    /* check if the user has seen it already */
-    status = check_viewable(message, new_p, !login_p);
-    if(status) {
-      syslog(LOG_INFO, "GMS not showing.");
-      exit(0);
-    }
-
-    /* send it off if it passes the tests */
-    if(zephyr_p) {
-      view_message_by_zephyr(message);
-    } else {
-      view_message_by_tty(message);
-    }
-  } else {
-    syslog(LOG_INFO, "GMS losing: %s", error_message(status));
-  }
-
-  exit(0);
-}
-
-void Usage(char *pname, char *errname)
-{
-  fprintf(stderr, "%s <%s>: Usage: %s [-zephyr|-z] [-new|-n]\n",
-	  pname, errname, pname);
-}
diff --git a/get_message_from_server.c b/get_message_from_server.c
deleted file mode 100644
index 7ff6b1c..0000000
--- a/get_message_from_server.c
+++ /dev/null
@@ -1,130 +0,0 @@
-/* Copyright 1988, 1998 by the Massachusetts Institute of Technology.
- *
- * Permission to use, copy, modify, and distribute this
- * software and its documentation for any purpose and without
- * fee is hereby granted, provided that the above copyright
- * notice appear in all copies and that both that copyright
- * notice and this permission notice appear in supporting
- * documentation, and that the name of M.I.T. not be used in
- * advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- * M.I.T. makes no representations about the suitability of
- * this software for any purpose.  It is provided "as is"
- * without express or implied warranty.
- */
-
-static const char rcsid[] = "$Id: get_message_from_server.c,v 1.1 1999-12-08 22:06:44 danw Exp $";
-
-#include "globalmessage.h"
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <hesiod.h>
-#include <sys/time.h>
-
-Code_t get_message_from_server(char **ret_message, int *ret_message_size,
-			       char *server)
-{
-  struct sockaddr_in server_insocket;
-  int sck, stat;
-  char *message_data;
-  
-  /* guard against NULL arguments */
-  if ((!ret_message)||(!server)) {
-    return(GMS_NULL_ARG_ERR);
-  }
-
-  /* contact the server, send the request name, get the message back */
-  /* create the socket */
-  sck = socket(AF_INET, SOCK_DGRAM, 0); /* 0 is VERY special... */
-  if(sck == -1) {
-    /* handle socket error */
-    return(errno);
-  }
-
-  /* Set the socket family */
-  server_insocket.sin_family = AF_INET;
-
-  /* Set the socket port */
-  {
-    struct servent *gms_service;
-    gms_service = getservbyname(GMS_SERV_NAME, GMS_SERV_PROTO);
-    if(!gms_service) {
-      /* getservbyname failed, fall back... */
-      gms_service = hes_getservbyname(GMS_SERV_NAME, GMS_SERV_PROTO);
-      if(!gms_service) {
-	/* so did getservbyname, fall back to hard coded? */
-	return(GMS_NO_SERVICE_NAME);
-      }
-    }
-    server_insocket.sin_port = gms_service->s_port;
-  }
-
-  /* Set the socket address */
-  {
-    struct hostent *gms_host;
-    gms_host = gethostbyname(server);
-    if(!gms_host) {
-      /* gethostbyname failed */
-      return(gethost_error());
-    }
-    /* Copy in the first (preferred?) address of the server */
-    memcpy(&server_insocket.sin_addr, gms_host->h_addr_list[0],
-	  gms_host->h_length); 
-  }
-
-  /* Actually make the connection */
-  {
-    stat = connect(sck, (struct sockaddr *) &server_insocket,
-		   sizeof(server_insocket));
-    if(stat == -1) {
-      /* handle connect error */
-      return(errno);
-    }
-  }
-
-  /* send the version string as a datagram */
-  stat = send(sck, GMS_VERSION_STRING, GMS_VERSION_STRING_LEN, 0);
-  if (stat == -1) {
-    /* handle send failed error */
-    return(errno);
-  }
-
-  /* set up a timeout and select on the socket, to catch the return
-   * packet */
-  {
-    fd_set reader;
-    struct timeval timer;
-    
-    FD_ZERO(&reader);
-    FD_SET(sck, &reader);
-
-    timer.tv_sec = GMS_TIMEOUT_SEC;
-    timer.tv_usec = GMS_TIMEOUT_USEC;
-
-    stat = select(sck+1, &reader, 0, 0, &timer);
-    if (stat == -1) {
-      return(errno);
-    }
-    if (stat == 0) {
-      return(GMS_TIMED_OUT);
-    }
-    /* since we only wait on reader, it must have arrived */
-  }
-
-  message_data = malloc(GMS_MAX_MESSAGE_LEN);
-  stat = recv(sck, message_data, GMS_MAX_MESSAGE_LEN-1, 0);
-
-  close(sck); /* regardless of any errors... */
-
-  if(stat == -1) {
-    free(message_data);
-    return(errno);
-  }
-
-  message_data[stat] ='\0';
-  *ret_message_size = stat;
-  *ret_message = message_data;
-  return(0);
-}
diff --git a/get_servername.c b/get_servername.c
deleted file mode 100644
index 1efa1d4..0000000
--- a/get_servername.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/* Copyright 1988, 1998 by the Massachusetts Institute of Technology.
- *
- * Permission to use, copy, modify, and distribute this
- * software and its documentation for any purpose and without
- * fee is hereby granted, provided that the above copyright
- * notice appear in all copies and that both that copyright
- * notice and this permission notice appear in supporting
- * documentation, and that the name of M.I.T. not be used in
- * advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- * M.I.T. makes no representations about the suitability of
- * this software for any purpose.  It is provided "as is"
- * without express or implied warranty.
- */
-
-static const char rcsid[] = "$Id: get_servername.c,v 1.1 1999-12-08 22:06:44 danw Exp $";
-
-#include "globalmessage.h"
-#include <hesiod.h>
-#include "hesiod_err.h"
-
-Code_t get_servername(char ***ret_name)
-{
-  char **retval, **_data;	/* for copying out the hesiod data */
-  int datacnt, i;		/* number of hesiod records returned */
-
-  /* Guard against NULL arguments */
-  if ((!ret_name)) {
-    return(GMS_NULL_ARG_ERR);
-  }
-  
-  /* Fetch the list of servers from Hesiod. */
-  _data = hes_resolve(GMS_NAME_CLASS, GMS_NAME_TYPE);
-  
-  if(!_data) {
-    /* deal with hesiod error */
-    return(hesiod_error());
-  }
-
-  /* Copy the Hesiod data into stable space. */
-  for(datacnt=0; _data[datacnt]; datacnt++); /* count the data */
-
-  if (!datacnt) {
-      /* an answer, but no contents! */
-      return(HESIOD_ER_INVALID);	/* XXX */
-  }
-  retval = (char **)malloc(datacnt * sizeof(char *));
-  for(i=0; i<datacnt; i++) {
-    retval[i] = malloc(strlen(_data[i])+1);
-    if(!retval[i]) {
-      /* malloc failed... */
-      for(;--i;free(retval[i]));
-      return(GMS_MALLOC_ERR);
-    }
-    strcpy(retval[i], _data[i]);
-  }
-  
-  /* Clean up and return normally. */
-  *ret_name = retval;
-  return(0);
-}
diff --git a/gethost_err.et b/gethost_err.et
deleted file mode 100644
index 978958d..0000000
--- a/gethost_err.et
+++ /dev/null
@@ -1,32 +0,0 @@
-# $Id: gethost_err.et,v 1.1 1999-12-08 22:06:45 danw Exp $
-
-# Copyright 1988, 1998 by the Massachusetts Institute of Technology.
-#
-# Permission to use, copy, modify, and distribute this
-# software and its documentation for any purpose and without
-# fee is hereby granted, provided that the above copyright
-# notice appear in all copies and that both that copyright
-# notice and this permission notice appear in supporting
-# documentation, and that the name of M.I.T. not be used in
-# advertising or publicity pertaining to distribution of the
-# software without specific, written prior permission.
-# M.I.T. makes no representations about the suitability of
-# this software for any purpose.  It is provided "as is"
-# without express or implied warranty.
-
-	et	ghs
-
-ec GETHOST_HOST_NOT_FOUND,
-	"No such host is known"
-ec GETHOST_TRY_AGAIN,
-	"Temporary nameserver error, retry possible"
-ec GETHOST_NO_RECOVERY,
-	"Non-recoverable error"
-ec GETHOST_NO_ADDRESS,
-	"No address, though other data exist"
-ec GETHOST_INVALID,
-	"Unexpected return from gethostbyname error"
-
-	end
-
-
diff --git a/gethost_errors.c b/gethost_errors.c
deleted file mode 100644
index afae421..0000000
--- a/gethost_errors.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Copyright 1988, 1998 by the Massachusetts Institute of Technology.
- *
- * Permission to use, copy, modify, and distribute this
- * software and its documentation for any purpose and without
- * fee is hereby granted, provided that the above copyright
- * notice appear in all copies and that both that copyright
- * notice and this permission notice appear in supporting
- * documentation, and that the name of M.I.T. not be used in
- * advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- * M.I.T. makes no representations about the suitability of
- * this software for any purpose.  It is provided "as is"
- * without express or implied warranty.
- */
-
-static const char rcsid[] = "$Id: gethost_errors.c,v 1.2 2000-02-28 21:47:41 ghudson Exp $";
-
-#include "globalmessage.h"
-#include "gethost_err.h"
-#include <netdb.h>
-
-Code_t gethost_error(void)
-{
-  init_ghs_err_tbl();
-
-  switch(h_errno) {
-  case HOST_NOT_FOUND:
-    return(GETHOST_HOST_NOT_FOUND);
-  case TRY_AGAIN:
-    return(GETHOST_TRY_AGAIN);
-  case NO_RECOVERY:
-    return(GETHOST_NO_RECOVERY);
-  case NO_ADDRESS:
-    return(GETHOST_NO_ADDRESS);
-  default:
-    return(GETHOST_INVALID);
-  }
-}
-    
diff --git a/hesiod_err.et b/hesiod_err.et
deleted file mode 100644
index 18c90fb..0000000
--- a/hesiod_err.et
+++ /dev/null
@@ -1,33 +0,0 @@
-# $Id: hesiod_err.et,v 1.1 1999-12-08 22:06:45 danw Exp $
-
-# Copyright 1988, 1998 by the Massachusetts Institute of Technology.
-#
-# Permission to use, copy, modify, and distribute this
-# software and its documentation for any purpose and without
-# fee is hereby granted, provided that the above copyright
-# notice appear in all copies and that both that copyright
-# notice and this permission notice appear in supporting
-# documentation, and that the name of M.I.T. not be used in
-# advertising or publicity pertaining to distribution of the
-# software without specific, written prior permission.
-# M.I.T. makes no representations about the suitability of
-# this software for any purpose.  It is provided "as is"
-# without express or implied warranty.
-
-	et	hes
-
-ec  HESIOD_ER_UNINIT,
-	"Hesiod uninitialized"
-ec  HESIOD_ER_OK,
-	"No hesiod error detected(?)"
-ec  HESIOD_ER_NOTFOUND,
-	"Hesiod name not found by Hesiod server"
-ec  HESIOD_ER_CONFIG,
-	"local Hesiod problem (no config file?)"
-ec  HESIOD_ER_NET,
-	"Hesiod network problem"
-ec  HESIOD_ER_INVALID,
-	"Unexpected return from Hesiod error"
-	end
-
-
diff --git a/hesiod_errors.c b/hesiod_errors.c
deleted file mode 100644
index bc30c7d..0000000
--- a/hesiod_errors.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright 1988, 1998 by the Massachusetts Institute of Technology.
- *
- * Permission to use, copy, modify, and distribute this
- * software and its documentation for any purpose and without
- * fee is hereby granted, provided that the above copyright
- * notice appear in all copies and that both that copyright
- * notice and this permission notice appear in supporting
- * documentation, and that the name of M.I.T. not be used in
- * advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- * M.I.T. makes no representations about the suitability of
- * this software for any purpose.  It is provided "as is"
- * without express or implied warranty.
- */
-
-static const char rcsid[] = "$Id: hesiod_errors.c,v 1.1 1999-12-08 22:06:45 danw Exp $";
-
-#include "globalmessage.h"
-#include "hesiod_err.h"
-#include <hesiod.h>
-
-Code_t hesiod_error(void)
-{
-  init_hes_err_tbl();
-  
-  switch(hes_error()) {
-  case HES_ER_UNINIT:
-    return(HESIOD_ER_UNINIT);
-  case HES_ER_NOTFOUND:
-    return(HESIOD_ER_NOTFOUND);
-  case HES_ER_CONFIG:
-    return(HESIOD_ER_CONFIG);
-  case HES_ER_NET:
-    return(HESIOD_ER_NET);
-  case HES_ER_OK:
-    return(HESIOD_ER_OK);
-  default:
-    return(HESIOD_ER_INVALID);
-  }
-}
diff --git a/put_fallback_file.c b/put_fallback_file.c
deleted file mode 100644
index 59b33cc..0000000
--- a/put_fallback_file.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/* Copyright 1988, 1998 by the Massachusetts Institute of Technology.
- *
- * Permission to use, copy, modify, and distribute this
- * software and its documentation for any purpose and without
- * fee is hereby granted, provided that the above copyright
- * notice appear in all copies and that both that copyright
- * notice and this permission notice appear in supporting
- * documentation, and that the name of M.I.T. not be used in
- * advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- * M.I.T. makes no representations about the suitability of
- * this software for any purpose.  It is provided "as is"
- * without express or implied warranty.
- */
-
-static const char rcsid[] = "$Id: put_fallback_file.c,v 1.1 1999-12-08 22:06:45 danw Exp $";
-
-#include "globalmessage.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-
-#ifdef NEED_UTIMES_PROTO
-int utimes(const char *path, const struct timeval *times);
-#endif
-
-Code_t put_fallback_file(char *message_data, int message_size,
-			 char *message_filename)
-{
-  int errstat;
-  int message_filedesc;
-  time_t ftime;
-  struct timeval tvp[2];
-  mode_t oumask;
-  
-  /* in case we try to NULL out the file... */
-  tvp[0].tv_sec = tvp[1].tv_sec = 0;
-  tvp[0].tv_usec = tvp[1].tv_usec = 0;
-  
-  /* guard against bogus arguments */
-  if((!message_data)||(!message_size)||(!message_filename)) {
-    return(GMS_NULL_ARG_ERR);
-  }
-  if((message_size<0)) {
-    return(GMS_BAD_ARG_ERR);
-  }
-  
-  /*
-   * First, check the time stamp in the file, to see if we should mark
-   * it for deletion (if it exists) and warp the timestamp back or
-   * just avoid creating it if it doesn't.
-   */
-  ftime = atol(&message_data[GMS_VERSION_STRING_LEN+1]);
-  {
-    /* We want to set the time back if the file does exist; if it
-     * doesn't, we want to leave it missing.
-     */
-    errstat = open(message_filename, O_RDONLY, 0);
-    if((errstat != -1)&&(ftime>0)) {
-      char dummy[1];
-      /* We read one byte so that the =access= time gets set; utimes
-       * doesn't work if you don't own the file.
-       * We can ignore any error return, since if the read fails the
-       * file will later be cleared and it will work anyhow.
-       */
-      read(errstat, dummy, 1);
-      /* we never care about the old contents if we have new contents to
-       * install, so just close this and reopen it later for writing.
-       */
-      close(errstat);
-    } else if((errstat == -1)&&(ftime == 0)) {
-      if(errno == ENOENT) {
-	/* it didn't exist, so we want to leave it that way. */
-	return(0);
-      } else {
-	/* something went wrong, but we can't do much about it.
-	 * We just have to hope the cron job clears it.
-	 */
-	return(errno);
-      }
-    }
-    /*
-     * Don't bother worrying about an open error here, the failure
-     * modes are such that either it will work later (ie. it was just
-     * a missing file, which we are about to create anyway) or the
-     * cron job will clean it up. Neither should be reported, as they
-     * do not affect the user.  If the file was indeed there, we want
-     * to put the empty data into it, so that when someone requests
-     * it, they don't get a stale message; however, we still want to
-     * try to warp the clock.
-     */
-  }
-
-  /*
-   * We could use an open and then a chmod to set the permissions of
-   * the file, rather than using umask, but if we do things that way,
-   * there is a window of time during which the file has the wrong permissions.
-   */
-  oumask = umask(0);		/* we really want these open */
-  /* write the file so that it is world writeable. Note that since
-   * usr/tmp is sticky-bitted by default, we can't remove the file
-   * directly, even with this openness; that is dealt with by warping
-   * the clock backwards on the file and letting the daily find job do
-   * the work.
-   */
-  message_filedesc = open(message_filename,
-			  O_CREAT|O_WRONLY|O_TRUNC, 0666);
-  (void) umask(oumask);
-  
-  /* Just return the error if something fails. This will be later
-   * ignored, since this is a non critical stage...
-   */
-  if(message_filedesc == -1) {
-    return(errno);
-  }
-
-  /*
-   * The timestamps are already in the message image, so just save
-   * them.
-   */
-  errstat = write(message_filedesc, message_data, message_size);
-  close(message_filedesc);
-  /*
-   * if we don't want to force the timestamps, we can exit now on an
-   * error instead of waiting.
-   */
-  if((ftime>0) && errstat == -1) {
-    return(errno);
-  }
-
-  /*
-   * if the file should really go away, warp the clock back as well,
-   * so the cron job can nuke it....
-   */
-  if(ftime>0) {
-    /* the read we did earlier should have set the access time, so we
-     * don't need to do anything else here.
-     */
-    return(0);
-  }
-  /*
-   * We can reuse errstat (having not checked it), since if the write
-   * fails, we still want to try the utimes in the hope that the
-   * timestamp will get set and the cron job will really delete the
-   * file. 
-   */
-  errstat = utimes(message_filename, tvp);
-  if(errstat == -1) {
-    return(errno);
-  }
-  /* everything worked. */
-  return(0);
-}
diff --git a/read_to_memory.c b/read_to_memory.c
deleted file mode 100644
index 828064b..0000000
--- a/read_to_memory.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Copyright 1988, 1998 by the Massachusetts Institute of Technology.
- *
- * Permission to use, copy, modify, and distribute this
- * software and its documentation for any purpose and without
- * fee is hereby granted, provided that the above copyright
- * notice appear in all copies and that both that copyright
- * notice and this permission notice appear in supporting
- * documentation, and that the name of M.I.T. not be used in
- * advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- * M.I.T. makes no representations about the suitability of
- * this software for any purpose.  It is provided "as is"
- * without express or implied warranty.
- */
-
-static const char rcsid[] = "$Id: read_to_memory.c,v 1.2 2004-12-26 17:33:39 zacheiss Exp $";
-
-#include "globalmessage.h"
-
-Code_t read_to_memory(char **ret_block, int *ret_size, int filedesc)
-{
-  char buf[GMS_MAX_MESSAGE_LEN], *message_data = NULL;
-  int message_size = 0;
-  int stat;
-  
-  do {
-    /* read the block */
-    stat = read(filedesc, buf, GMS_MAX_MESSAGE_LEN);
-    if(stat == -1) {
-      /* handle read failed error */
-      free(message_data);
-      return(errno);
-    }
-
-    /* allocate a memory area for copying */
-    /* the +1 are for trailing NULs */
-    message_data = realloc(message_data, message_size + stat + 1);
-    if(!message_data) {
-      return(GMS_MALLOC_ERR);
-    }
-      
-    /* copy it into the right place */
-    memcpy(&message_data[message_size], buf, stat);
-
-    message_size += stat;
-  } while(stat);
-    /* but only until we stop getting blocks. */
-
-  /* Just to make it consistent, for lazy calling routines... */
-  message_data[message_size] = '\0';
-  
-  *ret_block = message_data;
-  *ret_size = message_size;
-  return(0);
-}
-  
diff --git a/view_message_by_tty.c b/view_message_by_tty.c
deleted file mode 100644
index 29f36ab..0000000
--- a/view_message_by_tty.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Copyright 1988, 1998 by the Massachusetts Institute of Technology.
- *
- * Permission to use, copy, modify, and distribute this
- * software and its documentation for any purpose and without
- * fee is hereby granted, provided that the above copyright
- * notice appear in all copies and that both that copyright
- * notice and this permission notice appear in supporting
- * documentation, and that the name of M.I.T. not be used in
- * advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- * M.I.T. makes no representations about the suitability of
- * this software for any purpose.  It is provided "as is"
- * without express or implied warranty.
- */
-
-static const char rcsid[] = "$Id: view_message_by_tty.c,v 1.1 1999-12-08 22:06:46 danw Exp $";
-
-#include "globalmessage.h"
-
-void view_message_by_tty(char *message)
-{
-  char *ptr;
-
-  /* skip magic headers */
-  ptr = strchr(message, '\n')+1;
-  /* note that if there is nothing, strlen(ptr) == 0 */
-  write(1,ptr,strlen(ptr));
-}
diff --git a/view_message_by_zephyr.c b/view_message_by_zephyr.c
deleted file mode 100644
index 09c7794..0000000
--- a/view_message_by_zephyr.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/* Copyright 1988, 1998 by the Massachusetts Institute of Technology.
- *
- * Permission to use, copy, modify, and distribute this
- * software and its documentation for any purpose and without
- * fee is hereby granted, provided that the above copyright
- * notice appear in all copies and that both that copyright
- * notice and this permission notice appear in supporting
- * documentation, and that the name of M.I.T. not be used in
- * advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- * M.I.T. makes no representations about the suitability of
- * this software for any purpose.  It is provided "as is"
- * without express or implied warranty.
- */
-
-static const char rcsid[] = "$Id: view_message_by_zephyr.c,v 1.1 1999-12-08 22:06:46 danw Exp $";
-
-#include "globalmessage.h"
-#include <pwd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <syslog.h>
-#include <unistd.h>
-#include <com_err.h>
-
-void view_message_by_zephyr(char *message)
-{
-  char *whoami;
-  char *ptr;
-  
-  whoami = getenv("ATHENA_USER");
-  if (!whoami)
-    whoami = getenv("USER");
-  
-  if(!whoami)
-    whoami = getlogin();
-  
-  if(!whoami) {
-    struct passwd *pw;
-    pw = getpwuid(getuid());
-    if(pw) {
-      whoami = pw->pw_name;
-    } else {
-      fprintf(stderr,
-	      "get_message: couldn't find username to send zephyr notice\n");
-      exit(2);
-    }
-  }
-  /* skip magic headers */
-  ptr = strchr(message, '\n')+1;
-  
-  /* check that there is *something* after the headers */
-  if(*ptr) {
-    /* don't even fork... this just exits anyway... */
-    execl("/usr/bin/zwrite",
-	  "zwrite", "-d", "-q", "-n",  whoami, "-m", ptr, 0);
-    /* put logging here in case the exec fails. */
-    syslog(LOG_INFO, "GMS client execl of zwrite failed [%s]",
-	   error_message(errno));
-  }
-}

home help back first fref pref prev next nref lref last post