[2749] in Release_Engineering

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

from patch

daemon@ATHENA.MIT.EDU (tom@MIT.EDU)
Thu Aug 15 17:36:00 1991

From: tom@MIT.EDU
Date: Thu, 15 Aug 91 17:36:15 EDT
To: rel-eng@MIT.EDU, jis@MIT.EDU


Here is a patch to the from command to implement the off switch. There
are a couple of things to think about...
 
 1. I did it failsafe for the post offices in that if the "ok" file does
    not exist, then do not proceed with the request.

 2. the location of the ok and message files are expected to be in
    /afs/athena/system/config/from


*** from.c	Thu Aug 15 17:24:38 1991
--- /source/athena/athena.bin/from/from.c	Sun Aug 11 21:20:27 1991
***************
*** 35,53 ****
  
  #define MAX_HEADER_LINES 512
  
- #ifdef OFF_SWITCH
- /* 
-  * if the ok file does not exist, then print the default error and do not
-  * proceed with the request. If the ok file is missing and the message 
-  * file exists, print the contents of the message file and do not proceed 
-  * with the request. The message file will be ignored if the ok file exists.
-  */
- 
- #define OK_FILE   "/afs/athena.mit.edu/system/config/from/ok"
- #define MSG_FILE  "/afs/athena.mit.edu/system/config/from/message"
- char    *default_err = "Cannot stat the \"ok\" file.. unable to continue with request.";
- #endif /* OFF_SWITCH */
- 
  FILE 	*sfi, *sfo;
  char 	Errmsg[80];
  char	*getlogin(), *strdup(), *parse_from_field();
--- 35,40 ----
***************
*** 225,235 ****
  	struct winsize windowsize;
  	int	header_scan();
  
- #ifdef OFF_SWITCH
- 	if(pop_ok() == NOTOK)
- 	     return (1);
- #endif /* OFF_SWITCH */
- 
  	if (pop_init(host) == NOTOK) {
  		error(Errmsg);
  		return(1);
--- 212,217 ----
***************
*** 607,636 ****
    for (j = 0; j < num_headers; j++)
      free(headers[j]);
  }
- 
- 
- #ifdef OFF_SWITCH
- 
- pop_ok()
- {
-   FILE *fp;
-   struct stat sbuf;
-   char buf[BUFSIZ];
- 
-   if(stat(OK_FILE, &sbuf) == 0)
-        return(OK);
- 
-   if(!(fp = fopen(MSG_FILE, "r")))  {
-        printf("%s\n", default_err);
-        return(NOTOK);
-   }
- 
-   bzero(buf, sizeof(buf));
-   while(fgets(buf, sizeof(buf), fp))
-       printf("%s", buf);
-   fclose(fp);
-   return(NOTOK);
- }
- 
- #endif /* OFF_SWITCH */
-   
--- 589,591 ----

*** Imakefile   Thu Aug 15 17:16:58 1991
--- /source/athena/athena.bin/from/Imakefile    Mon Jul  1 15:11:29 1991
***************
*** 6,12 ****

  AnsiCC()

! DEFINES = -DHESIOD -DKPOP -DOFF_SWITCH
  #ifdef _AUX_SOURCE
  LIBS = -lhesiod -lkrb -ldes -lPW -lc

--- 6,12 ----

  AnsiCC()

! DEFINES = -DHESIOD -DKPOP
  #ifdef _AUX_SOURCE
  LIBS = -lhesiod -lkrb -ldes -lPW -lc


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