[Gpredict-svn] SF.net SVN: gpredict:[441] trunk
Real time satellite tracking and orbit prediction
Status: Beta
Brought to you by:
csete
|
From: <cs...@us...> - 2009-09-27 13:45:44
|
Revision: 441
http://gpredict.svn.sourceforge.net/gpredict/?rev=441&view=rev
Author: csete
Date: 2009-09-27 13:45:38 +0000 (Sun, 27 Sep 2009)
Log Message:
-----------
Synchronise satellite categories during TLE update.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/tle-update.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-09-27 01:10:59 UTC (rev 440)
+++ trunk/ChangeLog 2009-09-27 13:45:38 UTC (rev 441)
@@ -1,3 +1,9 @@
+2009-09-27 Alexandru Csete <oz9aec at gmail.com>
+
+ * src/tle-update.c:
+ Synchronise satellite categories during TLE update.
+
+
2009-09-25 Alexandru Csete <oz9aec at gmail.com>
* src/gtk-sat-module-tmg.c:
Modified: trunk/src/tle-update.c
===================================================================
--- trunk/src/tle-update.c 2009-09-27 01:10:59 UTC (rev 440)
+++ trunk/src/tle-update.c 2009-09-27 13:45:38 UTC (rev 441)
@@ -709,13 +709,39 @@
guint catnr,i;
guint *key = NULL;
+ /* category sync related */
+ gchar *catname, *catpath, *buff, **buffv;
+ FILE *catfile;
+ gchar category[80];
+
+
path = g_strconcat (dir, G_DIR_SEPARATOR_S, fnam, NULL);
fp = g_fopen (path, "r");
if (fp != NULL) {
+ /* Prepare .cat file for sync while we read data */
+ buffv = g_strsplit (fnam, ".", 0);
+ catname = g_strconcat (buffv[0], ".cat", NULL);
+ g_strfreev (buffv);
+ catpath = sat_file_name (catname);
+ g_free (catname);
+
+ /* read category name for catfile */
+ catfile = g_fopen (catpath, "r");
+ b = fgets (category, 80, catfile);
+ fclose (catfile);
+
+ /* reopen a new catfile and write category name */
+ catfile = g_fopen (catpath, "w");
+ g_free (catpath);
+ fputs (category, catfile);
+
+ /* .cat file now contains the category name;
+ satellite catnums will be added during update in the while loop */
+
/* read 3 lines at a time */
while (fgets (tle_str[0], 80, fp)) {
/* read second and third lines */
@@ -746,6 +772,11 @@
/* __FUNCTION__, */
/* catnr); */
+ /* store catalog number in catfile */
+ buff = g_strdup_printf ("%d\n", catnr);
+ fputs (buff, catfile);
+ g_free (buff);
+
/* add data to hash table */
key = g_try_new0 (guint, 1);
*key = catnr;
@@ -774,6 +805,9 @@
}
+ /* close category file */
+ fclose (catfile);
+
/* close input TLE file */
fclose (fp);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|