📄 output_resp.c
字号:
if (fprintf(outfile,"%s%s%2.2d End date: ", blkt_id2,fld_pref,23) == -1) { fprintf (stderr, "\tWARNING (output_resp): "); fprintf (stderr, "Output file %s is not available for writing.\n", outfile_name); perror("output_resp()"); fprintf (stderr, "\tExecution continuing.\n"); fclose(outfile); return; } if (current_channel->end == NULL) { if (fprintf(outfile,"No Ending Time\n") == -1) { fprintf(stderr, "\tWARNING (output_resp): "); fprintf(stderr, "Output file %s is not available for writing.\n", outfile_name); perror("output_resp()"); fprintf(stderr, "\tExecution continuing.\n"); fclose(outfile); return; } } else if (*(current_channel->end) == '\0') { if (fprintf(outfile,"No Ending Time\n") == -1) { fprintf(stderr, "\tWARNING (output_resp): "); fprintf(stderr, "Output file %s is not available for writing.\n", outfile_name); perror("output_resp()"); fprintf(stderr, "\tExecution continuing.\n"); fclose(outfile); return; } } else if (fprintf(outfile,"%s\n", current_channel->end) == -1) { fprintf (stderr, "\tWARNING (output_resp): "); fprintf (stderr, "Output file %s is not available for writing.\n", outfile_name); perror("output_resp()"); fprintf (stderr, "\tExecution continuing.\n"); fclose(outfile); return; } if (fprintf(outfile,"%s=======================================\n", com_strt) == -1) { fprintf (stderr, "\tWARNING (output_resp): "); fprintf (stderr, "Output file %s is not available for writing.\n", outfile_name); perror("output_resp()"); fprintf (stderr, "\tExecution continuing.\n"); fclose(outfile); return; } /* write out responses */ for (response = current_channel->response_head; response != NULL; response = response->next) { if (response->type == 'P') print_type53 (outfile,response->ptr.type53); else if (response->type == 'C') print_type54 (outfile,response->ptr.type54); else if (response->type == 'L') print_type55 (outfile,response->ptr.type55); else if (response->type == 'G') print_type56 (outfile,response->ptr.type56); else if (response->type == 'D') print_type57 (outfile,response->ptr.type57); else if (response->type == 'S') print_type58 (outfile,response->ptr.type58); else if (response->type == 'R') print_type60 (outfile,response->ptr.type60); else if (response->type == 'F') print_type61 (outfile,response->ptr.type61); else if (response->type == 'O') print_type62 (outfile,response->ptr.type62); else { fprintf (stderr, "WARNING [print_response]: "); fprintf (stderr, "unknown response type %c encountered.\n", response->type); fprintf (stderr, "\tExecution continuing.\n"); } }/* +=======================================+ *//*=================| close the output file |=================*//* +=======================================+ */ fclose (outfile);}void output_old_resp (){ char buffer[30]; /* output file name */ int i; /* counter *//* +=======================================+ *//*=================| Find selected station channels |=================*//* +=======================================+ */ /* Print a warning that this RESP file format will no longer be * available after Sept 1, 1996 */ fprintf (stderr, "\n\t\tWARNING! THIS RESP FILE FORMAT WILL NO LONGER BE SUPPORTED\n"); fprintf (stderr, "\t\tAFTER 1 SEPT, 1996. IT WILL BE REPLACED BY RESP FILES\n"); fprintf (stderr, "\t\tWHICH FOLLOW THE FORMAT USED BY EVALRESP V3.0. THE CHANGES\n"); fprintf (stderr, "\t\tMADE TO THIS FORMAT MAY EFFECT SOME PARSING ROUTINES THAT\n"); fprintf (stderr, "\t\tUSE THESE FILES. PLEASE REFER TO THE ACCOMPANYING DESCRIPTION\n"); fprintf (stderr, "\t\tIN THE FILE 'RESP_FILE.CHANGES' IN THE RDSEEDv%s DIRECTORY\n\n", VERSION); for (current_station = type50_head; current_station != NULL; current_station = current_station->next) { if (chk_station(current_station->station)) { if ((type10.version >= 2.3) && !chk_network(current_station->network_code)) continue; for (current_channel=current_station->type52_head; current_channel!=NULL; current_channel=current_channel->next) { if (chk_channel(current_channel->channel)) { print_old_resp (); } } } }} /*===========================================================================*/print_old_resp (){ FILE *outfile; /* output file pointer */ char outfile_name[100]; /* output file name */ int i; /* counter */ struct response *response; /* looping vbl */ char *blkt_id1="B050",*blkt_id2="B052"; /* blockette id strings *//* +=======================================+ *//*=================| build name for and open output file |=================*//* +=======================================+ */ sprintf (outfile_name, "RESP.%s.%s.%s", current_station->network_code ? current_station->network_code: "", current_station->station, current_channel->channel); if ((outfile = fopen (outfile_name, "a")) == NULL) { fprintf (stderr, "\tWARNING (output_data): "); fprintf (stderr, "Output file %s is not available for writing.\n", outfile_name); fprintf (stderr, "\tExecution continuing.\n"); return; } fprintf(outfile, "<< IRIS SEED Reader, Release %s >>\n\n", VERSION); fprintf(outfile,"======== CHANNEL RESPONSE DATA ========\n"); fprintf(outfile,"Station: %s\n", current_station->station); fprintf(outfile,"Channel: %s\n", current_channel->channel); fprintf(outfile,"Start date: %s\n", current_channel->start); fprintf(outfile,"End date: "); if (current_channel->end == NULL) fprintf(outfile,"No Ending Time\n"); else if (*(current_channel->end) == '\0') fprintf(outfile,"No Ending Time\n"); else fprintf(outfile,"%s\n", current_channel->end); fprintf(outfile,"=======================================\n"); /* write out responses */ for (response = current_channel->response_head; response != NULL; response = response->next) { if (response->type == 'P') old_print_type53 (outfile,response->ptr.type53); else if (response->type == 'C') old_print_type54 (outfile,response->ptr.type54); else if (response->type == 'L') old_print_type55 (outfile,response->ptr.type55); else if (response->type == 'G') old_print_type56 (outfile,response->ptr.type56); else if (response->type == 'D') old_print_type57 (outfile,response->ptr.type57); else if (response->type == 'S') old_print_type58 (outfile,response->ptr.type58); else if (response->type == 'R') old_print_type60 (outfile,response->ptr.type60); else if (response->type == 'F') old_print_type61 (outfile,response->ptr.type61); else if (response->type == 'O') old_print_type62 (outfile,response->ptr.type62); else { fprintf (stderr, "WARNING [print_response]: "); fprintf (stderr, "unknown response type %c encountered.\n", response->type); fprintf (stderr, "\tExecution continuing.\n"); } } fclose(outfile);/* +=======================================+ *//*=================| close the output file |=================*//* +=======================================+ */ fclose (outfile);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -