Skip to content

Commit

Permalink
Fix COSPAR designation reading
Browse files Browse the repository at this point in the history
Signed-off-by: Cees Bassa <[email protected]>
  • Loading branch information
cbassa committed Dec 28, 2024
1 parent 821d821 commit f7f27a9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 6 additions & 4 deletions rffit.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ int main(int argc,char *argv[])
d.satname = tle->name;
}
}

printf(">> |%s|\n",orb.desig);
if (freopen("/tmp/stderr.txt","w",stderr)==NULL)
fprintf(stderr,"Failed to redirect stderr\n");

Expand Down Expand Up @@ -739,9 +739,9 @@ int main(int argc,char *argv[])

// Change
if (c=='c') {
printf("( 1) Inclination, ( 2) Ascending Node, ( 3) Eccentricity,\n( 4) Arg. of Perigee, ( 5) Mean Anomaly, ( 6) Mean Motion,\n( 7) B* drag, ( 8) Epoch, ( 9) Satellite ID\n(10) Satellite name (11) Frequency (MHz)\n\nWhich parameter to change: ");
printf("( 1) Inclination, ( 2) Ascending Node, ( 3) Eccentricity,\n( 4) Arg. of Perigee, ( 5) Mean Anomaly, ( 6) Mean Motion,\n( 7) B* drag, ( 8) Epoch, ( 9) Satellite ID\n(10) Satellite name (11) Satellite COSPAR (12) Frequency (MHz)\n\nWhich parameter to change: ");
status=scanf("%i",&i);
if (i>=0 && i<=11) {
if (i>=0 && i<=12) {
printf("\nNew value: ");
if (fgets(string,64,stdin)==NULL)
fprintf(stderr,"Failed to read string\n");
Expand All @@ -758,7 +758,9 @@ int main(int argc,char *argv[])
if (i==9) orb.satno=atoi(string);
if (i==10)
d.satname=string;
if (i==11) {
if (i==11)
strcpy(orb.desig,string);
if (i==12) {
d.ffit=atof(string) * 1000;
d.fitfreq=0;
}
Expand Down
3 changes: 2 additions & 1 deletion satutl.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,8 @@ int read_twoline(FILE *fp, long search_satno, orbit_t *orb, char *satname)

orb->satno = search_satno;

sscanf(st1+9,"%s",orb->desig);
strncpy(orb->desig,st1+9,8);
orb->desig[8]='\0';

if (satname != NULL) {
strncpy(satname, tmp_satname, ST_SIZE);
Expand Down

0 comments on commit f7f27a9

Please sign in to comment.