Ilya Zakharevich on Thu, 21 Sep 2000 23:31:35 -0400


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

PATCH: a sensible default for a prettyprinter


--- ./src/gp/gp.c~	Thu Sep 21 23:12:47 2000
+++ ./src/gp/gp.c	Thu Sep 21 23:21:24 2000
@@ -59,6 +59,7 @@ static char *help_prg,*path;
 static char prompt[MAX_PROMPT_LEN];
 static char thestring[256];
 static char *prettyprinter;
+static char *prettyprinter_def = "tex2mail -TeX -noindent -ragged -by_par";
 static pariFILE *prettyprinter_file;
 static long prettyp, test_mode, quiet_mode, gpsilent, simplifyflag;
 static long chrono, pariecho, primelimit, parisize, strictmatch;
@@ -136,7 +137,7 @@ gp_preinit(int force)
   tglobal = 0;
   bufstack = NULL;
   secure = test_mode = under_emacs = chrono = pariecho = 0;
-  prettyprinter = NULL;
+  prettyprinter = prettyprinter_def;
   prettyprinter_file = NULL;
   fmt.format = 'g'; fmt.field = 0;
 #ifdef LONG_IS_64BIT
@@ -809,18 +810,18 @@ sd_prettyprinter(char *v, int flag)
     char *old = prettyprinter;
 
     if (secure) err_secure("prettyprinter",v);
-    if (old && strcmp(old,v) && prettyprinter_file)
+    if (strcmp(old,v) && prettyprinter_file)
     {
       pari_fclose(prettyprinter_file);
       prettyprinter_file = NULL;
     }
     prettyprinter = pari_strdup(v);
-    if (old) free(old);
+    if (old != prettyprinter_def) free(old);
     if (flag == d_INITRC) return gnil;
   }
-  if (flag == d_RETURN) return strtoGEN(prettyprinter? prettyprinter: "");
+  if (flag == d_RETURN) return strtoGEN(prettyprinter);
   if (flag == d_ACKNOWLEDGE)
-    pariputsf("   prettyprinter = \"%s\"\n",prettyprinter? prettyprinter: "");
+    pariputsf("   prettyprinter = \"%s\"\n",prettyprinter);
   return gnil;
 }