1 #include <fcntl.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <unistd.h>
5 #include <string.h>
6 
7 #include "execute.h"
8 
9 /* globals */
10 FILE* yyin;
11 char* yyfn;
12 int n_labels;
13 Label **route_labels;    /* parent */
14 Label **host_labels;     /* child */
15 Options current_options;
16 
main(int argc,char * argv[])17 int main(int argc, char *argv[])
18 {
19 	int error_code;
20 	int fd;
21 	int output_size;
22 	char *output;
23 
24 	if (argc < 2) {
25 		fprintf(stderr, "usage: ./cmd_pipe_stdout cmd [args ...]\n");
26 		return 1;
27 	}
28 
29 	output = cmd_pipe_stdout(argv+1, &error_code, &output_size);
30 	write(1, output, output_size);
31 	fprintf(stderr, "output_size: %d\n", output_size);
32 	fprintf(stderr, "strlen: %lu\n", strlen(output));
33 	free(output);
34 
35 	return error_code;
36 }
37