diff --git a/Common/CommandLine.cpp b/Common/CommandLine.cpp
index 081c3378e4325ff60c28b82192cbfd6d82ee5e57..9d4f5e845db5f1a8841c8d4bb455eeaeb29bbf95 100644
--- a/Common/CommandLine.cpp
+++ b/Common/CommandLine.cpp
@@ -168,8 +168,8 @@ void Get_Options(int argc, char *argv[])
 
 #if !defined(HAVE_NO_PARSER)
   // Parse session and option files
-  ParseFile((CTX::instance()->homeDir + CTX::instance()->sessionFileName).c_str(), true);
-  ParseFile((CTX::instance()->homeDir + CTX::instance()->optionsFileName).c_str(), true);
+  ParseFile(CTX::instance()->homeDir + CTX::instance()->sessionFileName, true);
+  ParseFile(CTX::instance()->homeDir + CTX::instance()->optionsFileName, true);
 #endif
 
   // Get command line options
diff --git a/Common/CreateFile.cpp b/Common/CreateFile.cpp
index 221715b8bc4542163ca2069dc4d4c052bb325caf..249f60ab685919f77f0c935cdc736671d85787d2 100644
--- a/Common/CreateFile.cpp
+++ b/Common/CreateFile.cpp
@@ -221,8 +221,8 @@ void CreateOutputFile(std::string fileName, int format)
   case FORMAT_JPEG:
   case FORMAT_PNG:
     {
-      FILE *fp;
-      if(!(fp = fopen(fileName.c_str(), "wb"))) {
+      FILE *fp = fopen(fileName.c_str(), "wb");
+      if(!fp){
         Msg::Error("Unable to open file '%s'", fileName.c_str());
         break;
       }
@@ -267,8 +267,8 @@ void CreateOutputFile(std::string fileName, int format)
   case FORMAT_PDF:
   case FORMAT_SVG:
     {
-      FILE *fp;
-      if(!(fp = fopen(fileName.c_str(), "wb"))) {
+      FILE *fp = fopen(fileName.c_str(), "wb");
+      if(!fp){
         Msg::Error("Unable to open file '%s'", fileName.c_str());
         break;
       }
@@ -346,8 +346,8 @@ void CreateOutputFile(std::string fileName, int format)
 
   case FORMAT_TEX:
     {
-      FILE *fp;
-      if(!(fp = fopen(fileName.c_str(), "w"))) {
+      FILE *fp = fopen(fileName.c_str(), "w");
+      if(!fp){
         Msg::Error("Unable to open file '%s'", fileName.c_str());
         break;
       }
diff --git a/Common/OpenFile.cpp b/Common/OpenFile.cpp
index 64cf58a92e2259abefa0c5e9bad78c8489028c58..c9a7c4b5e3b3a1ec9c7a8c224235f7f9265afe08 100644
--- a/Common/OpenFile.cpp
+++ b/Common/OpenFile.cpp
@@ -198,13 +198,12 @@ int ParseFile(std::string fileName, bool close, bool warnIfMissing)
 void ParseString(std::string str)
 {
   if(str.empty()) return;
-  FILE *fp;
-  if((fp = fopen((CTX::instance()->homeDir + 
-                  CTX::instance()->tmpFileName).c_str(), "w"))) {
-    fprintf(fp, str.c_str());
-    fprintf(fp, "\n");
+  std::string fileName = CTX::instance()->homeDir + CTX::instance()->tmpFileName;
+  FILE *fp = fopen(fileName.c_str(), "w");
+  if(fp){
+    fprintf(fp, (str + "\n").c_str());
     fclose(fp);
-    ParseFile((CTX::instance()->homeDir + CTX::instance()->tmpFileName).c_str(), true);
+    ParseFile(fileName, true);
     GModel::current()->importGEOInternals();
   }
 }
diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp
index 0d3d7051341f3230b499b9392bd777305964d708..cd6b76dabf80018563c1a78b1668f39c56d7c51c 100644
--- a/Fltk/GUI.cpp
+++ b/Fltk/GUI.cpp
@@ -307,41 +307,41 @@ int GUI::testGlobalShortcuts(int event)
     status = 1;
   }
   else if(Fl::test_shortcut(FL_ALT + 'f')) {
-    opt_general_fast_redraw(0, GMSH_SET | GMSH_GUI,
-                            !opt_general_fast_redraw(0, GMSH_GET, 0));
+    opt_general_fast_redraw
+      (0, GMSH_SET | GMSH_GUI, !opt_general_fast_redraw(0, GMSH_GET, 0));
     status = 2;
   }
   else if(Fl::test_shortcut(FL_ALT + 'b')) {
-    opt_general_draw_bounding_box(0, GMSH_SET | GMSH_GUI,
-                                  !opt_general_draw_bounding_box(0, GMSH_GET, 0));
+    opt_general_draw_bounding_box
+      (0, GMSH_SET | GMSH_GUI, !opt_general_draw_bounding_box(0, GMSH_GET, 0));
     status = 2;
   }
   else if(Fl::test_shortcut(FL_ALT + 'i')) {
     for(unsigned int i = 0; i < PView::list.size(); i++)
       if(opt_view_visible(i, GMSH_GET, 0))
-        opt_view_show_scale(i, GMSH_SET | GMSH_GUI,
-                            !opt_view_show_scale(i, GMSH_GET, 0));
+        opt_view_show_scale
+          (i, GMSH_SET | GMSH_GUI, !opt_view_show_scale(i, GMSH_GET, 0));
     status = 2;
   }
   else if(Fl::test_shortcut(FL_ALT + 'c')) {
-    opt_general_color_scheme(0, GMSH_SET | GMSH_GUI,
-                             opt_general_color_scheme(0, GMSH_GET, 0) + 1);
+    opt_general_color_scheme
+      (0, GMSH_SET | GMSH_GUI, opt_general_color_scheme(0, GMSH_GET, 0) + 1);
     status = 2;
   }
   else if(Fl::test_shortcut(FL_ALT + 'w')) {
-    opt_geometry_light(0, GMSH_SET | GMSH_GUI,
-                       !opt_geometry_light(0, GMSH_GET, 0));
-    opt_mesh_light(0, GMSH_SET | GMSH_GUI,
-                   !opt_mesh_light(0, GMSH_GET, 0));
+    opt_geometry_light
+      (0, GMSH_SET | GMSH_GUI, !opt_geometry_light(0, GMSH_GET, 0));
+    opt_mesh_light
+      (0, GMSH_SET | GMSH_GUI, !opt_mesh_light(0, GMSH_GET, 0));
     for(unsigned int i = 0; i < PView::list.size(); i++)
       if(opt_view_visible(i, GMSH_GET, 0))
-        opt_view_light(i, GMSH_SET | GMSH_GUI,
-                       !opt_view_light(i, GMSH_GET, 0));
+        opt_view_light
+          (i, GMSH_SET | GMSH_GUI, !opt_view_light(i, GMSH_GET, 0));
     status = 2;
   }
   else if(Fl::test_shortcut(FL_ALT + FL_SHIFT + 'w')) {
-    opt_mesh_reverse_all_normals(0, GMSH_SET | GMSH_GUI,
-                                 !opt_mesh_reverse_all_normals(0, GMSH_GET, 0));
+    opt_mesh_reverse_all_normals
+      (0, GMSH_SET | GMSH_GUI, !opt_mesh_reverse_all_normals(0, GMSH_GET, 0));
     status = 2;
   }
   else if(Fl::test_shortcut(FL_ALT + 'x') || 
@@ -365,36 +365,36 @@ int GUI::testGlobalShortcuts(int event)
     status = 1;
   }
   else if(Fl::test_shortcut(FL_ALT + 'a')) {
-    opt_general_axes(0, GMSH_SET | GMSH_GUI, 
-                     opt_general_axes(0, GMSH_GET, 0) + 1);
+    opt_general_axes
+      (0, GMSH_SET | GMSH_GUI, opt_general_axes(0, GMSH_GET, 0) + 1);
     for(unsigned int i = 0; i < PView::list.size(); i++)
       if(opt_view_visible(i, GMSH_GET, 0))
-        opt_view_axes(i, GMSH_SET | GMSH_GUI, opt_view_axes(i, GMSH_GET, 0)+1);
+        opt_view_axes(i, GMSH_SET | GMSH_GUI, opt_view_axes(i, GMSH_GET, 0) + 1);
     status = 2;
   }
   else if(Fl::test_shortcut(FL_ALT + FL_SHIFT + 'a')) {
-    opt_general_small_axes(0, GMSH_SET | GMSH_GUI,
-                           !opt_general_small_axes(0, GMSH_GET, 0));
+    opt_general_small_axes
+      (0, GMSH_SET | GMSH_GUI, !opt_general_small_axes(0, GMSH_GET, 0));
     status = 2;
   }
   else if(Fl::test_shortcut(FL_ALT + 'p')) {
-    opt_geometry_points(0, GMSH_SET | GMSH_GUI,
-                        !opt_geometry_points(0, GMSH_GET, 0));
+    opt_geometry_points
+      (0, GMSH_SET | GMSH_GUI, !opt_geometry_points(0, GMSH_GET, 0));
     status = 2;
   }
   else if(Fl::test_shortcut(FL_ALT + 'l')) {
-    opt_geometry_lines(0, GMSH_SET | GMSH_GUI,
-                       !opt_geometry_lines(0, GMSH_GET, 0));
+    opt_geometry_lines
+      (0, GMSH_SET | GMSH_GUI, !opt_geometry_lines(0, GMSH_GET, 0));
     status = 2;
   }
   else if(Fl::test_shortcut(FL_ALT + 's')) {
-    opt_geometry_surfaces(0, GMSH_SET | GMSH_GUI,
-                          !opt_geometry_surfaces(0, GMSH_GET, 0));
+    opt_geometry_surfaces
+      (0, GMSH_SET | GMSH_GUI, !opt_geometry_surfaces(0, GMSH_GET, 0));
     status = 2;
   }
   else if(Fl::test_shortcut(FL_ALT + 'v')) {
-    opt_geometry_volumes(0, GMSH_SET | GMSH_GUI,
-                         !opt_geometry_volumes(0, GMSH_GET, 0));
+    opt_geometry_volumes
+      (0, GMSH_SET | GMSH_GUI, !opt_geometry_volumes(0, GMSH_GET, 0));
     status = 2;
   }
   else if(Fl::test_shortcut(FL_ALT + FL_SHIFT + 'p')) {
@@ -402,33 +402,33 @@ int GUI::testGlobalShortcuts(int event)
     status = 2;
   }
   else if(Fl::test_shortcut(FL_ALT + FL_SHIFT + 'l')) {
-    opt_mesh_lines(0, GMSH_SET | GMSH_GUI, 
-                   !opt_mesh_lines(0, GMSH_GET, 0));
+    opt_mesh_lines
+      (0, GMSH_SET | GMSH_GUI, !opt_mesh_lines(0, GMSH_GET, 0));
     status = 2;
   }
   else if(Fl::test_shortcut(FL_ALT + FL_SHIFT + 's')) {
-    opt_mesh_surfaces_edges(0, GMSH_SET | GMSH_GUI,
-                            !opt_mesh_surfaces_edges(0, GMSH_GET, 0));
+    opt_mesh_surfaces_edges
+      (0, GMSH_SET | GMSH_GUI, !opt_mesh_surfaces_edges(0, GMSH_GET, 0));
     status = 2;
   }
   else if(Fl::test_shortcut(FL_ALT + FL_SHIFT + 'v')) {
-    opt_mesh_volumes_edges(0, GMSH_SET | GMSH_GUI,
-                           !opt_mesh_volumes_edges(0, GMSH_GET, 0));
+    opt_mesh_volumes_edges
+      (0, GMSH_SET | GMSH_GUI, !opt_mesh_volumes_edges(0, GMSH_GET, 0));
     status = 2;
   }
   else if(Fl::test_shortcut(FL_ALT + 'd')){
-    opt_geometry_surface_type(0, GMSH_SET | GMSH_GUI,
-                              opt_geometry_surface_type(0, GMSH_GET, 0) + 1);
+    opt_geometry_surface_type
+      (0, GMSH_SET | GMSH_GUI, opt_geometry_surface_type(0, GMSH_GET, 0) + 1);
     status = 2;
   }
   else if(Fl::test_shortcut(FL_ALT + FL_SHIFT + 'd')) {
-    opt_mesh_surfaces_faces(0, GMSH_SET | GMSH_GUI,
-                            !opt_mesh_surfaces_faces(0, GMSH_GET, 0));
+    opt_mesh_surfaces_faces
+      (0, GMSH_SET | GMSH_GUI, !opt_mesh_surfaces_faces(0, GMSH_GET, 0));
     status = 2;
   }
   else if(Fl::test_shortcut(FL_ALT + FL_SHIFT + 'b')) {
-    opt_mesh_volumes_faces(0, GMSH_SET | GMSH_GUI,
-                           !opt_mesh_volumes_faces(0, GMSH_GET, 0));
+    opt_mesh_volumes_faces
+      (0, GMSH_SET | GMSH_GUI, !opt_mesh_volumes_faces(0, GMSH_GET, 0));
     status = 2;
   }
   else if(Fl::test_shortcut(FL_ALT + 'm')) {
@@ -456,22 +456,22 @@ int GUI::testGlobalShortcuts(int event)
   else if(Fl::test_shortcut(FL_ALT + 'r')) {
     for(unsigned int i = 0; i < PView::list.size(); i++)
       if(opt_view_visible(i, GMSH_GET, 0))
-        opt_view_range_type(i, GMSH_SET | GMSH_GUI,
-                            opt_view_range_type(i, GMSH_GET, 0) + 1);
+        opt_view_range_type
+          (i, GMSH_SET | GMSH_GUI, opt_view_range_type(i, GMSH_GET, 0) + 1);
     status = 2;
   }
   else if(Fl::test_shortcut(FL_ALT + 'n')) {
     for(unsigned int i = 0; i < PView::list.size(); i++)
       if(opt_view_visible(i, GMSH_GET, 0))
-        opt_view_draw_strings(i, GMSH_SET | GMSH_GUI,
-                              !opt_view_draw_strings(i, GMSH_GET, 0));
+        opt_view_draw_strings
+          (i, GMSH_SET | GMSH_GUI, !opt_view_draw_strings(i, GMSH_GET, 0));
     status = 2;
   }
   else if(Fl::test_shortcut(FL_ALT + 'e')) {
     for(unsigned int i = 0; i < PView::list.size(); i++)
       if(opt_view_visible(i, GMSH_GET, 0))
-        opt_view_show_element(i, GMSH_SET | GMSH_GUI,
-                              !opt_view_show_element(i, GMSH_GET, 0));
+        opt_view_show_element
+          (i, GMSH_SET | GMSH_GUI, !opt_view_show_element(i, GMSH_GET, 0));
     status = 2;
   }
   else if(Fl::test_shortcut(FL_ALT + 'h')) {
diff --git a/Fltk/graphicWindow.cpp b/Fltk/graphicWindow.cpp
index 40e2bcf146658ba6fefefd55b6bb1f142d979779..34813680ec161bea424024b74b6e463544ccb5a5 100644
--- a/Fltk/graphicWindow.cpp
+++ b/Fltk/graphicWindow.cpp
@@ -343,68 +343,57 @@ graphicWindow::graphicWindow(bool main, int numTiles)
   int sht = sh - 4; // leave a 2 pixel border at the bottom
   
   butt[5] = new Fl_Button(x, glheight + 2, sw, sht, "@-1gmsh_models");
-  x += sw;
   butt[5]->callback(status_options_cb, (void *)"model");
   butt[5]->tooltip("Select active model");
-  
-  butt[0] = new Fl_Button(x, glheight + 2, sw, sht, "X");
   x += sw;
+  butt[0] = new Fl_Button(x, glheight + 2, sw, sht, "X");
   butt[0]->callback(status_xyz1p_cb, (void *)"x");
   butt[0]->tooltip("Set +X or -X view (Alt+x or Alt+Shift+x)");
-  
+  x += sw;  
   butt[1] = new Fl_Button(x, glheight + 2, sw, sht, "Y");
-  x += sw;
   butt[1]->callback(status_xyz1p_cb, (void *)"y");
   butt[1]->tooltip("Set +Y or -Y view (Alt+y or Alt+Shift+y)");
-  
+  x += sw;  
   butt[2] = new Fl_Button(x, glheight + 2, sw, sht, "Z");
-  x += sw;
   butt[2]->callback(status_xyz1p_cb, (void *)"z");
   butt[2]->tooltip("Set +Z or -Z view (Alt+z or Alt+Shift+z)");
-  
+  x += sw;  
   butt[4] = new Fl_Button(x, glheight + 2, sw, sht, "@-1gmsh_rotate");
-  x += sw;
   butt[4]->callback(status_xyz1p_cb, (void *)"r");
   butt[4]->tooltip("Rotate +90 or -90 degrees");
-  
+  x += sw;  
   butt[3] = new Fl_Button(x, glheight + 2, 2 * FL_NORMAL_SIZE, sht, "1:1");
-  x += 2 * FL_NORMAL_SIZE;
   butt[3]->callback(status_xyz1p_cb, (void *)"1:1");
   butt[3]->tooltip("Set unit scale");
-  
+  x += 2 * FL_NORMAL_SIZE;  
   butt[8] = new Fl_Button(x, glheight + 2, sw, sht, "@-1gmsh_ortho");
-  x += sw;
   butt[8]->callback(status_options_cb, (void *)"p");
   butt[8]->tooltip("Toggle projection mode (Alt+o or Alt+Shift+o)");
-  
+  x += sw;  
   butt[9] = new Fl_Button(x, glheight + 2, sw, sht, "S");
-  x += sw;
   butt[9]->callback(status_options_cb, (void *)"S");
   butt[9]->tooltip("Toggle mouse selection ON/OFF (Escape)");
-  
+  x += sw;  
   butt[6] = new Fl_Button(x, glheight + 2, sw, sht, "@-1gmsh_rewind");
-  x += sw;
   butt[6]->callback(status_rewind_cb);
   butt[6]->tooltip("Rewind animation");
   butt[6]->deactivate();
-  
+  x += sw;  
   butt[10] = new Fl_Button(x, glheight + 2, sw, sht, "@-1gmsh_back");
-  x += sw;
   butt[10]->callback(status_stepbackward_cb);
   butt[10]->tooltip("Step backward");
   butt[10]->deactivate();
-  
+  x += sw;  
   butt[7] = new Fl_Button(x, glheight + 2, sw, sht, "@-1gmsh_play");
-  x += sw;
   butt[7]->callback(status_play_cb);
   butt[7]->tooltip("Play/pause animation");
   butt[7]->deactivate();
-  
+  x += sw;  
   butt[11] = new Fl_Button(x, glheight + 2, sw, sht, "@-1gmsh_forward");
-  x += sw;
   butt[11]->callback(status_stepforward_cb);
   butt[11]->tooltip("Step forward");
   butt[11]->deactivate();
+  x += sw;
   
   for(int i = 0; i < 12; i++) {
     butt[i]->box(FL_FLAT_BOX);
diff --git a/Fltk/messageWindow.cpp b/Fltk/messageWindow.cpp
index be276bbf315f57161fadb570f129535b434afafd..75145e617c1917657534dde4a5b940dbaffa83ec 100644
--- a/Fltk/messageWindow.cpp
+++ b/Fltk/messageWindow.cpp
@@ -99,7 +99,7 @@ messageWindow::messageWindow(int deltaFontSize)
   }
 
   win->resizable(new Fl_Box(1, 1, 4, 4));
-  win->size_range(WB + 100 + 2 * BB + 3 * WB, 100);
+  win->size_range(3 * BB + 4 * WB, 100);
 
   win->position(CTX::instance()->msgPosition[0], CTX::instance()->msgPosition[1]);
   win->end();
diff --git a/Geo/GModelIO_Geo.cpp b/Geo/GModelIO_Geo.cpp
index 216a0e15bb07cdeb4c0e10de409ce41cabe47c9a..85b2f65f458c0d02c3896df15d1fb97fd9a8b286 100644
--- a/Geo/GModelIO_Geo.cpp
+++ b/Geo/GModelIO_Geo.cpp
@@ -35,7 +35,7 @@ void GModel::_deleteGEOInternals()
 
 int GModel::readGEO(const std::string &name)
 {
-  ParseFile(name.c_str(), true);
+  ParseFile(name, true);
   return importGEOInternals();
 }
 
@@ -265,7 +265,7 @@ class writeGEdgeGEO {
         fprintf(geo, "  Order %d;\n", c->degre);
         return;
       case MSH_SEGM_SPLN:
-        fprintf(geo, "CatmullRom(%d) = ", c->Num);
+        fprintf(geo, "Spline(%d) = ", c->Num);
         break;
       case MSH_SEGM_BSPLN:
         fprintf(geo, "BSpline(%d) = ", c->Num);
@@ -307,7 +307,7 @@ class writeGEdgeGEO {
             fprintf(geo, "Point(p%d + %d) = {%.16g, %.16g, %.16g, 1.e+22};\n", 
                     ge->tag(), i, p.x(), p.y(), p.z());
           }
-          fprintf(geo, "CatmullRom(%d) = {%d", ge->tag(), ge->getBeginVertex()->tag());
+          fprintf(geo, "Spline(%d) = {%d", ge->tag(), ge->getBeginVertex()->tag());
           for(int i = 1; i < ge->minimumDrawSegments(); i++)
             fprintf(geo, ", p%d + %d", ge->tag(), i);
           fprintf(geo, ", %d};\n", ge->getEndVertex()->tag());
diff --git a/Geo/GeoStringInterface.cpp b/Geo/GeoStringInterface.cpp
index a96a5d973a48bd5bcea0320ee11d86f909b4dfd3..fc7c434c97d1905bf6b5ac3b05a4b525fb9108c9 100644
--- a/Geo/GeoStringInterface.cpp
+++ b/Geo/GeoStringInterface.cpp
@@ -25,24 +25,23 @@ double evaluate_scalarfunction(std::string var, double val, std::string funct)
   Msg::Error("Scalar function evaluation not available without Gmsh parser");
   return 0.;
 #else
-  FILE *tempf = gmsh_yyin;
-  if(!(gmsh_yyin = fopen((CTX::instance()->homeDir + 
-                          CTX::instance()->tmpFileName).c_str(), "w"))) {
-    Msg::Error("Unable to open temporary file '%s'", 
-               (CTX::instance()->homeDir + CTX::instance()->tmpFileName).c_str());
+  std::string fileName = CTX::instance()->homeDir + CTX::instance()->tmpFileName;
+  FILE *gmsh_yyin_old = gmsh_yyin;
+  if(!(gmsh_yyin = fopen(fileName.c_str(), "w"))) {
+    Msg::Error("Unable to open temporary file '%s'", fileName.c_str());
+    gmsh_yyin = gmsh_yyin_old;
     return 0.;
   }
   // pose "variable = function" and evaluate function
   fprintf(gmsh_yyin, "%s = %.16g ;\n", var.c_str(), val);
   fprintf(gmsh_yyin, "ValeurTemporaire__ = %s ;\n", funct.c_str());
   fclose(gmsh_yyin);
-  gmsh_yyin = fopen((CTX::instance()->homeDir +
-                     CTX::instance()->tmpFileName).c_str(), "r");
+  gmsh_yyin = fopen(fileName.c_str(), "r");
   while(!feof(gmsh_yyin)) {
     gmsh_yyparse();
   }
   fclose(gmsh_yyin);
-  gmsh_yyin = tempf;
+  gmsh_yyin = gmsh_yyin_old;
   // retreive value
   if(gmsh_yysymbols.count("ValeurTemporaire__")) 
     return gmsh_yysymbols["ValeurTemporaire__"][0];
@@ -50,27 +49,27 @@ double evaluate_scalarfunction(std::string var, double val, std::string funct)
 #endif
 }
 
-void add_infile(std::string text, std::string filename, bool deleted_something)
+void add_infile(std::string text, std::string fileName, bool deleted_something)
 {
 #if defined(HAVE_NO_PARSER)
   Msg::Error("GEO file creation not available without Gmsh parser");
 #else
-  if(!(gmsh_yyin = fopen((CTX::instance()->homeDir + 
-                          CTX::instance()->tmpFileName).c_str(), "w"))) {
-    Msg::Error("Unable to open temporary file '%s'", 
-               (CTX::instance()->homeDir + CTX::instance()->tmpFileName).c_str());
+  std::string tmpFileName = CTX::instance()->homeDir + CTX::instance()->tmpFileName;
+  FILE *gmsh_yyin_old = gmsh_yyin;
+  if(!(gmsh_yyin = fopen(tmpFileName.c_str(), "w"))) {
+    Msg::Error("Unable to open temporary file '%s'", tmpFileName.c_str());
+    gmsh_yyin = gmsh_yyin_old;
     return;
   }
-
   fprintf(gmsh_yyin, "%s\n", text.c_str());
   Msg::StatusBar(2, true, "%s", text.c_str());
   fclose(gmsh_yyin);
-  gmsh_yyin = fopen((CTX::instance()->homeDir +
-                     CTX::instance()->tmpFileName).c_str(), "r");
+  gmsh_yyin = fopen(tmpFileName.c_str(), "r");
   while(!feof(gmsh_yyin)) {
     gmsh_yyparse();
   }
   fclose(gmsh_yyin);
+  gmsh_yyin = gmsh_yyin_old;
 
   if(deleted_something){
     // we need to start from scratch since the command just parsed
@@ -80,15 +79,15 @@ void add_infile(std::string text, std::string filename, bool deleted_something)
   GModel::current()->importGEOInternals();
   CTX::instance()->mesh.changed = ENT_ALL;
 
-  FILE *file;
-  if(!(file = fopen(filename.c_str(), "a"))) {
-    Msg::Error("Unable to open file '%s'", filename.c_str());
+  FILE *fp = fopen(fileName.c_str(), "a");
+  if(!fp) {
+    Msg::Error("Unable to open file '%s'", fileName.c_str());
     return;
   }
   
   if(!CTX::instance()->expertMode) {
     char no_ext[256], ext[256], base[256];
-    SplitFileName(filename.c_str(), no_ext, ext, base);
+    SplitFileName(fileName.c_str(), no_ext, ext, base);
     if(strlen(ext) && strcmp(ext, ".geo") && strcmp(ext, ".GEO")){
       char question[1024];
       sprintf(question, 
@@ -97,22 +96,22 @@ void add_infile(std::string text, std::string filename, bool deleted_something)
               "(You might want to create a new `.geo' file containing the command\n\n"
               "Merge \"%s\";\n\n"
               "and use that file instead. To disable this warning in the future, select\n"
-              "`Enable expert mode' in the option dialog.)", filename.c_str());
+              "`Enable expert mode' in the option dialog.)", fileName.c_str());
       if(!Msg::GetBinaryAnswer(question, "Proceed", "Cancel", false)){
-        fclose(file);
+        fclose(fp);
         return;
       }
     }
   }
 
-  fprintf(file, "%s\n", text.c_str());
-  fclose(file);
+  fprintf(fp, "%s\n", text.c_str());
+  fclose(fp);
 #endif
 }
 
-void coherence(std::string filename)
+void coherence(std::string fileName)
 {
-  add_infile("Coherence;", filename, true);
+  add_infile("Coherence;", fileName, true);
 }
 
 static std::string list2string(List_T *list)
@@ -127,28 +126,28 @@ static std::string list2string(List_T *list)
   return sstream.str();
 }
 
-void delet(List_T *list, std::string filename, std::string what)
+void delet(List_T *list, std::string fileName, std::string what)
 {
   std::ostringstream sstream;
   sstream << "Delete {\n  " << what << "{" << list2string(list) << "};\n}";
-  add_infile(sstream.str(), filename, true);
+  add_infile(sstream.str(), fileName, true);
 }
 
-void add_charlength(List_T *list, std::string filename, std::string lc)
+void add_charlength(List_T *list, std::string fileName, std::string lc)
 {
   std::ostringstream sstream;
   sstream << "Characteristic Length {" << list2string(list) << "} = " << lc << ";";
-  add_infile(sstream.str(), filename);
+  add_infile(sstream.str(), fileName);
 }
 
-void add_recosurf(List_T *list, std::string filename)
+void add_recosurf(List_T *list, std::string fileName)
 {
   std::ostringstream sstream;
   sstream << "Recombine Surface {" << list2string(list) << "};";
-  add_infile(sstream.str(), filename);
+  add_infile(sstream.str(), fileName);
 }
 
-void add_trsfline(std::vector<int> &l, std::string filename, std::string type, 
+void add_trsfline(std::vector<int> &l, std::string fileName, std::string type, 
                   std::string typearg, std::string pts)
 {
   std::ostringstream sstream;
@@ -160,10 +159,10 @@ void add_trsfline(std::vector<int> &l, std::string filename, std::string type,
   sstream << "} = " << pts;
   if(typearg.size()) sstream << " Using " << type << " " << typearg;
   sstream << ";";
-  add_infile(sstream.str(), filename);
+  add_infile(sstream.str(), fileName);
 }
 
-void add_trsfsurf(std::vector<int> &l, std::string filename, std::string dir)
+void add_trsfsurf(std::vector<int> &l, std::string fileName, std::string dir)
 {
   std::ostringstream sstream;
   sstream << "Transfinite Surface {" << l[0] << "}";
@@ -178,10 +177,10 @@ void add_trsfsurf(std::vector<int> &l, std::string filename, std::string dir)
   if(dir != "Left")
     sstream << " " << dir;
   sstream << ";";
-  add_infile(sstream.str(), filename);
+  add_infile(sstream.str(), fileName);
 }
 
-void add_trsfvol(std::vector<int> &l, std::string filename)
+void add_trsfvol(std::vector<int> &l, std::string fileName)
 {
   std::ostringstream sstream;
   sstream << "Transfinite Volume{" << l[0] << "} = {";
@@ -190,17 +189,17 @@ void add_trsfvol(std::vector<int> &l, std::string filename)
     sstream << l[i];
   }
   sstream << "};";
-  add_infile(sstream.str(), filename);
+  add_infile(sstream.str(), fileName);
 }
 
-void add_param(std::string par, std::string value, std::string filename)
+void add_param(std::string par, std::string value, std::string fileName)
 {
   std::ostringstream sstream;
   sstream << par << " = " << value << ";";
-  add_infile(sstream.str(), filename);
+  add_infile(sstream.str(), fileName);
 }
 
-void add_point(std::string filename, std::string x, std::string y,
+void add_point(std::string fileName, std::string x, std::string y,
 	       std::string z, std::string lc)
 {
   std::ostringstream sstream;
@@ -208,40 +207,40 @@ void add_point(std::string filename, std::string x, std::string y,
 	  << z ;
   if(lc.size()) sstream << ", " << lc;
   sstream << "};";
-  add_infile(sstream.str(), filename);
+  add_infile(sstream.str(), fileName);
 }
 
 void add_field_option(int field_id, std::string option_name, 
-		      std::string option_value, std::string filename)
+		      std::string option_value, std::string fileName)
 {
   std::ostringstream sstream;
   sstream << "Field[" << field_id << "]." << option_name << " = " 
 	  << option_value << ";";
-  add_infile(sstream.str(), filename);
+  add_infile(sstream.str(), fileName);
 }
 
-void add_field(int field_id, std::string type_name, std::string filename)
+void add_field(int field_id, std::string type_name, std::string fileName)
 {
   std::ostringstream sstream;
   sstream << "Field[" << field_id << "] = " << type_name << ";";
-  add_infile(sstream.str(), filename);
+  add_infile(sstream.str(), fileName);
 }
 
-void delete_field(int field_id, std::string filename)
+void delete_field(int field_id, std::string fileName)
 {
   std::ostringstream sstream;
   sstream << "Delete Field [" << field_id << "];";
-  add_infile(sstream.str(), filename);
+  add_infile(sstream.str(), fileName);
 }
 
-void set_background_field(int field_id, std::string filename)
+void set_background_field(int field_id, std::string fileName)
 {
   std::ostringstream sstream;
   sstream << "Background Field = " << field_id << ";";
-  add_infile(sstream.str(), filename);
+  add_infile(sstream.str(), fileName);
 }
 
-void add_multline(std::string type, std::vector<int> &p, std::string filename)
+void add_multline(std::string type, std::vector<int> &p, std::string fileName)
 {
   std::ostringstream sstream;
   sstream << type << "(" << NEWLINE() << ") = {";
@@ -250,66 +249,66 @@ void add_multline(std::string type, std::vector<int> &p, std::string filename)
     sstream << p[i];
   }
   sstream << "};";
-  add_infile(sstream.str(), filename);
+  add_infile(sstream.str(), fileName);
 }
 
-void add_circ(int p1, int p2, int p3, std::string filename)
+void add_circ(int p1, int p2, int p3, std::string fileName)
 {
   std::ostringstream sstream;
   sstream << "Circle(" << NEWLINE() << ") = {" << p1 << ", " << p2 << ", "
 	  << p3 << "};";
-  add_infile(sstream.str(), filename);
+  add_infile(sstream.str(), fileName);
 }
 
-void add_ell(int p1, int p2, int p3, int p4, std::string filename)
+void add_ell(int p1, int p2, int p3, int p4, std::string fileName)
 {
   std::ostringstream sstream;
   sstream << "Ellipse(" << NEWLINE() << ") = {" << p1 << ", " << p2 << ", "
 	  << p3 << ", " << p4 << "};";
-  add_infile(sstream.str(), filename);
+  add_infile(sstream.str(), fileName);
 }
 
-void add_lineloop(List_T *list, std::string filename, int *numloop)
+void add_lineloop(List_T *list, std::string fileName, int *numloop)
 {
   if(recognize_loop(list, numloop)) return;
   *numloop = NEWLINELOOP();
   std::ostringstream sstream;
   sstream << "Line Loop(" << *numloop << ") = {" << list2string(list) << "};";
-  add_infile(sstream.str(), filename);
+  add_infile(sstream.str(), fileName);
 }
 
-void add_surf(std::string type, List_T *list, std::string filename)
+void add_surf(std::string type, List_T *list, std::string fileName)
 {
   std::ostringstream sstream;  
   sstream << type << "(" << NEWSURFACE() << ") = {" << list2string(list) << "};";
-  add_infile(sstream.str(), filename);
+  add_infile(sstream.str(), fileName);
 }
 
-void add_surfloop(List_T *list, std::string filename, int *numloop)
+void add_surfloop(List_T *list, std::string fileName, int *numloop)
 {
   if(recognize_surfloop(list, numloop)) return;
   *numloop = NEWSURFACELOOP();
   std::ostringstream sstream;
   sstream << "Surface Loop(" << *numloop << ") = {" << list2string(list) << "};";
-  add_infile(sstream.str(), filename);
+  add_infile(sstream.str(), fileName);
 }
 
-void add_vol(List_T *list, std::string filename)
+void add_vol(List_T *list, std::string fileName)
 {
   std::ostringstream sstream;
   sstream << "Volume(" << NEWVOLUME() << ") = {" << list2string(list) << "};";
-  add_infile(sstream.str(), filename);
+  add_infile(sstream.str(), fileName);
 }
 
-void add_physical(std::string type, List_T *list, std::string filename)
+void add_physical(std::string type, List_T *list, std::string fileName)
 {
   std::ostringstream sstream;
   sstream << "Physical " << type << "(" << NEWPHYSICAL() << ") = {" 
 	  << list2string(list) << "};";
-  add_infile(sstream.str(), filename);
+  add_infile(sstream.str(), fileName);
 }
 
-void translate(int add, List_T *list, std::string filename, std::string what,
+void translate(int add, List_T *list, std::string fileName, std::string what,
                std::string tx, std::string ty, std::string tz)
 {
   std::ostringstream sstream;
@@ -318,10 +317,10 @@ void translate(int add, List_T *list, std::string filename, std::string what,
   sstream << what << "{" << list2string(list) << "};";
   if(add) sstream << " }";
   sstream << "\n}";
-  add_infile(sstream.str(), filename);
+  add_infile(sstream.str(), fileName);
 }
 
-void rotate(int add, List_T *list, std::string filename, std::string what, 
+void rotate(int add, List_T *list, std::string fileName, std::string what, 
             std::string ax, std::string ay, std::string az,
             std::string px, std::string py, std::string pz, std::string angle)
 {
@@ -332,10 +331,10 @@ void rotate(int add, List_T *list, std::string filename, std::string what,
   sstream << what << "{" << list2string(list) << "};";
   if(add) sstream << " }";
   sstream << "\n}";
-  add_infile(sstream.str(), filename);
+  add_infile(sstream.str(), fileName);
 }
 
-void dilate(int add, List_T *list, std::string filename, std::string what,
+void dilate(int add, List_T *list, std::string fileName, std::string what,
             std::string dx, std::string dy, std::string dz, std::string df)
 {
   std::ostringstream sstream;
@@ -344,10 +343,10 @@ void dilate(int add, List_T *list, std::string filename, std::string what,
   sstream << what << "{" << list2string(list) << "};";
   if(add) sstream << " }";
   sstream << "\n}";
-  add_infile(sstream.str(), filename);
+  add_infile(sstream.str(), fileName);
 }
 
-void symmetry(int add, List_T *list, std::string filename, std::string what,
+void symmetry(int add, List_T *list, std::string fileName, std::string what,
               std::string sa, std::string sb, std::string sc, std::string sd)
 {
   std::ostringstream sstream;
@@ -356,19 +355,19 @@ void symmetry(int add, List_T *list, std::string filename, std::string what,
   sstream << what << "{" << list2string(list) << "};";
   if(add) sstream << " }";
   sstream << "\n}";
-  add_infile(sstream.str(), filename);
+  add_infile(sstream.str(), fileName);
 }
 
-void extrude(List_T *list, std::string filename, std::string what, 
+void extrude(List_T *list, std::string fileName, std::string what, 
              std::string tx, std::string ty, std::string tz)
 {
   std::ostringstream sstream;
   sstream << "Extrude {" << tx << ", " << ty << ", " << tz << "} {\n  " << what 
 	  << "{" << list2string(list) << "};\n}";
-  add_infile(sstream.str(), filename);
+  add_infile(sstream.str(), fileName);
 }
 
-void protude(List_T *list, std::string filename, std::string what, 
+void protude(List_T *list, std::string fileName, std::string what, 
              std::string ax, std::string ay, std::string az,
              std::string px, std::string py, std::string pz, std::string angle)
 {
@@ -376,12 +375,12 @@ void protude(List_T *list, std::string filename, std::string what,
   sstream << "Extrude {{" << ax << ", " << ay << ", " << az << "}, {" 
 	  << px << ", " << py << ", " << pz << "}, " << angle << "} {\n  "
 	  << what << "{" << list2string(list) << "};\n}";
-  add_infile(sstream.str(), filename);
+  add_infile(sstream.str(), fileName);
 }
 
-void split_edge(int edge_id, List_T *vertices,std::string filename)
+void split_edge(int edge_id, List_T *vertices,std::string fileName)
 {
   std::ostringstream sstream;
   sstream << "Split Line(" << edge_id << ") {" << list2string(vertices) << "};";
-  add_infile(sstream.str(), filename, true);
+  add_infile(sstream.str(), fileName, true);
 }
diff --git a/Geo/GeoStringInterface.h b/Geo/GeoStringInterface.h
index 7e795c8bc9d20e861112e8c01f7402d1daa883b7..287d4325b8e0a982fa661974330322099a6c4858 100644
--- a/Geo/GeoStringInterface.h
+++ b/Geo/GeoStringInterface.h
@@ -12,45 +12,45 @@
 
 double evaluate_scalarfunction(std::string var, double val, std::string funct);
 
-void coherence(std::string filename);
-void delet(List_T *list, std::string filename, std::string what);
-void add_infile(std::string text, std::string filename, bool deleted_something=false);
-void add_charlength(List_T *list, std::string filename, std::string lc);
-void add_recosurf(List_T *list, std::string filename);
-void add_trsfline(std::vector<int> &l, std::string filename, std::string type, 
+void coherence(std::string fileName);
+void delet(List_T *list, std::string fileName, std::string what);
+void add_infile(std::string text, std::string fileName, bool deleted_something=false);
+void add_charlength(List_T *list, std::string fileName, std::string lc);
+void add_recosurf(List_T *list, std::string fileName);
+void add_trsfline(std::vector<int> &l, std::string fileName, std::string type, 
                   std::string typearg, std::string pts);
-void add_trsfsurf(std::vector<int> &l, std::string filename, std::string dir);
-void add_trsfvol(std::vector<int> &l, std::string filename);
-void add_param(std::string par, std::string value, std::string filename);
-void add_point(std::string filename, std::string x, std::string y, std::string z, 
+void add_trsfsurf(std::vector<int> &l, std::string fileName, std::string dir);
+void add_trsfvol(std::vector<int> &l, std::string fileName);
+void add_param(std::string par, std::string value, std::string fileName);
+void add_point(std::string fileName, std::string x, std::string y, std::string z, 
                std::string lc);
-void add_multline(std::string type, std::vector<int> &p, std::string filename);
-void add_circ(int p1, int p2, int p3, std::string filename);
-void add_ell(int p1, int p2, int p3, int p4, std::string filename);
+void add_multline(std::string type, std::vector<int> &p, std::string fileName);
+void add_circ(int p1, int p2, int p3, std::string fileName);
+void add_ell(int p1, int p2, int p3, int p4, std::string fileName);
 void add_field_option(int field_id, std::string option_name, std::string option_value,
-		      std::string filename);
-void add_field(int field_id, std::string type_name, std::string filename);
-void delete_field(int field_id, std::string filename);
-void set_background_field(int field_id,std::string filename);
-void add_lineloop(List_T *list, std::string filename, int *numloop);
-void add_surf(std::string type, List_T *list, std::string filename);
-void add_surfloop(List_T *list, std::string filename, int *numvol);
-void add_vol(List_T *list, std::string filename);
-void add_physical(std::string type, List_T *list, std::string filename);
-void translate(int add, List_T *list, std::string filename, std::string what,
+		      std::string fileName);
+void add_field(int field_id, std::string type_name, std::string fileName);
+void delete_field(int field_id, std::string fileName);
+void set_background_field(int field_id,std::string fileName);
+void add_lineloop(List_T *list, std::string fileName, int *numloop);
+void add_surf(std::string type, List_T *list, std::string fileName);
+void add_surfloop(List_T *list, std::string fileName, int *numvol);
+void add_vol(List_T *list, std::string fileName);
+void add_physical(std::string type, List_T *list, std::string fileName);
+void translate(int add, List_T *list, std::string fileName, std::string what,
                std::string tx, std::string ty, std::string tz);
-void rotate(int add, List_T *list, std::string filename, std::string what, 
+void rotate(int add, List_T *list, std::string fileName, std::string what, 
             std::string ax, std::string ay, std::string az,
             std::string px, std::string py, std::string pz, std::string angle);
-void dilate(int add, List_T *list, std::string filename, std::string what,
+void dilate(int add, List_T *list, std::string fileName, std::string what,
             std::string dx, std::string dy, std::string dz, std::string df);
-void symmetry(int add, List_T *list, std::string filename, std::string what, 
+void symmetry(int add, List_T *list, std::string fileName, std::string what, 
               std::string sa, std::string sb, std::string sc, std::string sd);
-void extrude(List_T *list, std::string filename, std::string what, std::string tx, 
+void extrude(List_T *list, std::string fileName, std::string what, std::string tx, 
              std::string ty, std::string tz);
-void protude(List_T *list, std::string filename, std::string what, 
+void protude(List_T *list, std::string fileName, std::string what, 
              std::string ax, std::string ay, std::string az, 
              std::string px, std::string py, std::string pz, std::string angle);
-void split_edge(int edge_id, List_T *vertices, std::string filename);
+void split_edge(int edge_id, List_T *vertices, std::string fileName);
 
 #endif