| 30 | */ |
| 31 | |
| 32 | void |
| 33 | cgiCopyTemplateFile(FILE *out, /* I - Output file */ |
| 34 | const char *tmpl) /* I - Template file to read */ |
| 35 | { |
| 36 | FILE *in; /* Input file */ |
| 37 | |
| 38 | fprintf(stderr, "DEBUG2: cgiCopyTemplateFile(out=%p, tmpl=\"%s\")\n", out, |
| 39 | tmpl ? tmpl : "(null)"); |
| 40 | |
| 41 | /* |
| 42 | * Range check input... |
| 43 | */ |
| 44 | |
| 45 | if (!tmpl || !out) |
| 46 | return; |
| 47 | |
| 48 | /* |
| 49 | * Open the template file... |
| 50 | */ |
| 51 | |
| 52 | if ((in = fopen(tmpl, "r")) == NULL) |
| 53 | { |
| 54 | fprintf(stderr, "ERROR: Unable to open template file \"%s\" - %s\n", |
| 55 | tmpl, strerror(errno)); |
| 56 | return; |
| 57 | } |
| 58 | |
| 59 | /* |
| 60 | * Parse the file to the end... |
| 61 | */ |
| 62 | |
| 63 | cgi_copy(out, in, 0, 0, 0); |
| 64 | |
| 65 | /* |
| 66 | * Close the template file and return... |
| 67 | */ |
| 68 | |
| 69 | fclose(in); |
| 70 | } |
| 71 | |
| 72 | |
| 73 | /* |