Changeset - b7292b0017bf
[Not reviewed]
default
0 1 0
Nathan Brink (binki) - 16 years ago 2009-10-14 00:21:27
ohnobinki@ohnopublishing.net
reorganization for style and libxml2 usage
1 file changed with 32 insertions and 23 deletions:
0 comments (0 inline, 0 general)
src/server/distrend.c
Show inline comments
 
@@ -480,13 +480,12 @@ int distrend_do_config(int argc, char *a
 
    };
 

	
 
  struct distrenjob *distrenjob;
 

	
 
  int tmp;
 

	
 
  xmlinit();
 
  /*
 
   * test xml2distrenjob()
 
   */
 
  tmp = xml2distrenjob(&distrenjob, "distrenjob.xml.example");
 
  if(tmp)
 
    fprintf(stderr, "xml2distrenjob() returned %d. Try to cd to distren/doc if you want to test out the xml2distrenjob() function. (This will only fix this error if the error is due to an inability of the xml library to access distrenjob.xml.example)\n\n", tmp);
 
@@ -499,13 +498,12 @@ int distrend_do_config(int argc, char *a
 
  myopts[1].simple_value = &(*config)->datadir;
 

	
 
  options_init(argc, argv, &(*config)->mycfg, myopts, "daemon", &(*config)->options);
 

	
 
  fprintf(stderr, "using %s as datadir\n", (*config)->datadir);
 

	
 
  xmlcleanup();
 
  return 0;
 
}
 
int distrend_config_free(struct distrend_config *config)
 
{
 
  options_free(config->options);
 
  free(config);
 
@@ -894,48 +892,29 @@ void printAllJobnums(struct distrenjob *
 
/* ************************** Main ************************* */
 

	
 
int main(int argc, char *argv[])
 
{
 

	
 
  /* Argument-parser */
 
  int counter = 0;
 
  int test = 0; // Have some fun if-ness that does fun stuff when this is 1
 

	
 
  for(counter=0; counter<argc; counter++){
 
         if(strcmp(argv[counter], "-h") == 0) {
 
           fprintf(stderr, "Usage: distrend [option] \nStarts the distrend server\n\t-h\tshow this help\n\t-t\tlaunches queue testing interface \n");
 
           return 2;
 
          }
 

	
 
          else if(strcmp(argv[counter], "-t") == 0) {
 
            fprintf(stderr, "Entering into test mode...\n\n");
 
            test=1;
 
          }
 
  }
 
  int counter;
 
  int test; // Have some fun if-ness that does fun stuff when this is 1
 

	
 

	
 
  struct distrenjob head;
 
  head.priority = 0; // make head have the highest priority
 

	
 
  int cont;
 
  struct distrend_listenset *listenset;
 
  struct distrend_config *config;
 

	
 
  enum clientstatus
 
  {
 
    CLIENTSTATUS_UNINITIALIZED = 0,
 
    CLIENTSTATUS_BUSY = 1,
 
    CLIENTSTATUS_IDLE = 2
 
  } clientstatus;
 

	
 
  cont = 1;
 
  memset(&head, '\0', sizeof(struct distrenjob));
 

	
 
  start_data(&head); // Starts fresh or loads data from xml dump. Should we grab the return?
 

	
 
  distrend_do_config(argc, argv, &config);
 

	
 
  int command;
 
  jobnum_t jobnum;
 
  struct distrenjob *tmp_job;
 
  struct frameset *tmp_frame;
 
  int type;
 
@@ -946,12 +925,40 @@ int main(int argc, char *argv[])
 
  int width;
 
  int height;
 
  int start_frame;
 
  int end_frame;
 
  size_t read_buf;
 

	
 
  head.priority = 0; // make head have the highest priority
 

	
 
  xmlinit();
 

	
 
  test = 0;
 
  for(counter = 0; counter < argc; counter ++)
 
    {
 
      if(strcmp(argv[counter], "-h") == 0)
 
	{
 
	  fprintf(stderr, "Usage: distrend [option] \nStarts the distrend server\n\t-h\tshow this help\n\t-t\tlaunches queue testing interface \n");
 
	  return 2;
 
	}
 
      
 
      else if(strcmp(argv[counter], "-t") == 0)
 
	{
 
	  fprintf(stderr, "Entering into test mode...\n\n");
 
	  test=1;
 
	}
 
    }
 
  cont = 1;
 
  memset(&head, '\0', sizeof(struct distrenjob));
 
  
 
  start_data(&head); // Starts fresh or loads data from xml dump. Should we grab the return?
 

	
 
  distrend_do_config(argc, argv, &config);
 

	
 

	
 

	
 
  while(test == 1)
 
  {
 
    fprintf(stderr, "Welcome to DistRen Alpha Interactive Test Mode\n\n");
 
    fprintf(stderr, "\t1 \tPrint all frames in a job\n");
 
    fprintf(stderr, "\t2 \tExamine certain job\n");
 
    fprintf(stderr, "\t3 \tGet a frame to render\n");
 
@@ -1049,8 +1056,10 @@ int main(int argc, char *argv[])
 
      distrend_action_free(action);
 
    }
 

	
 
  distrend_unlisten(listenset);
 
  distrend_config_free(config);
 

	
 
  xmlcleanup();
 

	
 
  return 0;
 
}
0 comments (0 inline, 0 general)