diff --git a/src/server/slave.c b/src/server/slave.c --- a/src/server/slave.c +++ b/src/server/slave.c @@ -42,9 +42,15 @@ int main(int argc, char *argv[]) int jobnum; char *jobname; int framenum; - +int counter; /* Parses arguments, skips if there are no args */ +for(counter=0; counter \nStarts a distren slave\n\t-h\tshow this help\n\t-c\tregisters a user with [username] and [emailaddr] \n"); + return 2; + } +} if(argc>1 && (strcmp("-c", argv[1]) == 0)) { @@ -53,7 +59,7 @@ int framenum; if(argc != 4) { - fprintf(stderr, "I need more arguments!\n%d is not enough!\n Invoke 'distrenslave -c to register. \n Already registered? Edit your distrenslave.conf file!'", argc - 1); + fprintf(stderr, "I need more arguments!\n%d is not enough!\n Invoke 'distrenslave -c to register. \n Already registered? Edit your distrenslave.conf file!\n'", argc - 1); return 234; } @@ -65,7 +71,7 @@ int framenum; fprintf(stderr, "I want to see an '@' in your email address!\n%s may be good enough for you, but I need more!\n", email); return 235; } - register_user(username, email); // register_user returns a uniquely random url to a key + // register_user(username, email); // register_user returns a uniquely random url to a key */ fprintf(stderr, "You registered, hopefully successfully. Invoke distrenslave with no args now."); } /* End arg parser */ @@ -88,20 +94,22 @@ options_init(argc,argv,&my_cfg, myopts, /* End option getter */ -/* If there's no key or username in the conf, let them know! */ - if(key == NULL || username == NULL){ - fprintf(stderr, "You didn't register! Please register (Invoke '%s -c to register) or add your username to distrenslave.conf\n", argv[0]); +/* If there's no key or username in the conf, or if they're at the default (!key/!username) let the user know! */ + if(key == NULL || username == NULL || strcmp(key, "!key") == 0 || strcmp(username, "!username") == 0 ){ + fprintf(stderr, "\nYou didn't register!\nPlease register or edit your config. (see -h)\nIf this error persists, check distrenslave.conf to ensure all items are filled.\n", argv[0]); } - else if(key != NULL || username != NULL){ + else if(key != NULL && username != NULL || key != "!key" && username != "username" ){ + fprintf(stderr, "Your username is %s, and your key is %s.\n",username, key); loginuser(username); // Logs in user to the server } else{ - fprintf(stderr,"Something is terribly wrong!!!"); + fprintf(stderr,"Something is terribly wrong!!!"); } -/* Rendering code */ +/* Somewhat pseudo Rendering code */ +/* if('slave recieves "start frame#, job#"'){ fprintf(stderr, "Got frame %d in job %d, preparing to render...",framenum,jobnum); get('http://distren.protofusion.org/srv/job%d.tgz', jobnum); // use curl @@ -121,6 +129,7 @@ options_init(argc,argv,&my_cfg, myopts, tell_the_server(DISTREN_REQUEST_DONEFRAME); // AKA "I'm done rendering that frame you sent me" // Slave now becomes idle, doesn't need to tell the server anything, ssh handles this. } +*/ return 0; }