Blob Blame History Raw
Marek Mahut <mmahut@fedoraproject.org>: this patch add more interactive support

diff -Naur ./accrete-1.0-original/display.c ./accrete-1.0/display.c
--- ./accrete-1.0-original/display.c	2007-11-24 22:37:57.000000000 +0100
+++ ./accrete-1.0/display.c	2007-11-25 15:03:44.000000000 +0100
@@ -1,13 +1,13 @@
 #include "structs.h"
 
 void 
-display_system (void)
+display_system (char *filename)
 {
      planet_pointer node1; 
      int counter; 
 
      FILE *f;
-     f = fopen("New.System", "w");
+     f = fopen(filename, "w");
 
      fprintf(f,"                         SYSTEM  CHARACTERISTICS\n");
      fprintf(f,"Mass of central star:          %6.3f solar masses\n", stellar_mass_ratio);
@@ -105,5 +105,6 @@
 	  counter++;
 	  node1 = node1->next_planet;
      }
+	printf("\nResult saved in %s.\n", filename);
         fclose(f);
 }
diff -Naur ./accrete-1.0-original/main.c ./accrete-1.0/main.c
--- ./accrete-1.0-original/main.c	2007-11-24 22:37:57.000000000 +0100
+++ ./accrete-1.0/main.c	2007-11-25 15:05:30.000000000 +0100
@@ -22,6 +22,7 @@
   init_genrand(time(NULL));
 }
 
+
 void 
 generate_stellar_system (void)
 {
@@ -87,10 +88,17 @@
 
 
 int 
-main (void)
+main (int argc, char **argv)
 {
+
+  if (argc != 2) {
+	printf("Usage: %s FILE\n", argv[0]);
+	printf("Save the result of simulation of solar system planet formation in FILE.\n");
+       exit(0);
+   }
+
   init();
   generate_stellar_system();
-  display_system();
+  display_system(argv[1]);
   return 0;
 }
diff -Naur ./accrete-1.0-original/proto.h ./accrete-1.0/proto.h
--- ./accrete-1.0-original/proto.h	2007-11-24 22:37:57.000000000 +0100
+++ ./accrete-1.0/proto.h	2007-11-25 14:57:16.000000000 +0100
@@ -17,7 +17,7 @@
 void coalesce_planetesimals(double a, double e, double mass, double crit_mass, double stellar_luminosity_ratio, double body_inner_bound, double body_outer_bound);
 planet_pointer distribute_planetary_masses(double stellar_mass_ratio, double stellar_luminosity_ratio, double inner_dust, double outer_dust);
 /* display.c */
-void display_system(void);
+void display_system(char *filename);
 /* enviro.c */
 double luminosity(double mass_ratio);
 int orbital_zone(double orbital_radius);
@@ -48,7 +48,7 @@
 /* main.c */
 void init(void);
 void generate_stellar_system(void);
-int main(void);
+int main(int argc, char *argv[]);
 /* mtrng.c */
 void init_genrand(unsigned long s);
 void init_by_array(unsigned long init_key[], unsigned long key_length);