#ifndef __EDB_C #define __EDB_C #include "elastro.h" #include "strutil.c" /* set what is valid. this means sets objname, type is valid. if koordinates also available sets rastr, and decstr. if rastr/decstr is also valid it returns 1, otherwise 0. */ int setEDBobjFromStr(struct EDBOBJ *obj, char *instr ) { int len,l; char *p,*rap,*decp,*objp,*typep; objp = NULL; typep = NULL; rap = NULL; decp = NULL; strcpy( obj->objname,"none"); strcpy( obj->objtype,"none"); obj->rastr[0] = 0; obj->decstr[0] = 0; len = strlen(instr); if( ( len < 1 ) || ( len > 120 ) ) { return(1); } if(instr[0] < 0x20){ return(1); } p = strchr(instr,0x0a); if( p != NULL ) { p[0] = 0; } p = strchr(instr,0x0d); if( p != NULL ) { p[0] = 0; } objp = &instr[0]; typep = strchr(objp,','); if(typep == NULL){ return(0); } typep[0] = 0; len = strlen( objp ); if( ( len > 0 ) && (len < 40) ){ strcpy( obj->objname, objp ); } typep++; len = strlen(typep); strCleanStr( typep, len ); strEatBytes(0x20 , typep ,len, 1); len = strlen( typep ); if( len > 0 ){ rap = strchr(typep,','); if(rap != NULL){ rap[0] = 0;rap++; decp = strchr(rap,','); if(decp != NULL){ decp[0] = 0;decp++; p = strchr(decp,','); if(p != NULL){ p[0] = 0; } } } l = strlen(typep); if( (l > 0 ) && ( l < 40) ){ strcpy(obj->objtype,typep); } if( ( rap != NULL ) && ( decp != NULL ) ) { if( (strlen(rap) > 0 ) && ( strlen(decp) > 0 ) ) { strcpy(obj->rastr, rap); strcpy(obj->decstr,decp); return(1); } } } return(0); } #endif