PR4302566.diff   [plain text]


--- src/man.c.orig	2006-06-02 12:52:27.000000000 -0700
+++ src/man.c	2006-06-02 15:11:32.000000000 -0700
@@ -335,7 +335,7 @@
      if (expander && *expander) {
 	  char *command;
 
-	  command = my_xsprintf ("%s %S", expander, name);
+	  command = my_xsprintf ("%s '%Q'", expander, name);
 	  fp = my_popen (command, "r");
 	  if (fp == NULL) {
 	       perror("popen");
@@ -604,10 +604,10 @@
 
      if (expander && *expander) {
 	  if (converter && *converter)
-	     command = my_xsprintf("%s%s '%S' | %s%s",
+	     command = my_xsprintf("%s%s '%Q' | %s%s",
 				   bufh, expander, file, converter, buft);
 	  else
-	     command = my_xsprintf("%s%s '%S'%s",
+	     command = my_xsprintf("%s%s '%Q'%s",
 				   bufh, expander, file, buft);
      } else if (ll || pl) {
 	  const char *cat = getval("CAT");
@@ -615,10 +615,10 @@
 		  cat = "cat";
 
 	  if (converter && *converter)
-	      command = my_xsprintf("%s%s '%S' | %s%s",
+	      command = my_xsprintf("%s%s '%Q' | %s%s",
 				    bufh, cat, file, converter, buft);
 	  else
-	      command = my_xsprintf("%s%s '%S'%s",
+	      command = my_xsprintf("%s%s '%Q'%s",
 				    bufh, cat, file, buft);
      }
 
@@ -641,7 +641,7 @@
      }
 
      if (expander && *expander) {
-	  char *cmd = my_xsprintf ("%s %S", expander, file);
+	  char *cmd = my_xsprintf ("%s '%Q'", expander, file);
 	  fp = my_popen (cmd, "r");
 	  if (fp == NULL) {
 	       perror("popen");
@@ -826,9 +826,9 @@
      if (roff_command == NULL)
 	  return 0;
      if (do_troff)
-	  command = my_xsprintf ("(cd %S && %s)", path, roff_command);
+	  command = my_xsprintf ("(cd '%Q' && %s)", path, roff_command);
      else
-	  command = my_xsprintf ("(cd %S && %s | (%s || true))", path,
+	  command = my_xsprintf ("(cd '%Q' && %s | (%s || true))", path,
 		   roff_command, pager);
 
      return !do_system_command (command, 0);