[BACK]Return to fio.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / mail

Diff for /src/usr.bin/mail/fio.c between version 1.19 and 1.20

version 1.19, 2001/11/20 20:50:00 version 1.20, 2001/11/21 15:26:39
Line 36 
Line 36 
   
 #ifndef lint  #ifndef lint
 #if 0  #if 0
 static char sccsid[] = "@(#)fio.c       8.2 (Berkeley) 4/20/95";  static const char sccsid[] = "@(#)fio.c 8.2 (Berkeley) 4/20/95";
 #else  #else
 static char rcsid[] = "$OpenBSD$";  static const char rcsid[] = "$OpenBSD$";
 #endif  #endif
 #endif /* not lint */  #endif /* not lint */
   
Line 63 
Line 63 
  * Wrapper for read() to catch EINTR.   * Wrapper for read() to catch EINTR.
  */   */
 ssize_t  ssize_t
 myread(fd, buf, len)  myread(int fd, char *buf, int len)
         int fd;  
         char *buf;  
         int len;  
 {  {
         ssize_t nread;          ssize_t nread;
   
Line 79 
Line 76 
  * Set up the input pointers while copying the mail file into /tmp.   * Set up the input pointers while copying the mail file into /tmp.
  */   */
 void  void
 setptr(ibuf, offset)  setptr(FILE *ibuf, off_t offset)
         FILE *ibuf;  
         off_t offset;  
 {  {
         int c, count;          int c, count;
         char *cp, *cp2;          char *cp, *cp2;
Line 184 
Line 179 
  * characters written, including the newline if requested.   * characters written, including the newline if requested.
  */   */
 int  int
 putline(obuf, linebuf, outlf)  putline(FILE *obuf, char *linebuf, int outlf)
         FILE *obuf;  
         char *linebuf;  
         int   outlf;  
 {  {
         int c;          int c;
   
Line 208 
Line 200 
  * include the newline (or carriage return) at the end.   * include the newline (or carriage return) at the end.
  */   */
 int  int
 readline(ibuf, linebuf, linesize, signo)  readline(FILE *ibuf, char *linebuf, int linesize, int *signo)
         FILE *ibuf;  
         char *linebuf;  
         int linesize;  
         int *signo;  
 {  {
         struct sigaction act;          struct sigaction act;
         struct sigaction savetstp;          struct sigaction savetstp;
Line 277 
Line 265 
  * passed message pointer.   * passed message pointer.
  */   */
 FILE *  FILE *
 setinput(mp)  setinput(struct message *mp)
         struct message *mp;  
 {  {
   
         fflush(otf);          fflush(otf);
Line 292 
Line 279 
  * a dynamically allocated message structure.   * a dynamically allocated message structure.
  */   */
 void  void
 makemessage(f, omsgCount)  makemessage(FILE *f, int omsgCount)
         FILE *f;  
         int omsgCount;  
 {  {
         size_t size = (msgCount + 1) * sizeof(struct message);          size_t size = (msgCount + 1) * sizeof(struct message);
   
Line 326 
Line 311 
  * If the write fails, return 1, else 0   * If the write fails, return 1, else 0
  */   */
 int  int
 append(mp, f)  append(struct message *mp, FILE *f)
         struct message *mp;  
         FILE *f;  
 {  {
   
         return(fwrite((char *) mp, sizeof(*mp), 1, f) != 1);          return(fwrite((char *) mp, sizeof(*mp), 1, f) != 1);
 }  }
   
Line 337 
Line 321 
  * Delete or truncate a file, but only if the file is a plain file.   * Delete or truncate a file, but only if the file is a plain file.
  */   */
 int  int
 rm(name)  rm(char *name)
         char *name;  
 {  {
         struct stat sb;          struct stat sb;
   
Line 363 
Line 346 
  * Hold signals SIGHUP, SIGINT, and SIGQUIT.   * Hold signals SIGHUP, SIGINT, and SIGQUIT.
  */   */
 void  void
 holdsigs()  holdsigs(void)
 {  {
   
         if (sigdepth++ == 0) {          if (sigdepth++ == 0) {
Line 379 
Line 362 
  * Release signals SIGHUP, SIGINT, and SIGQUIT.   * Release signals SIGHUP, SIGINT, and SIGQUIT.
  */   */
 void  void
 relsesigs()  relsesigs(void)
 {  {
   
         if (--sigdepth == 0)          if (--sigdepth == 0)
Line 390 
Line 373 
  * Unblock and ignore a signal   * Unblock and ignore a signal
  */   */
 int  int
 ignoresig(sig, oact, oset)  ignoresig(int sig, struct sigaction *oact, sigset_t *oset)
         int sig;  
         struct sigaction *oact;  
         sigset_t *oset;  
 {  {
         struct sigaction act;          struct sigaction act;
         sigset_t nset;          sigset_t nset;
Line 419 
Line 399 
  * the passed buffer.   * the passed buffer.
  */   */
 off_t  off_t
 fsize(iob)  fsize(FILE *iob)
         FILE *iob;  
 {  {
         struct stat sbuf;          struct stat sbuf;
   
Line 441 
Line 420 
  * Return the file name as a dynamic string.   * Return the file name as a dynamic string.
  */   */
 char *  char *
 expand(name)  expand(char *name)
         char *name;  
 {  {
         char xname[PATHSIZE];          char xname[PATHSIZE];
         char cmdbuf[PATHSIZE];          /* also used for file names */          char cmdbuf[PATHSIZE];          /* also used for file names */
         int pid, l;          pid_t pid;
           int l;
         char *cp, *shell;          char *cp, *shell;
         int pivec[2];          int pivec[2];
         struct stat sbuf;          struct stat sbuf;
Line 484 
Line 463 
                 (void)snprintf(xname, sizeof(xname), "%s%s", homedir, name + 1);                  (void)snprintf(xname, sizeof(xname), "%s%s", homedir, name + 1);
                 name = savestr(xname);                  name = savestr(xname);
         }          }
         if (!anyof(name, "~{[*?$`'\"\\"))          if (strpbrk(name, "~{[*?$`'\"\\") == NULL)
                 return(name);                  return(name);
           /* XXX - just use glob(3) and env expansion instead? */
         if (pipe(pivec) < 0) {          if (pipe(pivec) < 0) {
                 warn("pipe");                  warn("pipe");
                 return(name);                  return(name);
Line 533 
Line 513 
  * Determine the current folder directory name.   * Determine the current folder directory name.
  */   */
 int  int
 getfold(name, namelen)  getfold(char *name, int namelen)
         char *name;  
         int namelen;  
 {  {
         char *folder;          char *folder;
   
         if ((folder = value("folder")) == NULL)          if ((folder = value("folder")) == NULL)
                 return(-1);                  return(-1);
         if (*folder == '/') {          if (*folder == '/')
                 strncpy(name, folder, namelen-1);                  strlcpy(name, folder, namelen);
                 name[namelen-1] = '\0';          else
         } else  
                 (void)snprintf(name, namelen, "%s/%s", homedir ? homedir : ".",                  (void)snprintf(name, namelen, "%s/%s", homedir ? homedir : ".",
                     folder);                      folder);
         return(0);          return(0);
Line 554 
Line 531 
  * Return the name of the dead.letter file.   * Return the name of the dead.letter file.
  */   */
 char *  char *
 getdeadletter()  getdeadletter(void)
 {  {
         char *cp;          char *cp;
   
Line 574 
Line 551 
  * SIGTTOU, SIGTTIN.   * SIGTTOU, SIGTTIN.
  */   */
 void  void
 fioint(s)  fioint(int s)
         int s;  
 {  {
   
         fiosignal = s;          fiosignal = s;

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.20