Skip to content

Commit

Permalink
setstr(): export
Browse files Browse the repository at this point in the history
This is a useful function for parsing the formatted files, so
move this from rinex.c into rktcmd.c and export it.
  • Loading branch information
ourairquality committed Nov 20, 2024
1 parent aa79681 commit 4c4dd25
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
9 changes: 0 additions & 9 deletions src/rinex.c
Original file line number Diff line number Diff line change
Expand Up @@ -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<src+n) *p++=*q++;
*p--='\0';
while (p>=dst&&*p==' ') *p--='\0';
}
/* adjust time considering week handover -------------------------------------*/
static gtime_t adjweek(gtime_t t, gtime_t t0)
{
Expand Down
9 changes: 9 additions & 0 deletions src/rtkcmn.c
Original file line number Diff line number Diff line change
Expand Up @@ -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<src+n) *p++=*q++;
*p--='\0';
while (p>=dst&&*p==' ') *p--='\0';
}
/* string to number ------------------------------------------------------------
* convert substring in string to number
* args : char *s I string ("... nnn.nnn ...")
Expand Down
1 change: 1 addition & 0 deletions src/rtklib.h
Original file line number Diff line number Diff line change
Expand Up @@ -1415,6 +1415,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);
Expand Down

0 comments on commit 4c4dd25

Please sign in to comment.