diff --git a/src/client/distren.c b/src/client/distren.c --- a/src/client/distren.c +++ b/src/client/distren.c @@ -40,7 +40,7 @@ int main(int argc, char *argv[]) char *input; char *output; char *jobid; - + char curopt; distren_t distren; @@ -73,19 +73,19 @@ int main(int argc, char *argv[]) */ } else if(curopt == 'i') - /* - TODO: is strdup good or bad? what about + /* + TODO: is strdup good or bad? what about the idea that all libs should allow plugging different malloc/free implementations in? */ input = strdup(optarg); else if(curopt == 'o') output = strdup(optarg); - } + } - /* + /* give this error after the general arguments parsing so that - the general help from options_init can have effect + the general help from options_init can have effect */ if(!input || !output) @@ -95,19 +95,19 @@ int main(int argc, char *argv[]) } fprintf(stderr, "reading from %s\nwriting to %s\n", input, output); - + if(distren_init_mf(&distren, &malloc, &free)) { fprintf(stderr, "error initializing distren handle\n"); return 1; } - + if(distren_submit_file(distren, &distren_job, input)) { fprintf(stderr, "error submitting file\n"); return 1; - } - + } + if(distren_job_getid(distren_job, &jobid)) { fprintf(stderr, "error retrieving job id\n"); @@ -123,10 +123,9 @@ int main(int argc, char *argv[]) /* if these following lines fail, it'll be reported as a core dump ;-) */ distren_job_free(distren_job); - distren_free(distren); - +// !!! Killed for now because I'm doing other randomness !!! // // Please find a better way of doing this :( you can't strcat multiple strings.. meh // use something like sprintf //char *username = cfg_getstr(cfg, "username"); @@ -135,6 +134,7 @@ int main(int argc, char *argv[]) //strcat(username, hostname); // SSH's to client machine with the username speficied. + /* char buf[10]; struct execio *testrem; char *execargv[] = @@ -152,6 +152,8 @@ int main(int argc, char *argv[]) fprintf(stderr, "execio madness is occuring!"); fprintf(stderr, "execio_open returns %d\n", execio_open(&testrem, "ssh", execargv)); buf[9] = '\0'; +*/ + /* while(!execio_read(testrem, buf, 9, &readlen)) { @@ -169,8 +171,37 @@ int main(int argc, char *argv[]) // We need some code to ssh, and if the SSH fails, tell the user to register. // Killed the user reg code, as the php interface will take care of this. Although it should check for users... - - return 0; + + + // ------------------------------ + // Ok, this is just to do something to keep distren aliveish... Kill if needed/wanted/meh'd. Borrowed some code from matt's blender.c + + // We need calls to populate os. This is pretty rudimentary. Should be moved to shared, or use bultin something. Change on compiletime? + char *os = "nix"; + if(os == 'win32'){char *bin = 'blender.exe'} + else{char *bin = 'blender'} // mac/*nix + + // Placeholders? figure out what the last one is... + char *format = "%s -b \"%s\" -o %s -f %d -F JPEG -x 1",bin,input,output; /* the format string to pass to sprintf */ + + unsigned int frame_to_render; // initialize this somewhere else... + size_t blenderstrlen; + frame_to_render = 10; // temporary, the number 10 will be replaced with a function call + +// This seems pretty ridik. Just sayin'. We gotta switch this up. + blenderstrlen = strlen(format) - 2 * 2 /* format string minus placeholders */ + strlen(filename) + intstrlen(frame_to_render) + 1 /* NULL terminator */; + blendercmd = malloc(blenderstrlen); + snprintf(blendercmd, blenderstrlen, format, filename, frame_to_render); + + fprintf(stderr, "will run job num. %d ``%s''\n",jobid,blendercmd); + free(blendercmd); + + + // -------------End cruddy code that will eventually compose blender.c----------------- + + + + return 0; };