1: #define SERVER
   2: 
   3: #include <stdio.h>
   4: #include "config.h"
   5: #include "../common/response_codes.h"
   6: 
   7: main(argc, argv)
   8: int argc;
   9: char *argv[];
  10: {
  11:     char ser_line[256];
  12:     register FILE *actfp;
  13: 
  14:     if (argc != 2) {
  15:         fprintf(stderr, "Usage: getactive filename\n");
  16:         exit(1);
  17:     }
  18: 
  19:     if (server_init(SERVER_HOST) < 0) {
  20:         fprintf(stderr,
  21:             "getactive: Can't get active file from server.\n");
  22:         exit(1);
  23:     }
  24: 
  25:     put_server("LIST"); /* tell server we want the active file */
  26:     (void) get_server(ser_line, sizeof(ser_line));
  27:     if (*ser_line != CHAR_OK) {     /* and then see if that's ok */
  28:         fprintf(stderr,
  29:             "getactive: Can't get active file from server.\n");
  30:         fprintf(stderr, "Server said: %s\n", ser_line);
  31:         exit(1);
  32:     }
  33: 
  34:     actfp = fopen(argv[1], "w");        /* and get ready */
  35: 
  36:     while (get_server(ser_line, sizeof(ser_line)) >= 0) {  /* while */
  37:         if (ser_line[0] == '.')     /* there's another line */
  38:             break;          /* get it and write it to */
  39:         if (actfp != NULL) {        /* the temporary active file */
  40:             fputs(ser_line, actfp);
  41:             putc('\n', actfp);
  42:         }
  43:     }
  44: 
  45:     (void) fclose(actfp);
  46:     close_server();
  47: }

Defined functions

main defined in line 7; used 1 times

Defined macros

SERVER defined in line 1; never used
Last modified: 1986-03-21
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 964
Valid CSS Valid XHTML 1.0 Strict