Changeset - ba5d7bfefee2
[Not reviewed]
default
0 1 0
Nathan Brink (binki) - 16 years ago 2009-07-03 13:08:12
ohnobinki@ohnopublishing.net
sample main() function for distrend
1 file changed with 18 insertions and 15 deletions:
0 comments (0 inline, 0 general)
src/server/distrend.c
Show inline comments
 
@@ -73,23 +73,26 @@ we get a key generated on the server, an
 

	
 
*/
 

	
 

	
 
// We need the conf parser code from options.c here!!!
 
char *username = "unregistered"; // get this from conf
 

	
 

	
 
  int cont = 1;
 
  struct distrend_listenset *listenset;
 
  struct distrend_config *config;
 
  distrend_do_config(argc, argv, &config);
 

	
 
// Checks if the conf is left at the default username
 
int registered;
 
 error: People, this is not C++
 
if(username == "unregistered") {
 
  fprintf(stderr,"\nYou have not set your username in distrend.conf!\nIf you need to register a username, run distrend -c username email@example.com\n\n");
 
  registered = 0;
 
}
 
else{
 
  fprintf(stderr,"Logging into the DistRen server...\n");
 
}
 
  distrend_listen(&listenset, config);
 
  /* This is called the ``main loop'' */
 
  while(cont)
 
    {
 
      struct distren_action *action;
 
      
 
      distrend_accept(&action);
 
      cont = distrend_do(action);
 
      distrend_action_free(action);
 
    }
 
  
 
  distrend_unlisten(listenset);
 
  distrend_config_free(config);
 

	
 
  return 0;
 
}
 

	
 

	
0 comments (0 inline, 0 general)