home *** CD-ROM | disk | FTP | other *** search
/ Unix System Administration Handbook 1997 October / usah_oct97.iso / news / cnews.tar / relay / article.c < prev    next >
C/C++ Source or Header  |  1993-03-13  |  790b  |  43 lines

  1. /*
  2.  * article creation and destruction
  3.  */
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. #include <errno.h>
  7. #include "fixerrno.h"
  8.  
  9. #include <sys/types.h>
  10. #include "libc.h"
  11. #include "news.h"
  12. #include "headers.h"
  13. #include "relay.h"
  14.  
  15. void
  16. artinit(art)
  17. register struct article *art;
  18. {
  19.     static long uniqno = 0;
  20.     static struct article zart;
  21.  
  22.     *art = zart;
  23.     hdrinit(&art->h);
  24.     art->a_status = ST_OKAY;
  25.     art->a_id = uniqno++;
  26. }
  27.  
  28. void
  29. artfree(art)
  30. register struct article *art;
  31. {
  32.     freeheaders(&art->h);
  33.     /* a_haccum is currently not malloced */
  34.     art->a_hptrs = NULL;        /* don't free a_hptrs; see hdrsave() */
  35.     nnfree(&art->a_files);
  36.     if (art->a_artf != NULL) {
  37.         errno = 0;
  38.         canthappen(art, 'i', "a_artf still open in artfree()", "");
  39.     }
  40.     nnfclose(art, &art->a_artf, art->a_tmpf);
  41.     nnfree(&art->a_tmpf);
  42. }
  43.