static int do_multi(int multi)
	{
	int n;
	int fd[2];
	int *fds;
	static char sep[]=":";
	fds=malloc(multi*sizeof *fds);
	for(n=0 ; n < multi ; ++n)
		{
		if (pipe(fd) == -1)
			{
			fprintf(stderr, "pipe failure\n");
			exit(1);
			}
		fflush(stdout);
		fflush(stderr);
		if(fork())
			{
			close(fd[1]);
			fds[n]=fd[0];
			}
		else
			{
			close(fd[0]);
			close(1);
			if (dup(fd[1]) == -1)
				{
				fprintf(stderr, "dup failed\n");
				exit(1);
				}
			close(fd[1]);
			mr=1;
			usertime=0;
			free(fds);
			return 0;
			}
		printf("Forked child %d\n",n);
		}
	for(n=0 ; n < multi ; ++n)
		{
		FILE *f;
		char buf[1024];
		char *p;
		f=fdopen(fds[n],"r");
		while(fgets(buf,sizeof buf,f))
			{
			p=strchr(buf,'\n');
			if(p)
				*p='\0';
			if(buf[0] != '+')
				{
				fprintf(stderr,"Don't understand line '%s' from child %d\n",
						buf,n);
				continue;
				}
			printf("Got: %s from %d\n",buf,n);
			if(!strncmp(buf,"+F:",3))
				{
				int alg;
				int j;
				p=buf+3;
				alg=atoi(sstrsep(&p,sep));
				sstrsep(&p,sep);
				for(j=0 ; j < SIZE_NUM ; ++j)
					results[alg][j]+=atof(sstrsep(&p,sep));
				}
			else if(!strncmp(buf,"+F2:",4))
				{
				int k;
				double d;
				p=buf+4;
				k=atoi(sstrsep(&p,sep));
				sstrsep(&p,sep);
				d=atof(sstrsep(&p,sep));
				if(n)
					rsa_results[k][0]=1/(1/rsa_results[k][0]+1/d);
				else
					rsa_results[k][0]=d;
				d=atof(sstrsep(&p,sep));
				if(n)
					rsa_results[k][1]=1/(1/rsa_results[k][1]+1/d);
				else
					rsa_results[k][1]=d;
				}
			else if(!strncmp(buf,"+F2:",4))
				{
				int k;
				double d;
				p=buf+4;
				k=atoi(sstrsep(&p,sep));
				sstrsep(&p,sep);
				d=atof(sstrsep(&p,sep));
				if(n)
					rsa_results[k][0]=1/(1/rsa_results[k][0]+1/d);
				else
					rsa_results[k][0]=d;
				d=atof(sstrsep(&p,sep));
				if(n)
					rsa_results[k][1]=1/(1/rsa_results[k][1]+1/d);
				else
					rsa_results[k][1]=d;
				}
#ifndef OPENSSL_NO_DSA
			else if(!strncmp(buf,"+F3:",4))
				{
				int k;
				double d;
				p=buf+4;
				k=atoi(sstrsep(&p,sep));
				sstrsep(&p,sep);
				d=atof(sstrsep(&p,sep));
				if(n)
					dsa_results[k][0]=1/(1/dsa_results[k][0]+1/d);
				else
					dsa_results[k][0]=d;
				d=atof(sstrsep(&p,sep));
				if(n)
					dsa_results[k][1]=1/(1/dsa_results[k][1]+1/d);
				else
					dsa_results[k][1]=d;
				}
#endif
#ifndef OPENSSL_NO_ECDSA
			else if(!strncmp(buf,"+F4:",4))
				{
				int k;
				double d;
				p=buf+4;
				k=atoi(sstrsep(&p,sep));
				sstrsep(&p,sep);
				d=atof(sstrsep(&p,sep));
				if(n)
					ecdsa_results[k][0]=1/(1/ecdsa_results[k][0]+1/d);
				else
					ecdsa_results[k][0]=d;
				d=atof(sstrsep(&p,sep));
				if(n)
					ecdsa_results[k][1]=1/(1/ecdsa_results[k][1]+1/d);
				else
					ecdsa_results[k][1]=d;
				}
#endif
#ifndef OPENSSL_NO_ECDH
			else if(!strncmp(buf,"+F5:",4))
				{
				int k;
				double d;
				p=buf+4;
				k=atoi(sstrsep(&p,sep));
				sstrsep(&p,sep);
				d=atof(sstrsep(&p,sep));
				if(n)
					ecdh_results[k][0]=1/(1/ecdh_results[k][0]+1/d);
				else
					ecdh_results[k][0]=d;
				}
#endif
			else if(!strncmp(buf,"+H:",3))
				{
				}
			else
				fprintf(stderr,"Unknown type '%s' from child %d\n",buf,n);
			}
		fclose(f);
		}
	free(fds);
	return 1;
	}
['static int do_multi(int multi)\n\t{\n\tint n;\n\tint fd[2];\n\tint *fds;\n\tstatic char sep[]=":";\n\tfds=malloc(multi*sizeof *fds);\n\tfor(n=0 ; n < multi ; ++n)\n\t\t{\n\t\tif (pipe(fd) == -1)\n\t\t\t{\n\t\t\tfprintf(stderr, "pipe failure\\n");\n\t\t\texit(1);\n\t\t\t}\n\t\tfflush(stdout);\n\t\tfflush(stderr);\n\t\tif(fork())\n\t\t\t{\n\t\t\tclose(fd[1]);\n\t\t\tfds[n]=fd[0];\n\t\t\t}\n\t\telse\n\t\t\t{\n\t\t\tclose(fd[0]);\n\t\t\tclose(1);\n\t\t\tif (dup(fd[1]) == -1)\n\t\t\t\t{\n\t\t\t\tfprintf(stderr, "dup failed\\n");\n\t\t\t\texit(1);\n\t\t\t\t}\n\t\t\tclose(fd[1]);\n\t\t\tmr=1;\n\t\t\tusertime=0;\n\t\t\tfree(fds);\n\t\t\treturn 0;\n\t\t\t}\n\t\tprintf("Forked child %d\\n",n);\n\t\t}\n\tfor(n=0 ; n < multi ; ++n)\n\t\t{\n\t\tFILE *f;\n\t\tchar buf[1024];\n\t\tchar *p;\n\t\tf=fdopen(fds[n],"r");\n\t\twhile(fgets(buf,sizeof buf,f))\n\t\t\t{\n\t\t\tp=strchr(buf,\'\\n\');\n\t\t\tif(p)\n\t\t\t\t*p=\'\\0\';\n\t\t\tif(buf[0] != \'+\')\n\t\t\t\t{\n\t\t\t\tfprintf(stderr,"Don\'t understand line \'%s\' from child %d\\n",\n\t\t\t\t\t\tbuf,n);\n\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\tprintf("Got: %s from %d\\n",buf,n);\n\t\t\tif(!strncmp(buf,"+F:",3))\n\t\t\t\t{\n\t\t\t\tint alg;\n\t\t\t\tint j;\n\t\t\t\tp=buf+3;\n\t\t\t\talg=atoi(sstrsep(&p,sep));\n\t\t\t\tsstrsep(&p,sep);\n\t\t\t\tfor(j=0 ; j < SIZE_NUM ; ++j)\n\t\t\t\t\tresults[alg][j]+=atof(sstrsep(&p,sep));\n\t\t\t\t}\n\t\t\telse if(!strncmp(buf,"+F2:",4))\n\t\t\t\t{\n\t\t\t\tint k;\n\t\t\t\tdouble d;\n\t\t\t\tp=buf+4;\n\t\t\t\tk=atoi(sstrsep(&p,sep));\n\t\t\t\tsstrsep(&p,sep);\n\t\t\t\td=atof(sstrsep(&p,sep));\n\t\t\t\tif(n)\n\t\t\t\t\trsa_results[k][0]=1/(1/rsa_results[k][0]+1/d);\n\t\t\t\telse\n\t\t\t\t\trsa_results[k][0]=d;\n\t\t\t\td=atof(sstrsep(&p,sep));\n\t\t\t\tif(n)\n\t\t\t\t\trsa_results[k][1]=1/(1/rsa_results[k][1]+1/d);\n\t\t\t\telse\n\t\t\t\t\trsa_results[k][1]=d;\n\t\t\t\t}\n\t\t\telse if(!strncmp(buf,"+F2:",4))\n\t\t\t\t{\n\t\t\t\tint k;\n\t\t\t\tdouble d;\n\t\t\t\tp=buf+4;\n\t\t\t\tk=atoi(sstrsep(&p,sep));\n\t\t\t\tsstrsep(&p,sep);\n\t\t\t\td=atof(sstrsep(&p,sep));\n\t\t\t\tif(n)\n\t\t\t\t\trsa_results[k][0]=1/(1/rsa_results[k][0]+1/d);\n\t\t\t\telse\n\t\t\t\t\trsa_results[k][0]=d;\n\t\t\t\td=atof(sstrsep(&p,sep));\n\t\t\t\tif(n)\n\t\t\t\t\trsa_results[k][1]=1/(1/rsa_results[k][1]+1/d);\n\t\t\t\telse\n\t\t\t\t\trsa_results[k][1]=d;\n\t\t\t\t}\n#ifndef OPENSSL_NO_DSA\n\t\t\telse if(!strncmp(buf,"+F3:",4))\n\t\t\t\t{\n\t\t\t\tint k;\n\t\t\t\tdouble d;\n\t\t\t\tp=buf+4;\n\t\t\t\tk=atoi(sstrsep(&p,sep));\n\t\t\t\tsstrsep(&p,sep);\n\t\t\t\td=atof(sstrsep(&p,sep));\n\t\t\t\tif(n)\n\t\t\t\t\tdsa_results[k][0]=1/(1/dsa_results[k][0]+1/d);\n\t\t\t\telse\n\t\t\t\t\tdsa_results[k][0]=d;\n\t\t\t\td=atof(sstrsep(&p,sep));\n\t\t\t\tif(n)\n\t\t\t\t\tdsa_results[k][1]=1/(1/dsa_results[k][1]+1/d);\n\t\t\t\telse\n\t\t\t\t\tdsa_results[k][1]=d;\n\t\t\t\t}\n#endif\n#ifndef OPENSSL_NO_ECDSA\n\t\t\telse if(!strncmp(buf,"+F4:",4))\n\t\t\t\t{\n\t\t\t\tint k;\n\t\t\t\tdouble d;\n\t\t\t\tp=buf+4;\n\t\t\t\tk=atoi(sstrsep(&p,sep));\n\t\t\t\tsstrsep(&p,sep);\n\t\t\t\td=atof(sstrsep(&p,sep));\n\t\t\t\tif(n)\n\t\t\t\t\tecdsa_results[k][0]=1/(1/ecdsa_results[k][0]+1/d);\n\t\t\t\telse\n\t\t\t\t\tecdsa_results[k][0]=d;\n\t\t\t\td=atof(sstrsep(&p,sep));\n\t\t\t\tif(n)\n\t\t\t\t\tecdsa_results[k][1]=1/(1/ecdsa_results[k][1]+1/d);\n\t\t\t\telse\n\t\t\t\t\tecdsa_results[k][1]=d;\n\t\t\t\t}\n#endif\n#ifndef OPENSSL_NO_ECDH\n\t\t\telse if(!strncmp(buf,"+F5:",4))\n\t\t\t\t{\n\t\t\t\tint k;\n\t\t\t\tdouble d;\n\t\t\t\tp=buf+4;\n\t\t\t\tk=atoi(sstrsep(&p,sep));\n\t\t\t\tsstrsep(&p,sep);\n\t\t\t\td=atof(sstrsep(&p,sep));\n\t\t\t\tif(n)\n\t\t\t\t\tecdh_results[k][0]=1/(1/ecdh_results[k][0]+1/d);\n\t\t\t\telse\n\t\t\t\t\tecdh_results[k][0]=d;\n\t\t\t\t}\n#endif\n\t\t\telse if(!strncmp(buf,"+H:",3))\n\t\t\t\t{\n\t\t\t\t}\n\t\t\telse\n\t\t\t\tfprintf(stderr,"Unknown type \'%s\' from child %d\\n",buf,n);\n\t\t\t}\n\t\tfclose(f);\n\t\t}\n\tfree(fds);\n\treturn 1;\n\t}']