+ int i,j;
+
+ /* Save the gras-log argument of real command line to pass it to all processes */
+ for (i=1; i<argc; i++) {
+ if (!strncmp(argv[i],"--gras-log=",strlen("--gras-log="))) {
+ if (gras_log) {
+ char *tmp=malloc(strlen(gras_log)+strlen(argv[i])+2);
+ sprintf(tmp,"%s %s",gras_log, argv[i]);
+ free(gras_log);
+ gras_log=tmp;
+ } else {
+ gras_log = strdup(argv[i]);
+ }
+ for (j=i+1; j<argc; j++) {
+ argv[j-1] = argv[j];
+ }
+ argv[j-1] = NULL;
+ argc--;
+ i--; /* compensate effect of next loop incrementation */
+ }
+ }
+
+ if (argc != 3) {
+ fprintf(stderr, "Usage: %s platform_file application_description.txt [--gras-log=...]\\n",argv[0]);