tools/tparser.c
static void process_file(struct argtable_s *table)
{
    FILE *output, *input;
    input = fopen(table->source, "r");

    if (input == NULL)
        error_msg("Failed to open input file.");

    output = fopen(table->destin, "w");

    if (output == NULL) {
        fclose(input);
        error_msg("Failed to open output file for writing.");
    }

    char input_line[MAX_LENGTH];
    while (1) {
        if (fgets(input_line, MAX_LENGTH, input) == NULL) break;
        replace_tags(table, input_line, output);
    }

    fclose(input);
    fclose(output);
}
// Process the provided templated source file
Process the provided templated source file
Process the provided templated source file
static void process_file(struct argtable_s *table)
{
    FILE *output, *input;
    input = fopen(table->source, "r");
    if (input == NULL)
        error_msg("Failed to open input file.");
    output = fopen(table->destin, "w");
    if (output == NULL) {
        fclose(input);
        error_msg("Failed to open output file for writing.");
    }
    char input_line[MAX_LENGTH];
    while (1) {
        if (fgets(input_line, MAX_LENGTH, input) == NULL) break;
        replace_tags(table, input_line, output);
    }
    fclose(input);
    fclose(output);
}
static void process_file ( struct argtable_s * table ) { FILE * output , * input ; input = fopen ( table -> source , " " ) ; if ( input == NULL ) error_msg ( " " ) ; output = fopen ( table -> destin , " " ) ; if ( output == NULL ) { fclose ( input ) ; error_msg ( " " ) ; } char input_line [ MAX_LENGTH ] ; while ( 1 ) { if ( fgets ( input_line , MAX_LENGTH , input ) == NULL ) break ; replace_tags ( table , input_line , output ) ; } fclose ( input ) ; fclose ( output ) ; }
Process the provided templated source file
Process the provided templated source file