From 81d61e84216ff3494440efa56ed98c6dcde7304a Mon Sep 17 00:00:00 2001 From: Our Air Quality Date: Tue, 6 Feb 2024 07:24:35 +1100 Subject: [PATCH] setstr(): export This is a useful function for parsing the formatted files, so move this from rinex.c into rktcmd.c and export it. --- src/rinex.c | 9 --------- src/rtkcmn.c | 9 +++++++++ src/rtklib.h | 1 + 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/rinex.c b/src/rinex.c index a046a98be..2329b8324 100644 --- a/src/rinex.c +++ b/src/rinex.c @@ -157,15 +157,6 @@ typedef struct { /* signal index type */ double shift[MAXOBSTYPE]; /* phase shift (cycle) */ } sigind_t; -/* set string without tail space ---------------------------------------------*/ -static void setstr(char *dst, const char *src, int n) -{ - char *p=dst; - const char *q=src; - while (*q&&q=dst&&*p==' ') *p--='\0'; -} /* adjust time considering week handover -------------------------------------*/ static gtime_t adjweek(gtime_t t, gtime_t t0) { diff --git a/src/rtkcmn.c b/src/rtkcmn.c index 5ff96f154..fe6aa5beb 100644 --- a/src/rtkcmn.c +++ b/src/rtkcmn.c @@ -1550,6 +1550,15 @@ extern void matprint(const double A[], int n, int m, int p, int q) { matfprint(A,n,m,p,q,stdout); } +/* set string without tail space ---------------------------------------------*/ +extern void setstr(char *dst, const char *src, int n) +{ + char *p=dst; + const char *q=src; + while (*q&&q=dst&&*p==' ') *p--='\0'; +} /* string to number ------------------------------------------------------------ * convert substring in string to number * args : char *s I string ("... nnn.nnn ...") diff --git a/src/rtklib.h b/src/rtklib.h index bf466712e..8681cf56e 100644 --- a/src/rtklib.h +++ b/src/rtklib.h @@ -1416,6 +1416,7 @@ EXPORT void matfprint(const double *A, int n, int m, int p, int q, FILE *fp); EXPORT void add_fatal(fatalfunc_t *func); /* time and string functions -------------------------------------------------*/ +EXPORT void setstr(char *dst, const char *src, int n); EXPORT double str2num(const char *s, int i, int n); EXPORT int str2time(const char *s, int i, int n, gtime_t *t); EXPORT void time2str(gtime_t t, char *str, int n);