32 |
return(pointer); |
return(pointer); |
33 |
} |
} |
34 |
|
|
|
/* Make sure that you free the returned string. */ |
|
|
char* |
|
|
antiright_pipe_read(char *command_string) |
|
|
{ |
|
|
char *text_string; |
|
|
char buffer[BUFSIZ]; |
|
|
FILE *pipe_fp=popen(command_string, "r"); |
|
|
fgets(buffer, BUFSIZ, pipe_fp); |
|
|
asprintf(&text_string, "%s", buffer); |
|
|
while(fgets(buffer, BUFSIZ, pipe_fp)) |
|
|
asprintf(&text_string, "%s%s", text_string, buffer); |
|
|
pclose(pipe_fp); |
|
|
return(text_string); |
|
|
} |
|
|
void |
|
|
antiright_pipe_write(char *command_string, char* data) |
|
|
{ |
|
|
FILE *pipe_fp=popen(command_string, "w"); |
|
|
fprintf(pipe_fp, data); |
|
|
pclose(pipe_fp); |
|
|
} |
|
|
void |
|
|
antiright_fifo_server(char *command_string, char *fifo) |
|
|
{ |
|
|
FILE *fifo_fp; |
|
|
FILE *pipe_fp=popen(command_string, "w"); |
|
|
char buffer[80]; |
|
|
while(1) |
|
|
{ |
|
|
fifo_fp=fopen(fifo, "r"); |
|
|
fgets(buffer, 80, fifo_fp); |
|
|
fprintf(pipe_fp, buffer); |
|
|
fclose(fifo_fp); |
|
|
} |
|
|
} |
|
|
|
|
35 |
char * |
char * |
36 |
antiright_get_file_extension(char *filename) |
antiright_get_file_extension(char *filename) |
37 |
{ |
{ |