# HG changeset patch # User normaldotcom # Date 2010-02-09 19:12:13 # Node ID afc21acbe5ef5b28197eb7ff8f8c1c22fec39c0c # Parent 4d01516c95d17356971cbe466c53626ec77bee83 Commenting, more cleanup diff --git a/src/server/distrend.c b/src/server/distrend.c --- a/src/server/distrend.c +++ b/src/server/distrend.c @@ -74,10 +74,9 @@ struct general_info }; - -/*********************************** - Function Prototypes - *********************************** */ +/* ********************************************* + Function Prototypes + ********************************************* */ /* ************General Functions************* */ int xml_dump(); @@ -117,16 +116,13 @@ int interactiveTest(int test, struct gen int job_getserialfilename(char **filename, struct general_info *geninfo, unsigned int jobnum, int createdir); int distren_mkdir_recurse(char *dirname); -/* ************************** Main ************************* */ - +/* **************** Main ********************* */ int main(int argc, char *argv[]) { - /* Parse arguments */ int counter; int test = 0; /*< Interactive mode if 1 */ struct general_info general_info; - int cont; struct distrend_clientset *clients; enum clientstatus @@ -143,16 +139,16 @@ int main(int argc, char *argv[]) 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; + return 2; } else if(strcmp(argv[counter], "-t") == 0) { fprintf(stderr, "Entering into test mode...\n\n"); - test=1; + test = 1; } } - cont = 1; + if(distrend_do_config(argc, argv, &general_info.config)) return 1; @@ -171,11 +167,12 @@ int main(int argc, char *argv[]) prepare_distrenjob(&general_info, 1, "awesome", "LordOfWar", 8, 1, 100, 640, 480); prepare_distrenjob(&general_info, 1, "hamburger", "ohnobinki", 3, 1, 50, 1280, 720); - // Execute test function - interactiveTest(test, general_info); + /** Execute test function */ + interactiveTest(test, general_info); distrend_listen(general_info.config, &clients); - /* This is called the "main loop" */ + + /* Main Loop */ while(!general_info.config->die) { int clientsays = 0; /*< temporary example variable, will be replaced when we can handle messages */ @@ -185,7 +182,6 @@ int main(int argc, char *argv[]) /* Make the following code more event-driven */ frame_watchdog(&general_info.head); - struct frameset *frame; struct distrenjob *job; @@ -1147,6 +1143,8 @@ int reCreateQueueFromXML(struct general_ } /* ************************** Test Functions ************************* */ + +/** Prints info about frames in a frameset */ int printFrameInfo(struct frameset *frame) { char *status; @@ -1174,6 +1172,7 @@ int printFrameInfo(struct frameset *fram return 0; } +/** Prints information about all frames in a job */ int printJob(struct distrenjob *job) { int counter; @@ -1186,6 +1185,7 @@ int printJob(struct distrenjob *job) return 1; } +/** Prints information about a job */ int printJobInfo(struct distrenjob *job) { fprintf(stderr, "type: %d\n", job->type); @@ -1203,6 +1203,7 @@ int printJobInfo(struct distrenjob *job) return 1; } +/** Print all jobnums in the queue */ int printAllJobnums(struct distrenjob *head) { struct distrenjob *current_job; @@ -1221,6 +1222,7 @@ int printAllJobnums(struct distrenjob *h return 1; } +/** Interactive test for the queuing system */ int interactiveTest(int test, struct general_info general_info){ int command; jobnum_t jobnum; @@ -1337,6 +1339,7 @@ int job_getserialfilename(char **filenam return 0; } +/** Creates directories recursively */ int distren_mkdir_recurse(char *dirname) { size_t counter;