コード例 #1
0
Radar *RSL_uf_to_radar(char *infile)
{
/*
 * This routine ingests a UF file and fills the Radar structure.
 * This routine allocates space via the system routine malloc.
 *
 * If *infile is NULL, read from stdin.
 */
  FILE *fp;
  Radar *radar;
  
  radar = NULL;
  if (infile == NULL) {
	int save_fd;
	save_fd = dup(0);
	fp = fdopen(save_fd, "r");
  }  else if ((fp = fopen(infile, "r")) == NULL) {
	perror(infile);
	return radar;
  }
  fp = uncompress_pipe(fp); /* Transparently gunzip. */
  radar = RSL_uf_to_radar_fp(fp);
  rsl_pclose(fp);
	
  return radar;
}
コード例 #2
0
ファイル: wsr88d.c プロジェクト: jbuonagurio/lrose-core
int wsr88d_close(Wsr88d_file *wf)
{
  int rc;
  rc = rsl_pclose(wf->fptr);
  free(wf);
  return rc;
}
コード例 #3
0
Radar *RSL_rapic_to_radar(char *infile)
{
  /* Attach infile to stdin and call the parser. */

  FILE *fp;
  Radar *radar;
  int save_fd;
  
  radar = NULL;
  if (infile == NULL) {
	save_fd = dup(0);
	fp = fdopen(save_fd, "r");
  }  else {
	if ((fp = fopen(infile, "r")) == NULL) {
	  perror(infile);
	  return radar;
	}
  }
  fp = uncompress_pipe(fp); /* Transparently gunzip. */
  close(0); dup(fileno(fp)); /* Redirect stdin. */

  rapicparse();
  radar = rapic_radar;

  rsl_pclose(fp);
	
  return radar;
}
コード例 #4
0
void RSL_radar_to_uf_gzip(Radar *r, char *outfile)
{
  FILE *fp;
  if (r == NULL) {
    fprintf(stderr, "radar_to_uf_gzip: radar pointer NULL\n");
    return;
  }

  if ((fp = fopen(outfile, "w")) == NULL) {
    perror(outfile);
    return;
  }

  fp = compress_pipe(fp);
  RSL_radar_to_uf_fp(r, fp);
  rsl_pclose(fp);
}