home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 1 / GoldFishApril1994_CD2.img / d4xx / d473 / cnewssrc / cnews_src.lzh / relay / article.c < prev    next >
C/C++ Source or Header  |  1990-09-16  |  1KB  |  61 lines

  1. /* :ts=4
  2.  * article creation and destruction
  3.  *
  4.  *    $Log$
  5.  */
  6.  
  7. #include <stdio.h>
  8. #ifdef unix
  9. # include <sys/types.h>
  10. #endif /* unix */
  11. #include "libc.h"
  12. #include "news.h"
  13. #include "headers.h"
  14. #include "article.h"
  15.  
  16. void
  17. artinit(art)
  18. register struct article *art;
  19. {
  20.     static long uniqno = 0;
  21.  
  22.     art->a_status = ST_OKAY;
  23.     hdrinit(&art->h);
  24.     art->a_haccum = NULL;
  25.     art->a_hnext = NULL;
  26.     art->a_hpalloced = 0;
  27.     art->a_hpused = 0;
  28.     art->a_hptrs = NULL;
  29.     art->a_hbytesleft = 0;
  30.     art->a_files = NULL;
  31.     art->a_tmpf = NULL;
  32.     art->a_artf = NULL;
  33.     art->a_unlink = NO;
  34.     art->a_filed = NO;
  35.     art->a_xref = NO;
  36.     art->a_blvmax = NO;
  37.     art->a_charswritten = 0;
  38.     art->a_unread = 0;
  39.     art->a_id = uniqno++;
  40. }
  41.  
  42. void
  43. artfree(art)
  44. register struct article *art;
  45. {
  46.     freeheaders(&art->h);
  47.     /* a_haccum is currently not malloced */
  48.     art->a_hptrs = NULL;        /* don't free a_hptrs; see hdrsave() */
  49.     nnfree(&art->a_files);
  50.     nnfree(&art->a_tmpf);
  51.     if (art->a_artf != NULL) {
  52.         (void) fprintf(stderr, "%s: a_artf still open in artfree()\n",
  53.             progname);
  54.         if (nfclose(art->a_artf) == EOF) {
  55.             art->a_status |= ST_DROPPED;
  56.             warning("error closing %s", art->a_tmpf);
  57.         }
  58.         art->a_artf = NULL;
  59.     }
  60. }
  61.