awips2/ncep/gov.noaa.nws.ncep.viz.rsc.ncgrid/dgdriv_c/ctbdttmpl.c
Steve Harris 7f90924706 12.4.1-10 baseline
Former-commit-id: 7fa9dbd5fb [formerly 4bfbdad17d] [formerly 9f8cb727a5] [formerly 7fa9dbd5fb [formerly 4bfbdad17d] [formerly 9f8cb727a5] [formerly 8485b90ff8 [formerly 9f8cb727a5 [formerly bf53d06834caa780226121334ac1bcf0534c3f16]]]]
Former-commit-id: 8485b90ff8
Former-commit-id: 40aa780b3d [formerly 33a67cdd82] [formerly 73930fb29d0c1e91204e76e6ebfdbe757414f319 [formerly a28d70b5c5]]
Former-commit-id: a16a1b4dd44fc344ee709abbe262aeed58a8339b [formerly e5543a0e86]
Former-commit-id: 0c25458510
2012-05-01 18:06:13 -05:00

83 lines
2.2 KiB
C

#include "geminc.h"
#include "gemprm.h"
#include "ctbcmn.h"
extern Data_t DtTable;
extern int DtReadin;
void ctb_dttmpl ( char *alias_i, char *template, int *iret )
/************************************************************************
* ctb_dttmpl *
* *
* This function returns the template associated with a data alias. *
* *
* ctb_dttmpl ( alias_i, template, iret ) *
* *
* Input parameters: *
* *alias_i char Alias name *
* *
* Output parameters: *
* *template char Alias template *
* *iret int Return code *
* -1 - alias not found *
** *
* Log: *
* D.W.Plummer/NCEP 3/98 Created *
* I. Durham/GSC 5/98 Changed underscore decl. to an include *
* S. Jacobs/NCEP 3/01 Added parsing of storm name from alias *
* R. Tian/SAIC 11/04 Added processing of possible storm name *
* m.gamazaychikov/SAIC 01/06 Changed templ string length to MXTMPL *
***********************************************************************/
{
int i, ipos, ier;
char alias[49], name[49], templ[MXTMPL];
/*---------------------------------------------------------------------*/
*iret = G_NORMAL;
if ( DtReadin == G_FALSE ) {
ctb_dtrd ( iret );
}
cst_lcuc( alias_i, alias, &ier );
/*
* Remove the name of the storm/volcano from the alias.
*/
cst_nocc ( alias, ':', 1, 0, &ipos, &ier );
if ( ier == 0 ) {
strcpy ( name, &alias[ipos+1] );
alias[ipos] = CHNULL;
}
/*
* Find a match for the alias.
*/
for ( i = 0; i < DtTable.numtmpl; i++ ) {
if ( strcmp( DtTable.info[i].alias, alias ) == 0 ) {
/*
* If the user has input a storm/volcano name, then
* replace the "*" in the template with the name.
* The name should be in all lower case, since the
* user cannot be expected to input the correct case.
*/
if ( ier == 0 ) {
cst_uclc ( name, name, &ier );
strcpy( templ, DtTable.info[i].template );
cst_rpst ( templ, "*", name, template, &ier );
} else {
strcpy( template, DtTable.info[i].template );
}
return;
}
}
*iret = -1;
return;
}