home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 2 / 2785 / mass.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-02-20  |  1.6 KB  |  80 lines

  1. /*
  2. **    m a s s . c
  3. **
  4. **    functions for performing tagged/untagged
  5. **    operations en masse
  6. **
  7. **    Arthur W. Neilson III
  8. **    art@bohtsg.pegasus.com
  9. **    Feb 7, 1991
  10. **
  11. */
  12.  
  13. #include "main.h"
  14. #include "node.h"
  15.  
  16. /*
  17. **    m a s s d e l
  18. **
  19. **    unlink tagged/untagged files en masse
  20. **
  21. */
  22. Node   *
  23. massdel(c)
  24. int     c;
  25. {
  26.     Node   *this, *node, *del();
  27.     int     hflag;
  28.  
  29.     node = head;        /* point to head of list */
  30.     do {
  31.         hflag = 0;
  32.         this = node;    /* save pointer to this node */
  33.         node = node->next;    /* point to next node */
  34.         if ((c == 't') ? (this->flags & TAG) : !(this->flags & TAG)) {
  35.             hflag = (this == head);
  36.             wprintw(jobscr, "\n\tDeleting %s, %8lu bytes freed",
  37.                 this->name, this->st->st_size);
  38.             (VOID) del(this);    /* delete this node */
  39.         }
  40.         if (c == 'u' && (this->flags & TAG)) {    /* is tag on? */
  41.             this->flags &= ~TAG;    /* turn tag off */
  42.             this->flags |= WAS;    /* turn was tag on */
  43.         }
  44.     } while (node != head || hflag);
  45.  
  46.     newline(jobscr);
  47.     return (head);
  48. }
  49.  
  50. /*
  51. **    m a s s p r i n t
  52. **
  53. **    spool files to printer en masse
  54. **
  55. */
  56. Node   *
  57. massprint(c)
  58. int     c;
  59. {
  60.     Node   *node;
  61.     VOID    print();
  62.  
  63.     node = head;        /* point to head of list */
  64.     do {
  65.         if ((c == 't') ? (node->flags & TAG) : !(node->flags & TAG)) {
  66.             wprintw(jobscr, "\n\tSpooled %s to printer", node->name);
  67.             lp(node->name);    /* print file */
  68.         }
  69.         if (node->flags & TAG) {    /* is tag on? */
  70.             node->flags &= ~TAG;    /* turn tag off */
  71.             node->flags |= WAS;    /* turn was tag on */
  72.         } else if (node->flags & WAS)
  73.             node->flags &= ~WAS;    /* turn was tag off */
  74.         node = node->next;    /* point to next node */
  75.     } while (node != head);
  76.  
  77.     newline(jobscr);
  78.     return (head);
  79. }
  80.