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 Dec 6, 2024
1 parent 2d59920 commit 81d61e8
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 @@ -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);
Expand Down

0 comments on commit 81d61e8

Please sign in to comment.