home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 2 / 2785 / funcs.c next >
C/C++ Source or Header  |  1991-02-19  |  646b  |  51 lines

  1. /*
  2. **    f u n c s . c
  3. **
  4. **    functions for performing single operations
  5. **
  6. **    Arthur W. Neilson III
  7. **    art@bohtsg.pegasus.com
  8. **    Feb 7, 1990
  9. **
  10. */
  11.  
  12. #include "main.h"
  13. #include "node.h"
  14.  
  15. /*
  16. **    d e l
  17. **
  18. **    delete file
  19. **
  20. */
  21. Node   *
  22. del(node)
  23. Node   *node;
  24. {
  25.     if (access(node->name, W_OK) == 0)
  26.         if (execute(RM, RM, "-f", node->name, NULL) == 0) {
  27.             if (--total == 0)
  28.                 quit(1);
  29.             bytes -= node->st->st_size;
  30.             if (node == tail)
  31.                 tail = node->prev;
  32.             node = rmnode(node);
  33.         }
  34.     return (node);
  35. }
  36.  
  37. /*
  38. **    p r i n t
  39. **
  40. **    print a file
  41. **
  42. */
  43. VOID
  44. lp(name)
  45. char   *name;
  46. {
  47.     if (access(name, R_OK) == 0) {
  48.         execute(LP, LP, LPOPTS, name, NULL);
  49.     }
  50. }
  51.