home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / source / emacs-18.59src.lha / emacs-18.59 / amiga / contrib / hessu / movemail / movemail.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-07-22  |  694 b   |  45 lines

  1. /*
  2.  * MOVEMAIL.C
  3.  *
  4.  * compile: cc
  5.  *
  6.  * Written by Tapio Heiskanen
  7.  *
  8.  * Copyright (c) 1992 Ferry Island Technologies
  9.  * All rights reserved
  10.  *
  11.  * Created: 22-Jul-92
  12.  */
  13.  
  14. #include "version.h"
  15.  
  16. #include <proto/dos.h>
  17. #include <stdio.h>
  18. #include <stdlib.h>
  19.  
  20. char *version="$VER: movemail V"VERSION;
  21.  
  22. void main(int ac, char **arg)
  23.     {
  24.     char buf[256];
  25.     FILE *tofile, *spoolfile;
  26.  
  27.     if(!(spoolfile=fopen(arg[1], "r")))
  28.         {
  29.         printf("movemail: Can't open spool file %s\n", arg[1]);
  30.         exit(10);
  31.         }
  32.  
  33.     if(!(tofile=fopen(arg[2], "a")))
  34.         {
  35.         printf("movemail: Can't open to file %s\n", arg[2]);
  36.         exit(10);
  37.         }
  38.  
  39.     while(fgets(buf, 256, spoolfile))
  40.         fputs(buf, tofile);
  41.  
  42.     fcloseall();
  43.     remove(arg[1]);
  44.     }
  45.