File: do_all_servers.C

package info (click to toggle)
peruser 4b33-10
  • links: PTS
  • area: main
  • in suites: woody
  • size: 2,944 kB
  • ctags: 1,064
  • sloc: cpp: 22,397; perl: 2,733; makefile: 345; sh: 335
file content (46 lines) | stat: -rw-r--r-- 872 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <stdlib.h>
#include <stdio.h>

#include <gtk/gtk.h>

#include "npfile.h"
#include "npstringarray.h"
#include "npgroup.h"
#include "npnode.h"
#include "nptree.h"
#include "npcollections.h"

int NP_Collections::do_all_servers( FILE *file, NP_Stringarray& output_lines )
{
   int total;
   if ( tree.get_totals( &total, NULL, NULL, NULL, NULL, NULL ))
   {
      tree.print_error();
      return 1;
   }

   if ( !total )
      return 0;

   NP_Stringarray server_array;
   if ( tree.get_nodes( server_array ))
   {
      tree.print_error();
      return 1;
   }

   for( int i = 0; i < total; ++i )
   {
      char *server_name = ( char *)server_array[ i ];
      if ( server_name == NULL )
      {
         server_array.print_error();
         continue;
      }

      if ( do_one_server( server_name, file, output_lines ))
         return 1;
   }

   return 0;
}