home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
unix
/
volume26
/
newmail.pch1
< prev
next >
Wrap
Text File
|
1992-04-18
|
6KB
|
189 lines
Newsgroups: comp.sources.unix
From: creps@silver.ucs.indiana.edu (Steve Creps)
Subject: v26i012: newmail - utility to check for new mail, Patch01
Sender: unix-sources-moderator@pa.dec.com
Approved: vixie@pa.dec.com
Submitted-By: creps@silver.ucs.indiana.edu (Steve Creps)
Posting-Number: Volume 26, Issue 12
Archive-Name: newmail.pch1
This is a bugfix patch for my newmail program that was posted in
comp.sources.unix a couple of weeks ago.
The first problem was with the program giving a bus error on SYSV
machines when run in daemon mode. This was a problem with an uninitialized
pointer. It got through the testing stage because it only appeared for me
when optimization was turned on (-O), and I apparently compiled it without
optimization when testing. I believe it also worked with -O2. I no longer
have access to an HP-UX (SYSV) machine, so I can't go back and check. Thanks
to David Nugent for tracking down the problem with the pointer, and sending a
fix for it.
Another is a blind attempt (no more SYSV machine, remember) to fix a
problem on SYSV with an incorrect exit code from daemon mode startup (it's
supposed to return the pid). I cast it to int.
One more is a fix to one of the scripts to work on Suns.
The rest is a bunch of date changes.
creps@silver.ucs.indiana.edu (Steve Creps)
*** old/Makefile Fri Jan 10 14:37:06 1992
--- Makefile Fri Jan 10 15:15:56 1992
***************
*** 1,10 ****
! # Makefile for newmail(1), Steve Creps, July 17, 1991.
#LOC=/usr/contrib
LOC=/usr2/creps
BIN=$(LOC)/bin
MAN=$(LOC)/man/man1.Z
#
! # Define for BSD, Ultrix, etc.
SYSTEM=BSD
# Define for SYS V, HP-UX, etc.
#SYSTEM=SYSV
--- 1,10 ----
! # Makefile for newmail(1), Steve Creps, January 10, 1992.
#LOC=/usr/contrib
LOC=/usr2/creps
BIN=$(LOC)/bin
MAN=$(LOC)/man/man1.Z
#
! # Define for BSD, Ultrix, SunOS, etc.
SYSTEM=BSD
# Define for SYS V, HP-UX, etc.
#SYSTEM=SYSV
*** old/README Fri Jan 10 14:37:06 1992
--- README Fri Jan 10 15:36:19 1992
***************
*** 1,8 ****
! Newmail, version 3.0, Steve Creps, July 19, 1991.
Give information on existence of new mail messages. See the man
! page file (newmail.man) for information on the program.
! This program has been tested under Ultrix and HP-UX.
Previous versions had no version numbers, only dates, so 3.0 is
a somewhat arbitrary version number.
--- 1,20 ----
! Newmail, version 3.1, Steve Creps, January 10, 1992.
Give information on existence of new mail messages. See the man
! page file (newmail.man) for information on the program. This should
! be the last version unless more bugs are found.
! This program has been tested under Ultrix, SunOS, and HP-UX.
!
! Changes from 3.0 to 3.1:
!
! - Fix bug causing crash in daemon mode on HP-UX. This bug didn't show
! up during testing because its appearance depended on the optimization
! used.
!
! - When returning the child pid (daemon mode), cast it to int first.
!
! - Take "f" option to ps out of killnewmail.BSD. Ultrix doesn't need it, and
! SunOS chokes on it.
Previous versions had no version numbers, only dates, so 3.0 is
a somewhat arbitrary version number.
*** old/killnewmail.BSD Fri Jan 10 14:37:07 1992
--- killnewmail.BSD Fri Jan 10 15:32:40 1992
***************
*** 1,2 ****
#!/bin/sh
! kill `ps -fg | fgrep newmail | fgrep -e -d | fgrep -v fgrep | awk '{ print $1 }'`
--- 1,2 ----
#!/bin/sh
! kill `ps -g | fgrep newmail | fgrep -e -d | fgrep -v fgrep | awk '{ print $1 }'`
*** old/newmail.c Fri Jan 10 14:37:09 1992
--- newmail.c Fri Jan 10 15:18:53 1992
***************
*** 1,6 ****
/* newmail(1L), check for new, unread, and total mail messages */
/* Steve Creps, October 24, 1988 */
! /* Last modified, July 19, 1991 */
/****************************************************************/
/* #include standard copyright notice: */
--- 1,6 ----
/* newmail(1L), check for new, unread, and total mail messages */
/* Steve Creps, October 24, 1988 */
! /* Last modified, January 10, 1992 */
/****************************************************************/
/* #include standard copyright notice: */
***************
*** 12,18 ****
/****************************************************************/
#ifndef lint
! static char ID[] = "Newmail, version 3.0, (c) 1991 Steve Creps";
#endif
#include <stdio.h>
--- 12,18 ----
/****************************************************************/
#ifndef lint
! static char ID[] = "Newmail, version 3.1, (c) 1991, 1992 Steve Creps";
#endif
#include <stdio.h>
***************
*** 54,60 ****
int argc;
char *argv[];
{
! char *mailfile;
int c;
FILE *mailfp;
pid_t child_id = 0;
--- 54,60 ----
int argc;
char *argv[];
{
! char *mailfile = NULL;
int c;
FILE *mailfp;
pid_t child_id = 0;
***************
*** 184,193 ****
}
#ifdef SYSV
/* Just to be neat. See comment after strdup() above. */
! free((void *)mailfile);
#endif
! return optd > 0 ? child_id : ncount;
}
#define MAXLEN 12 /* we're discarding most of the end of the line */
--- 184,195 ----
}
#ifdef SYSV
/* Just to be neat. See comment after strdup() above. */
! if (mailfile != NULL) { /* in case your free() doesn't like getting NULL */
! free((void *)mailfile);
! }
#endif
! return optd > 0 ? (int)child_id : ncount;
}
#define MAXLEN 12 /* we're discarding most of the end of the line */
*** old/newmail.man Fri Jan 10 14:37:09 1992
--- newmail.man Fri Jan 10 14:51:57 1992
***************
*** 89,92 ****
Written by Steve Creps, Indiana University, October 24, 1988, based
on observation of Unix mailbox format.
Not derived from anyone else's code.
! Last modified July 19, 1991.
--- 89,92 ----
Written by Steve Creps, Indiana University, October 24, 1988, based
on observation of Unix mailbox format.
Not derived from anyone else's code.
! Last modified January 10, 1992.