/[emacs]/emacs/lib-src/movemail.c
ViewVC logotype

Diff of /emacs/lib-src/movemail.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.78.2.1 by handa, Fri Apr 16 12:49:44 2004 UTC revision 1.78.2.2 by miles, Mon Jun 28 07:28:22 2004 UTC
# Line 216  main (argc, argv) Line 216  main (argc, argv)
216          preserve_mail++;          preserve_mail++;
217          break;          break;
218        default:        default:
219          exit(1);          exit (EXIT_FAILURE);
220        }        }
221      }      }
222    
# Line 234  main (argc, argv) Line 234  main (argc, argv)
234  #else  #else
235        fprintf (stderr, "Usage: movemail [-p] inbox destfile%s\n", "");        fprintf (stderr, "Usage: movemail [-p] inbox destfile%s\n", "");
236  #endif  #endif
237        exit (1);        exit (EXIT_FAILURE);
238      }      }
239    
240    inname = argv[optind];    inname = argv[optind];
# Line 536  main (argc, argv) Line 536  main (argc, argv)
536        if (spool_name)        if (spool_name)
537          mailunlock ();          mailunlock ();
538  #endif  #endif
539        exit (0);        exit (EXIT_SUCCESS);
540      }      }
541    
542    wait (&status);    wait (&status);
543    if (!WIFEXITED (status))    if (!WIFEXITED (status))
544      exit (1);      exit (EXIT_FAILURE);
545    else if (WRETCODE (status) != 0)    else if (WRETCODE (status) != 0)
546      exit (WRETCODE (status));      exit (WRETCODE (status));
547    
# Line 554  main (argc, argv) Line 554  main (argc, argv)
554    
555  #endif /* ! DISABLE_DIRECT_ACCESS */  #endif /* ! DISABLE_DIRECT_ACCESS */
556    
557    return 0;    return EXIT_SUCCESS;
558  }  }
559    
560  #ifdef MAIL_USE_MAILLOCK  #ifdef MAIL_USE_MAILLOCK
# Line 607  fatal (s1, s2) Line 607  fatal (s1, s2)
607    if (delete_lockname)    if (delete_lockname)
608      unlink (delete_lockname);      unlink (delete_lockname);
609    error (s1, s2, 0);    error (s1, s2, 0);
610    exit (1);    exit (EXIT_FAILURE);
611  }  }
612    
613  /* Print error message.  `s1' is printf control string, `s2' and `s3'  /* Print error message.  `s1' is printf control string, `s2' and `s3'
# Line 709  char Errmsg[200];              /* POP errors, at lea Line 709  char Errmsg[200];              /* POP errors, at lea
709   * If the mailbox is in the form "po:username:hostname", then it is   * If the mailbox is in the form "po:username:hostname", then it is
710   * modified by this function -- the second colon is replaced by a   * modified by this function -- the second colon is replaced by a
711   * null.   * null.
712     *
713     * Return a value suitable for passing to `exit'.
714   */   */
715    
716  int  int
# Line 736  popmail (mailbox, outfile, preserve, pas Line 738  popmail (mailbox, outfile, preserve, pas
738    if (! server)    if (! server)
739      {      {
740        error ("Error connecting to POP server: %s", pop_error, 0);        error ("Error connecting to POP server: %s", pop_error, 0);
741        return (1);        return EXIT_FAILURE;
742      }      }
743    
744    if (pop_stat (server, &nmsgs, &nbytes))    if (pop_stat (server, &nmsgs, &nbytes))
745      {      {
746        error ("Error getting message count from POP server: %s", pop_error, 0);        error ("Error getting message count from POP server: %s", pop_error, 0);
747        return (1);        return EXIT_FAILURE;
748      }      }
749    
750    if (!nmsgs)    if (!nmsgs)
751      {      {
752        pop_close (server);        pop_close (server);
753        return (0);        return EXIT_SUCCESS;
754      }      }
755    
756    mbfi = open (outfile, O_WRONLY | O_CREAT | O_EXCL, 0666);    mbfi = open (outfile, O_WRONLY | O_CREAT | O_EXCL, 0666);
# Line 756  popmail (mailbox, outfile, preserve, pas Line 758  popmail (mailbox, outfile, preserve, pas
758      {      {
759        pop_close (server);        pop_close (server);
760        error ("Error in open: %s, %s", strerror (errno), outfile);        error ("Error in open: %s, %s", strerror (errno), outfile);
761        return (1);        return EXIT_FAILURE;
762      }      }
763    fchown (mbfi, getuid (), -1);    fchown (mbfi, getuid (), -1);
764    
# Line 766  popmail (mailbox, outfile, preserve, pas Line 768  popmail (mailbox, outfile, preserve, pas
768        error ("Error in fdopen: %s", strerror (errno), 0);        error ("Error in fdopen: %s", strerror (errno), 0);
769        close (mbfi);        close (mbfi);
770        unlink (outfile);        unlink (outfile);
771        return (1);        return EXIT_FAILURE;
772      }      }
773    
774    if (reverse_order)    if (reverse_order)
# Line 789  popmail (mailbox, outfile, preserve, pas Line 791  popmail (mailbox, outfile, preserve, pas
791          {          {
792            error (Errmsg, 0, 0);            error (Errmsg, 0, 0);
793            close (mbfi);            close (mbfi);
794            return (1);            return EXIT_FAILURE;
795          }          }
796        mbx_delimit_end (mbf);        mbx_delimit_end (mbf);
797        fflush (mbf);        fflush (mbf);
# Line 798  popmail (mailbox, outfile, preserve, pas Line 800  popmail (mailbox, outfile, preserve, pas
800            error ("Error in fflush: %s", strerror (errno), 0);            error ("Error in fflush: %s", strerror (errno), 0);
801            pop_close (server);            pop_close (server);
802            close (mbfi);            close (mbfi);
803            return (1);            return EXIT_FAILURE;
804          }          }
805      }      }
806    
# Line 812  popmail (mailbox, outfile, preserve, pas Line 814  popmail (mailbox, outfile, preserve, pas
814    if (fsync (mbfi) < 0)    if (fsync (mbfi) < 0)
815      {      {
816        error ("Error in fsync: %s", strerror (errno), 0);        error ("Error in fsync: %s", strerror (errno), 0);
817        return (1);        return EXIT_FAILURE;
818      }      }
819  #endif  #endif
820    
821    if (close (mbfi) == -1)    if (close (mbfi) == -1)
822      {      {
823        error ("Error in close: %s", strerror (errno), 0);        error ("Error in close: %s", strerror (errno), 0);
824        return (1);        return EXIT_FAILURE;
825      }      }
826    
827    if (! preserve)    if (! preserve)
# Line 829  popmail (mailbox, outfile, preserve, pas Line 831  popmail (mailbox, outfile, preserve, pas
831            {            {
832              error ("Error from POP server: %s", pop_error, 0);              error ("Error from POP server: %s", pop_error, 0);
833              pop_close (server);              pop_close (server);
834              return (1);              return EXIT_FAILURE;
835            }            }
836        }        }
837    
838    if (pop_quit (server))    if (pop_quit (server))
839      {      {
840        error ("Error from POP server: %s", pop_error, 0);        error ("Error from POP server: %s", pop_error, 0);
841        return (1);        return EXIT_FAILURE;
842      }      }
843    
844    return (0);    return EXIT_SUCCESS;
845  }  }
846    
847  int  int
# Line 957  strerror (errnum) Line 959  strerror (errnum)
959    
960  /* arch-tag: 1c323112-41fe-4fe5-8de9-494de631f73f  /* arch-tag: 1c323112-41fe-4fe5-8de9-494de631f73f
961     (do not change this comment) */     (do not change this comment) */
962    
963    /* movemail.c ends here */

Legend:
Removed from v.1.78.2.1  
changed lines
  Added in v.1.78.2.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26