diff -up -r groff-1.22.3.orig/src/devices/grohtml/html-table.cpp groff-1.22.3/src/devices/grohtml/html-table.cpp
--- groff-1.22.3.orig/src/devices/grohtml/html-table.cpp	2014-11-04 10:38:35.279523000 +0200
+++ groff-1.22.3/src/devices/grohtml/html-table.cpp	2015-05-01 17:01:43.586495700 +0300
@@ -26,7 +26,6 @@ You should have received a copy of the G
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
 #include "driver.h"
-#include "stringclass.h"
 #include "cset.h"
 #include "html-table.h"
 #include "ctype.h"
diff -up -r groff-1.22.3.orig/src/devices/grohtml/html-text.cpp groff-1.22.3/src/devices/grohtml/html-text.cpp
--- groff-1.22.3.orig/src/devices/grohtml/html-text.cpp	2014-11-04 10:38:35.279523000 +0200
+++ groff-1.22.3/src/devices/grohtml/html-text.cpp	2015-05-01 17:02:13.777829400 +0300
@@ -27,7 +27,6 @@ You should have received a copy of the G
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
 #include "driver.h"
-#include "stringclass.h"
 #include "cset.h"
 
 #if !defined(TRUE)
diff -up -r groff-1.22.3.orig/src/devices/grohtml/output.cpp groff-1.22.3/src/devices/grohtml/output.cpp
--- groff-1.22.3.orig/src/devices/grohtml/output.cpp	2014-11-04 10:38:35.279523000 +0200
+++ groff-1.22.3/src/devices/grohtml/output.cpp	2015-05-01 17:02:41.376425700 +0300
@@ -27,7 +27,6 @@ You should have received a copy of the G
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
 #include "driver.h"
-#include "stringclass.h"
 #include "cset.h"
 
 #include <time.h>
diff -up -r groff-1.22.3.orig/src/devices/grohtml/post-html.cpp groff-1.22.3/src/devices/grohtml/post-html.cpp
--- groff-1.22.3.orig/src/devices/grohtml/post-html.cpp	2014-11-04 10:38:35.280523000 +0200
+++ groff-1.22.3/src/devices/grohtml/post-html.cpp	2015-05-01 17:01:10.958613600 +0300
@@ -23,7 +23,6 @@ You should have received a copy of the G
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
 #include "driver.h"
-#include "stringclass.h"
 #include "cset.h"
 #include "html.h"
 #include "html-text.h"
diff -up -r groff-1.22.3.orig/src/devices/grops/ps.cpp groff-1.22.3/src/devices/grops/ps.cpp
--- groff-1.22.3.orig/src/devices/grops/ps.cpp	2014-11-04 10:38:35.260523000 +0200
+++ groff-1.22.3/src/devices/grops/ps.cpp	2015-05-01 17:00:08.826629400 +0300
@@ -24,7 +24,6 @@ along with this program. If not, see <ht
  */
 
 #include "driver.h"
-#include "stringclass.h"
 #include "cset.h"
 #include "nonposix.h"
 #include "paper.h"
diff -up -r groff-1.22.3.orig/src/devices/grops/psrm.cpp groff-1.22.3/src/devices/grops/psrm.cpp
--- groff-1.22.3.orig/src/devices/grops/psrm.cpp	2014-11-04 10:38:35.260523000 +0200
+++ groff-1.22.3/src/devices/grops/psrm.cpp	2015-05-01 17:00:35.894183100 +0300
@@ -18,7 +18,6 @@ You should have received a copy of the G
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
 #include "driver.h"
-#include "stringclass.h"
 #include "cset.h"
 
 #include "ps.h"
diff -up -r groff-1.22.3.orig/src/include/driver.h groff-1.22.3/src/include/driver.h
--- groff-1.22.3.orig/src/include/driver.h	2014-11-04 10:38:35.160524000 +0200
+++ groff-1.22.3/src/include/driver.h	2015-05-01 16:40:26.194759200 +0300
@@ -17,6 +17,7 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
+#include "stringclass.h"
 #include "lib.h"
 
 #include <ctype.h>
diff -up -r groff-1.22.3.orig/src/include/lib.h groff-1.22.3/src/include/lib.h
--- groff-1.22.3.orig/src/include/lib.h	2014-11-04 10:38:35.161524000 +0200
+++ groff-1.22.3/src/include/lib.h	2014-11-10 16:39:53.801000000 +0200
@@ -99,6 +99,7 @@ size_t file_name_max(const char *fname);
 size_t path_name_max();
 
 int interpret_lf_args(const char *p);
+void normalize_for_lf (string &fn);
 
 extern char invalid_char_table[];
 
diff -up -r groff-1.22.3.orig/src/libs/libbib/index.cpp groff-1.22.3/src/libs/libbib/index.cpp
--- groff-1.22.3.orig/src/libs/libbib/index.cpp	2014-11-04 10:38:35.183524000 +0200
+++ groff-1.22.3/src/libs/libbib/index.cpp	2015-05-01 16:41:24.703158600 +0300
@@ -17,6 +17,7 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
+#include "stringclass.h"
 #include "lib.h"
 
 #include <stdlib.h>
diff -up -r groff-1.22.3.orig/src/libs/libbib/linear.cpp groff-1.22.3/src/libs/libbib/linear.cpp
--- groff-1.22.3.orig/src/libs/libbib/linear.cpp	2014-11-04 10:38:35.183524000 +0200
+++ groff-1.22.3/src/libs/libbib/linear.cpp	2015-05-01 16:41:49.833968700 +0300
@@ -17,6 +17,7 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
+#include "stringclass.h"
 #include "lib.h"
 
 #include <stdlib.h>
diff -up -r groff-1.22.3.orig/src/libs/libbib/search.cpp groff-1.22.3/src/libs/libbib/search.cpp
--- groff-1.22.3.orig/src/libs/libbib/search.cpp	2014-11-04 10:38:35.183524000 +0200
+++ groff-1.22.3/src/libs/libbib/search.cpp	2015-05-01 16:42:21.587192400 +0300
@@ -17,6 +17,7 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
+#include "stringclass.h"
 #include "lib.h"
 
 #include <stdlib.h>
diff -up -r groff-1.22.3.orig/src/libs/libgroff/color.cpp groff-1.22.3/src/libs/libgroff/color.cpp
--- groff-1.22.3.orig/src/libs/libgroff/color.cpp	2014-11-04 10:38:35.168524000 +0200
+++ groff-1.22.3/src/libs/libgroff/color.cpp	2015-05-01 16:29:46.428996300 +0300
@@ -20,6 +20,7 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
+#include "stringclass.h"
 #include "lib.h"
 #include "color.h"
 #include "cset.h"
diff -up -r groff-1.22.3.orig/src/libs/libgroff/cset.cpp groff-1.22.3/src/libs/libgroff/cset.cpp
--- groff-1.22.3.orig/src/libs/libgroff/cset.cpp	2014-11-04 10:38:35.168524000 +0200
+++ groff-1.22.3/src/libs/libgroff/cset.cpp	2015-05-01 16:30:29.318495700 +0300
@@ -19,6 +19,7 @@ along with this program. If not, see <ht
 
 #include <ctype.h>
 
+#include "stringclass.h"
 #include "lib.h"
 #include "cset.h"
 
diff -up -r groff-1.22.3.orig/src/libs/libgroff/font.cpp groff-1.22.3/src/libs/libgroff/font.cpp
--- groff-1.22.3.orig/src/libs/libgroff/font.cpp	2014-11-04 10:38:35.169524000 +0200
+++ groff-1.22.3/src/libs/libgroff/font.cpp	2015-05-01 16:30:52.621894500 +0300
@@ -17,6 +17,7 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
+#include "stringclass.h"
 #include "lib.h"
 
 #include <ctype.h>
diff -up -r groff-1.22.3.orig/src/libs/libgroff/fontfile.cpp groff-1.22.3/src/libs/libgroff/fontfile.cpp
--- groff-1.22.3.orig/src/libs/libgroff/fontfile.cpp	2014-11-04 10:38:35.169524000 +0200
+++ groff-1.22.3/src/libs/libgroff/fontfile.cpp	2015-05-01 16:31:14.425878900 +0300
@@ -17,6 +17,7 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
+#include "stringclass.h"
 #include "lib.h"
 
 #include <assert.h>
diff -up -r groff-1.22.3.orig/src/libs/libgroff/glyphuni.cpp groff-1.22.3/src/libs/libgroff/glyphuni.cpp
--- groff-1.22.3.orig/src/libs/libgroff/glyphuni.cpp	2014-11-04 10:38:35.169524000 +0200
+++ groff-1.22.3/src/libs/libgroff/glyphuni.cpp	2015-05-01 16:31:41.446575900 +0300
@@ -17,8 +17,8 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
-#include "lib.h"
 #include "stringclass.h"
+#include "lib.h"
 #include "ptable.h"
 
 #include "unicode.h"
diff -up -r groff-1.22.3.orig/src/libs/libgroff/htmlhint.cpp groff-1.22.3/src/libs/libgroff/htmlhint.cpp
--- groff-1.22.3.orig/src/libs/libgroff/htmlhint.cpp	2014-11-04 10:38:35.169524000 +0200
+++ groff-1.22.3/src/libs/libgroff/htmlhint.cpp	2015-05-01 16:32:14.152552500 +0300
@@ -16,13 +16,13 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
+#include "stringclass.h"
 #include "lib.h"
 
 #include <stddef.h>
 #include <stdlib.h>
 
 #include "nonposix.h"
-#include "stringclass.h"
 #include "html-strings.h"
 
 /*
diff -up -r groff-1.22.3.orig/src/libs/libgroff/invalid.cpp groff-1.22.3/src/libs/libgroff/invalid.cpp
--- groff-1.22.3.orig/src/libs/libgroff/invalid.cpp	2014-11-04 10:38:35.170524000 +0200
+++ groff-1.22.3/src/libs/libgroff/invalid.cpp	2015-05-01 16:32:34.160363400 +0300
@@ -16,6 +16,7 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
+#include "stringclass.h"
 #include "lib.h"
 
 // Table of invalid input characters.
diff -up -r groff-1.22.3.orig/src/libs/libgroff/lf.cpp groff-1.22.3/src/libs/libgroff/lf.cpp
--- groff-1.22.3.orig/src/libs/libgroff/lf.cpp	2014-11-04 10:38:35.170524000 +0200
+++ groff-1.22.3/src/libs/libgroff/lf.cpp	2014-11-10 16:40:10.644750000 +0200
@@ -19,9 +19,9 @@ along with this program. If not, see <ht
 
 #include <ctype.h>
 
+#include "stringclass.h"
 #include "lib.h"
 #include "cset.h"
-#include "stringclass.h"
 
 extern void change_filename(const char *);
 extern void change_lineno(int);
@@ -60,3 +60,15 @@ int interpret_lf_args(const char *p)
   change_lineno(ln);
   return 1;
 }
+
+void normalize_for_lf (string &fn)
+{
+#if defined(__MSDOS__) || (defined(_WIN32) && !defined(__CYGWIN__))
+  int fnlen = fn.length();
+  for (int i = 0; i < fnlen; i++)
+    {
+      if (fn[i] == '\\')
+	fn[i] = '/';
+    }
+#endif
+}
diff -up -r groff-1.22.3.orig/src/libs/libgroff/macropath.cpp groff-1.22.3/src/libs/libgroff/macropath.cpp
--- groff-1.22.3.orig/src/libs/libgroff/macropath.cpp	2014-11-04 10:38:35.170524000 +0200
+++ groff-1.22.3/src/libs/libgroff/macropath.cpp	2015-05-01 16:33:00.306402000 +0300
@@ -17,6 +17,7 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
+#include "stringclass.h"
 #include "lib.h"
 #include "searchpath.h"
 #include "macropath.h"
diff -up -r groff-1.22.3.orig/src/libs/libgroff/maxfilename.cpp groff-1.22.3/src/libs/libgroff/maxfilename.cpp
--- groff-1.22.3.orig/src/libs/libgroff/maxfilename.cpp	2014-11-04 10:38:35.170524000 +0200
+++ groff-1.22.3/src/libs/libgroff/maxfilename.cpp	2015-05-01 16:33:25.421593200 +0300
@@ -19,6 +19,7 @@ along with this program. If not, see <ht
 
 /* file_name_max(dir) does the same as pathconf(dir, _PC_NAME_MAX) */
 
+#include "stringclass.h"
 #include "lib.h"
 
 #include <sys/types.h>
diff -up -r groff-1.22.3.orig/src/libs/libgroff/maxpathname.cpp groff-1.22.3/src/libs/libgroff/maxpathname.cpp
--- groff-1.22.3.orig/src/libs/libgroff/maxpathname.cpp	2014-11-04 10:38:35.170524000 +0200
+++ groff-1.22.3/src/libs/libgroff/maxpathname.cpp	2015-05-01 16:33:47.537955600 +0300
@@ -19,6 +19,7 @@ along with this program. If not, see <ht
 
 /* path_name_max(dir) does the same as pathconf(dir, _PC_PATH_MAX) */
 
+#include "stringclass.h"
 #include "lib.h"
 
 #include <sys/types.h>
diff -up -r groff-1.22.3.orig/src/libs/libgroff/nametoindex.cpp groff-1.22.3/src/libs/libgroff/nametoindex.cpp
--- groff-1.22.3.orig/src/libs/libgroff/nametoindex.cpp	2014-11-04 10:38:35.171524000 +0200
+++ groff-1.22.3/src/libs/libgroff/nametoindex.cpp	2015-05-01 16:34:10.716403200 +0300
@@ -17,6 +17,7 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
+#include "stringclass.h"
 #include "lib.h"
 
 #include <ctype.h>
diff -up -r groff-1.22.3.orig/src/libs/libgroff/new.cpp groff-1.22.3/src/libs/libgroff/new.cpp
--- groff-1.22.3.orig/src/libs/libgroff/new.cpp	2014-11-04 10:38:35.171524000 +0200
+++ groff-1.22.3/src/libs/libgroff/new.cpp	2015-05-01 16:34:30.833546400 +0300
@@ -16,6 +16,7 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
+#include "stringclass.h"
 #include "lib.h"
 
 #include <stddef.h>
diff -up -r groff-1.22.3.orig/src/libs/libgroff/paper.cpp groff-1.22.3/src/libs/libgroff/paper.cpp
--- groff-1.22.3.orig/src/libs/libgroff/paper.cpp	2014-11-04 10:38:35.171524000 +0200
+++ groff-1.22.3/src/libs/libgroff/paper.cpp	2015-05-01 16:34:53.933899500 +0300
@@ -17,6 +17,7 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
+#include "stringclass.h"
 #include "lib.h"
 #include "paper.h"
 
diff -up -r groff-1.22.3.orig/src/libs/libgroff/relocate.cpp groff-1.22.3/src/libs/libgroff/relocate.cpp
--- groff-1.22.3.orig/src/libs/libgroff/relocate.cpp	2014-11-04 10:38:35.171524000 +0200
+++ groff-1.22.3/src/libs/libgroff/relocate.cpp	2015-05-01 16:35:27.264632100 +0300
@@ -17,6 +17,7 @@
 
 // Made after relocation code in kpathsea and gettext.
 
+#include "stringclass.h"
 #include "lib.h"
 
 #include <errno.h>
diff -up -r groff-1.22.3.orig/src/libs/libgroff/searchpath.cpp groff-1.22.3/src/libs/libgroff/searchpath.cpp
--- groff-1.22.3.orig/src/libs/libgroff/searchpath.cpp	2014-11-04 10:38:35.171524000 +0200
+++ groff-1.22.3/src/libs/libgroff/searchpath.cpp	2015-05-01 16:35:47.725391100 +0300
@@ -17,6 +17,7 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
+#include "stringclass.h"
 #include "lib.h"
 
 #include <stdlib.h>
diff -up -r groff-1.22.3.orig/src/libs/libgroff/string.cpp groff-1.22.3/src/libs/libgroff/string.cpp
--- groff-1.22.3.orig/src/libs/libgroff/string.cpp	2014-11-04 10:38:35.172524000 +0200
+++ groff-1.22.3/src/libs/libgroff/string.cpp	2015-05-01 16:36:22.727346000 +0300
@@ -17,9 +17,8 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
-#include "lib.h"
-
 #include "stringclass.h"
+#include "lib.h"
 
 static char *salloc(int len, int *sizep);
 static void sfree(char *ptr, int size);
diff -up -r groff-1.22.3.orig/src/libs/libgroff/symbol.cpp groff-1.22.3/src/libs/libgroff/symbol.cpp
--- groff-1.22.3.orig/src/libs/libgroff/symbol.cpp	2014-11-04 10:38:35.172524000 +0200
+++ groff-1.22.3/src/libs/libgroff/symbol.cpp	2015-05-01 16:36:53.402865600 +0300
@@ -17,6 +17,7 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
+#include "stringclass.h"
 #include "lib.h"
 
 #include "errarg.h"
diff -up -r groff-1.22.3.orig/src/libs/libgroff/tmpfile.cpp groff-1.22.3/src/libs/libgroff/tmpfile.cpp
--- groff-1.22.3.orig/src/libs/libgroff/tmpfile.cpp	2014-11-04 10:38:35.172524000 +0200
+++ groff-1.22.3/src/libs/libgroff/tmpfile.cpp	2015-05-01 16:37:11.911262100 +0300
@@ -17,6 +17,7 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
+#include "stringclass.h"
 #include "lib.h"
 
 #include <errno.h>
diff -up -r groff-1.22.3.orig/src/libs/libgroff/tmpname.cpp groff-1.22.3/src/libs/libgroff/tmpname.cpp
--- groff-1.22.3.orig/src/libs/libgroff/tmpname.cpp	2014-11-04 10:38:35.172524000 +0200
+++ groff-1.22.3/src/libs/libgroff/tmpname.cpp	2015-05-01 16:37:46.054177500 +0300
@@ -21,6 +21,7 @@ along with this program. If not, see <ht
    file tempname.c which is part of the fileutils package. */
 
 
+#include "stringclass.h"
 #include "lib.h"
 
 #include <stddef.h>
diff -up -r groff-1.22.3.orig/src/libs/libgroff/unicode.cpp groff-1.22.3/src/libs/libgroff/unicode.cpp
--- groff-1.22.3.orig/src/libs/libgroff/unicode.cpp	2014-11-04 10:38:35.172524000 +0200
+++ groff-1.22.3/src/libs/libgroff/unicode.cpp	2015-05-01 16:38:09.513765300 +0300
@@ -17,9 +17,9 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
+#include "stringclass.h"
 #include "lib.h"
 #include "cset.h"
-#include "stringclass.h"
 
 #include "unicode.h"
 
diff -up -r groff-1.22.3.orig/src/libs/libgroff/uniglyph.cpp groff-1.22.3/src/libs/libgroff/uniglyph.cpp
--- groff-1.22.3.orig/src/libs/libgroff/uniglyph.cpp	2014-11-04 10:38:35.172524000 +0200
+++ groff-1.22.3/src/libs/libgroff/uniglyph.cpp	2015-05-01 16:38:30.708612600 +0300
@@ -17,8 +17,8 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
-#include "lib.h"
 #include "stringclass.h"
+#include "lib.h"
 #include "ptable.h"
 
 #include "unicode.h"
diff -up -r groff-1.22.3.orig/src/libs/libgroff/uniuni.cpp groff-1.22.3/src/libs/libgroff/uniuni.cpp
--- groff-1.22.3.orig/src/libs/libgroff/uniuni.cpp	2014-11-04 10:38:35.173524000 +0200
+++ groff-1.22.3/src/libs/libgroff/uniuni.cpp	2015-05-01 16:38:50.107286400 +0300
@@ -21,8 +21,8 @@ along with this program. If not, see <ht
 // UnicodeData.txt, version 4.1.0, available from unicode.org,
 // on 2005-12-09.
 
-#include "lib.h"
 #include "stringclass.h"
+#include "lib.h"
 #include "ptable.h"
 
 #include "unicode.h"
diff -up -r groff-1.22.3.orig/src/preproc/eqn/eqn.cpp groff-1.22.3/src/preproc/eqn/eqn.cpp
--- groff-1.22.3.orig/src/preproc/eqn/eqn.cpp	2014-11-04 10:38:38.327485000 +0200
+++ groff-1.22.3/src/preproc/eqn/eqn.cpp	2015-05-01 16:52:26.757091800 +0300
@@ -68,6 +68,7 @@
 #include <string.h>
 #include <stdlib.h>
 
+#include "stringclass.h"
 #include "lib.h"
 #include "box.h"
 extern int non_empty_flag;
diff -up -r groff-1.22.3.orig/src/preproc/eqn/eqn.h groff-1.22.3/src/preproc/eqn/eqn.h
--- groff-1.22.3.orig/src/preproc/eqn/eqn.h	2014-11-04 10:38:35.232523000 +0200
+++ groff-1.22.3/src/preproc/eqn/eqn.h	2014-11-10 16:46:06.707250000 +0200
@@ -17,6 +17,7 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
+#include "stringclass.h"
 #include "lib.h"
 
 #include <assert.h>
diff -up -r groff-1.22.3.orig/src/preproc/eqn/eqn.y groff-1.22.3/src/preproc/eqn/eqn.y
--- groff-1.22.3.orig/src/preproc/eqn/eqn.y	2014-11-04 10:38:35.232523000 +0200
+++ groff-1.22.3/src/preproc/eqn/eqn.y	2015-05-01 16:50:52.981216200 +0300
@@ -20,6 +20,7 @@ along with this program. If not, see <ht
 #include <string.h>
 #include <stdlib.h>
 
+#include "stringclass.h"
 #include "lib.h"
 #include "box.h"
 extern int non_empty_flag;
diff -up -r groff-1.22.3.orig/src/preproc/eqn/lex.cpp groff-1.22.3/src/preproc/eqn/lex.cpp
--- groff-1.22.3.orig/src/preproc/eqn/lex.cpp	2014-11-04 10:38:35.232523000 +0200
+++ groff-1.22.3/src/preproc/eqn/lex.cpp	2015-05-01 16:55:42.493146600 +0300
@@ -19,7 +19,6 @@ along with this program. If not, see <ht
 
 #include "eqn.h"
 #include "eqn_tab.h"
-#include "stringclass.h"
 #include "ptable.h"
 
 
diff -up -r groff-1.22.3.orig/src/preproc/eqn/main.cpp groff-1.22.3/src/preproc/eqn/main.cpp
--- groff-1.22.3.orig/src/preproc/eqn/main.cpp	2014-11-04 10:38:35.232523000 +0200
+++ groff-1.22.3/src/preproc/eqn/main.cpp	2014-11-10 16:46:14.160375000 +0200
@@ -18,7 +18,6 @@ You should have received a copy of the G
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
 #include "eqn.h"
-#include "stringclass.h"
 #include "device.h"
 #include "searchpath.h"
 #include "macropath.h"
@@ -66,9 +65,12 @@ void do_file(FILE *fp, const char *filen
 {
   string linebuf;
   string str;
+  string fn(filename);
+  fn += '\0';
+  normalize_for_lf(fn);
+  current_filename = fn.contents();
   if (output_format == troff)
-    printf(".lf 1 %s\n", filename);
-  current_filename = filename;
+    printf(".lf 1 %s\n", current_filename);
   current_lineno = 0;
   while (read_line(fp, &linebuf)) {
     if (linebuf.length() >= 4
diff -up -r groff-1.22.3.orig/src/preproc/grn/hgraph.cpp groff-1.22.3/src/preproc/grn/hgraph.cpp
--- groff-1.22.3.orig/src/preproc/grn/hgraph.cpp	2014-11-04 10:38:35.239523000 +0200
+++ groff-1.22.3/src/preproc/grn/hgraph.cpp	2015-05-01 16:57:30.310413300 +0300
@@ -4,6 +4,7 @@
  * to troff input.
  */
 
+#include "stringclass.h"
 #include "lib.h"
 
 #include "gprint.h"
diff -up -r groff-1.22.3.orig/src/preproc/grn/main.cpp groff-1.22.3/src/preproc/grn/main.cpp
--- groff-1.22.3.orig/src/preproc/grn/main.cpp	2014-11-04 10:38:35.239523000 +0200
+++ groff-1.22.3/src/preproc/grn/main.cpp	2015-05-01 16:58:07.186636200 +0300
@@ -67,6 +67,7 @@
  */
 
 
+#include "stringclass.h"
 #include "lib.h"
 
 #include <ctype.h>
diff -up -r groff-1.22.3.orig/src/preproc/html/pre-html.cpp groff-1.22.3/src/preproc/html/pre-html.cpp
--- groff-1.22.3.orig/src/preproc/html/pre-html.cpp	2014-11-04 10:38:35.255523000 +0200
+++ groff-1.22.3/src/preproc/html/pre-html.cpp	2015-05-01 16:58:52.903156500 +0300
@@ -21,6 +21,7 @@
 
 #define PREHTMLC
 
+#include "stringclass.h"
 #include "lib.h"
 
 #include <signal.h>
@@ -30,7 +31,6 @@
 #include <errno.h>
 #include "errarg.h"
 #include "error.h"
-#include "stringclass.h"
 #include "posix.h"
 #include "defs.h"
 #include "searchpath.h"
diff -up -r groff-1.22.3.orig/src/preproc/html/pushback.cpp groff-1.22.3/src/preproc/html/pushback.cpp
--- groff-1.22.3.orig/src/preproc/html/pushback.cpp	2014-11-04 10:38:35.255523000 +0200
+++ groff-1.22.3/src/preproc/html/pushback.cpp	2015-05-01 16:59:23.891054100 +0300
@@ -17,6 +17,7 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
+#include "stringclass.h"
 #include "lib.h"
 
 #include <signal.h>
@@ -26,7 +27,6 @@ along with this program. If not, see <ht
 #include <errno.h>
 #include "errarg.h"
 #include "error.h"
-#include "stringclass.h"
 #include "posix.h"
 #include "nonposix.h"
 
diff -up -r groff-1.22.3.orig/src/preproc/pic/main.cpp groff-1.22.3/src/preproc/pic/main.cpp
--- groff-1.22.3.orig/src/preproc/pic/main.cpp	2014-11-04 10:38:35.226523000 +0200
+++ groff-1.22.3/src/preproc/pic/main.cpp	2014-11-10 16:29:15.113500000 +0200
@@ -309,8 +309,11 @@ void do_file(const char *filename)
       fatal("can't open `%1': %2", filename, strerror(errno));
     }
   }
-  out->set_location(filename, 1);
-  current_filename = filename;
+  string fn(filename);
+  fn += '\0';
+  normalize_for_lf(fn);
+  current_filename = fn.contents();
+  out->set_location(current_filename, 1);
   current_lineno = 1;
   enum { START, MIDDLE, HAD_DOT, HAD_P, HAD_PS, HAD_l, HAD_lf } state = START;
   for (;;) {
diff -up -r groff-1.22.3.orig/src/preproc/pic/pic.h groff-1.22.3/src/preproc/pic/pic.h
--- groff-1.22.3.orig/src/preproc/pic/pic.h	2014-11-04 10:38:35.226523000 +0200
+++ groff-1.22.3/src/preproc/pic/pic.h	2014-11-10 16:43:16.426000000 +0200
@@ -17,6 +17,7 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
+#include "stringclass.h"
 #include "lib.h"
 
 #include <math.h>
@@ -49,7 +50,6 @@ extern "C" {
 
 #include "assert.h"
 #include "cset.h"
-#include "stringclass.h"
 #include "errarg.h"
 #include "error.h"
 #include "position.h"
diff -up -r groff-1.22.3.orig/src/preproc/preconv/preconv.cpp groff-1.22.3/src/preproc/preconv/preconv.cpp
--- groff-1.22.3.orig/src/preproc/preconv/preconv.cpp	2014-11-04 10:38:35.214524000 +0200
+++ groff-1.22.3/src/preproc/preconv/preconv.cpp	2014-11-10 16:40:41.644750000 +0200
@@ -17,6 +17,7 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
+#include "stringclass.h"
 #include "lib.h"
 
 #include <assert.h>
@@ -26,7 +27,6 @@ along with this program. If not, see <ht
 #include "error.h"
 #include "localcharset.h"
 #include "nonposix.h"
-#include "stringclass.h"
 
 #include <locale.h>
 
@@ -1065,8 +1065,12 @@ do_file(const char *filename)
   }
   if (debug_flag)
     fprintf(stderr, "  encoding used: `%s'\n", encoding);
-  if (!raw_flag)
-    printf(".lf 1 %s\n", filename);
+  if (!raw_flag) {
+    string fn(filename);
+    fn += '\0';
+    normalize_for_lf(fn);
+    printf(".lf 1 %s\n", fn.contents());
+  }
   int success = 1;
   // Call converter (converters write to stdout).
   if (!strcasecmp(encoding, "ISO-8859-1"))
diff -up -r groff-1.22.3.orig/src/preproc/refer/refer.cpp groff-1.22.3/src/preproc/refer/refer.cpp
--- groff-1.22.3.orig/src/preproc/refer/refer.cpp	2014-11-04 10:38:35.245523000 +0200
+++ groff-1.22.3/src/preproc/refer/refer.cpp	2014-11-10 16:45:51.019750000 +0200
@@ -432,8 +432,11 @@ static void do_file(const char *filename
       return;
     }
   }
-  current_filename = filename;
-  fprintf(outfp, ".lf 1 %s\n", filename);
+  string fn(filename);
+  fn += '\0';
+  normalize_for_lf(fn);
+  current_filename = fn.contents();
+  fprintf(outfp, ".lf 1 %s\n", current_filename);
   string line;
   current_lineno = 0;
   for (;;) {
diff -up -r groff-1.22.3.orig/src/preproc/refer/refer.h groff-1.22.3/src/preproc/refer/refer.h
--- groff-1.22.3.orig/src/preproc/refer/refer.h	2014-11-04 10:38:35.245523000 +0200
+++ groff-1.22.3/src/preproc/refer/refer.h	2014-11-10 16:45:55.613500000 +0200
@@ -17,6 +17,7 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
+#include "stringclass.h"
 #include "lib.h"
 
 #include <stdlib.h>
@@ -25,7 +26,6 @@ along with this program. If not, see <ht
 
 #include "errarg.h"
 #include "error.h"
-#include "stringclass.h"
 #include "cset.h"
 #include "cmap.h"
 
diff -up -r groff-1.22.3.orig/src/preproc/soelim/soelim.cpp groff-1.22.3/src/preproc/soelim/soelim.cpp
--- groff-1.22.3.orig/src/preproc/soelim/soelim.cpp	2014-11-04 10:38:35.250523000 +0200
+++ groff-1.22.3/src/preproc/soelim/soelim.cpp	2014-11-10 16:46:51.394750000 +0200
@@ -17,6 +17,7 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
+#include "stringclass.h"
 #include "lib.h"
 
 #include <ctype.h>
@@ -25,7 +26,6 @@ along with this program. If not, see <ht
 #include <errno.h>
 #include "errarg.h"
 #include "error.h"
-#include "stringclass.h"
 #include "nonposix.h"
 #include "searchpath.h"
 
@@ -161,6 +161,7 @@ int do_file(const char *filename)
     error("can't open `%1': %2", whole_filename.contents(), strerror(err));
     return 0;
   }
+  normalize_for_lf(whole_filename);
   current_filename = whole_filename.contents();
   current_lineno = 1;
   set_location();
diff -up -r groff-1.22.3.orig/src/preproc/tbl/main.cpp groff-1.22.3/src/preproc/tbl/main.cpp
--- groff-1.22.3.orig/src/preproc/tbl/main.cpp	2014-11-04 10:38:35.220524000 +0200
+++ groff-1.22.3/src/preproc/tbl/main.cpp	2014-11-10 16:31:23.629125000 +0200
@@ -1615,7 +1615,10 @@ int main(int argc, char **argv)
 	  fatal("can't open `%1': %2", argv[i], strerror(errno));
 	else {
 	  current_lineno = 1;
-	  current_filename = argv[i];
+	  string fn(argv[i]);
+	  fn += '\0';
+	  normalize_for_lf(fn);
+	  current_filename = fn.contents();
 	  printf(".lf 1 %s\n", current_filename);
 	  process_input_file(fp);
 	}
diff -up -r groff-1.22.3.orig/src/preproc/tbl/table.cpp groff-1.22.3/src/preproc/tbl/table.cpp
--- groff-1.22.3.orig/src/preproc/tbl/table.cpp	2014-11-04 10:38:35.221524000 +0200
+++ groff-1.22.3/src/preproc/tbl/table.cpp	2014-11-10 16:33:40.785375000 +0200
@@ -2966,7 +2966,10 @@ void set_troff_location(const char *fn, 
       && strcmp(fn, last_filename) == 0)
     printfs(".lf %1\n", as_string(ln));
   else {
-    printfs(".lf %1 %2\n", as_string(ln), fn);
+    string filename(fn);
+    filename += '\0';
+    normalize_for_lf(filename);
+    printfs(".lf %1 %2\n", as_string(ln), filename.contents());
     last_filename = fn;
     location_force_filename = 0;
   }
diff -up -r groff-1.22.3.orig/src/preproc/tbl/table.h groff-1.22.3/src/preproc/tbl/table.h
--- groff-1.22.3.orig/src/preproc/tbl/table.h	2014-11-04 10:38:35.221524000 +0200
+++ groff-1.22.3/src/preproc/tbl/table.h	2014-11-10 16:41:24.972875000 +0200
@@ -17,6 +17,7 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
+#include "stringclass.h"
 #include "lib.h"
 
 #include <stdlib.h>
@@ -26,7 +27,6 @@ along with this program. If not, see <ht
 
 #include "cset.h"
 #include "cmap.h"
-#include "stringclass.h"
 #include "errarg.h"
 #include "error.h"
 
diff -up -r groff-1.22.3.orig/src/roff/groff/groff.cpp groff-1.22.3/src/roff/groff/groff.cpp
--- groff-1.22.3.orig/src/roff/groff/groff.cpp	2014-11-04 10:38:35.195524000 +0200
+++ groff-1.22.3/src/roff/groff/groff.cpp	2015-05-01 17:37:16.909571100 +0300
@@ -19,6 +19,7 @@ along with this program. If not, see <ht
 
 // A front end for groff.
 
+#include "stringclass.h"
 #include "lib.h"
 
 #include <stdlib.h>
@@ -28,13 +29,13 @@ along with this program. If not, see <ht
 #include "assert.h"
 #include "errarg.h"
 #include "error.h"
-#include "stringclass.h"
 #include "cset.h"
 #include "font.h"
 #include "device.h"
 #include "pipeline.h"
 #include "nonposix.h"
 #include "defs.h"
+#include "relocate.h"
 
 #define GXDITVIEW "gxditview"
 
@@ -469,8 +470,10 @@ int main(int argc, char **argv)
     f += '=';
     if (binpath && *binpath)
       f += binpath;
-    else
-      f += BINPATH;
+    else {
+      binpath = relocatep(BINPATH);
+      f += binpath;
+    }
     if (path && *path) {
       f += PATH_SEP_CHAR;
       f += path;
@@ -701,7 +704,13 @@ void append_arg_to_string(const char *ar
 {
   str += ' ';
   int needs_quoting = 0;
+  // Native Windows programs don't support '..' style of quoting, so
+  // always behave as if ARG included the single quote character.
+#if defined(_WIN32) && !defined(__CYGWIN__)
+  int contains_single_quote = 1;
+#else
   int contains_single_quote = 0;
+#endif
   const char*p;
   for (p = arg; *p != '\0'; p++)
     switch (*p) {
@@ -731,10 +740,17 @@ void append_arg_to_string(const char *ar
     str += '"';
     for (p = arg; *p != '\0'; p++)
       switch (*p) {
+#if !(defined(_WIN32) && !defined(__CYGWIN__))
       case '"':
       case '\\':
       case '$':
 	str += '\\';
+#else
+      case '"':
+      case '\\':
+	if (*p == '"' || (*p == '\\' && p[1] == '"'))
+	  str += '\\';
+#endif
 	// fall through
       default:
 	str += *p;
diff -up -r groff-1.22.3.orig/src/roff/troff/div.cpp groff-1.22.3/src/roff/troff/div.cpp
--- groff-1.22.3.orig/src/roff/troff/div.cpp	2014-11-04 10:38:35.201524000 +0200
+++ groff-1.22.3/src/roff/troff/div.cpp	2015-05-01 16:45:10.427501400 +0300
@@ -23,7 +23,6 @@ along with this program. If not, see <ht
 #include "troff.h"
 #include "dictionary.h"
 #include "hvunits.h"
-#include "stringclass.h"
 #include "mtsm.h"
 #include "env.h"
 #include "request.h"
diff -up -r groff-1.22.3.orig/src/roff/troff/env.cpp groff-1.22.3/src/roff/troff/env.cpp
--- groff-1.22.3.orig/src/roff/troff/env.cpp	2014-11-04 10:38:35.202524000 +0200
+++ groff-1.22.3/src/roff/troff/env.cpp	2015-05-01 16:45:49.537227000 +0300
@@ -20,7 +20,6 @@ along with this program. If not, see <ht
 #include "troff.h"
 #include "dictionary.h"
 #include "hvunits.h"
-#include "stringclass.h"
 #include "mtsm.h"
 #include "env.h"
 #include "request.h"
diff -up -r groff-1.22.3.orig/src/roff/troff/input.cpp groff-1.22.3/src/roff/troff/input.cpp
--- groff-1.22.3.orig/src/roff/troff/input.cpp	2014-11-04 10:38:35.203524000 +0200
+++ groff-1.22.3/src/roff/troff/input.cpp	2015-05-01 16:46:25.195175700 +0300
@@ -22,7 +22,6 @@ along with this program. If not, see <ht
 #include "troff.h"
 #include "dictionary.h"
 #include "hvunits.h"
-#include "stringclass.h"
 #include "mtsm.h"
 #include "env.h"
 #include "request.h"
diff -up -r groff-1.22.3.orig/src/roff/troff/mtsm.cpp groff-1.22.3/src/roff/troff/mtsm.cpp
--- groff-1.22.3.orig/src/roff/troff/mtsm.cpp	2014-11-04 10:38:35.203524000 +0200
+++ groff-1.22.3/src/roff/troff/mtsm.cpp	2015-05-01 16:47:00.337700700 +0300
@@ -23,7 +23,6 @@ extern int debug_state;
 
 #include "troff.h"
 #include "hvunits.h"
-#include "stringclass.h"
 #include "mtsm.h"
 #include "env.h"
 
diff -up -r groff-1.22.3.orig/src/roff/troff/node.cpp groff-1.22.3/src/roff/troff/node.cpp
--- groff-1.22.3.orig/src/roff/troff/node.cpp	2014-11-04 10:38:35.203524000 +0200
+++ groff-1.22.3/src/roff/troff/node.cpp	2015-05-01 16:47:27.873821400 +0300
@@ -27,7 +27,6 @@ extern int debug_state;
 
 #include "dictionary.h"
 #include "hvunits.h"
-#include "stringclass.h"
 #include "mtsm.h"
 #include "env.h"
 #include "request.h"
diff -up -r groff-1.22.3.orig/src/roff/troff/number.cpp groff-1.22.3/src/roff/troff/number.cpp
--- groff-1.22.3.orig/src/roff/troff/number.cpp	2014-11-04 10:38:35.204524000 +0200
+++ groff-1.22.3/src/roff/troff/number.cpp	2015-05-01 16:47:55.566131100 +0300
@@ -20,7 +20,6 @@ along with this program. If not, see <ht
 
 #include "troff.h"
 #include "hvunits.h"
-#include "stringclass.h"
 #include "mtsm.h"
 #include "env.h"
 #include "token.h"
diff -up -r groff-1.22.3.orig/src/roff/troff/troff.h groff-1.22.3/src/roff/troff/troff.h
--- groff-1.22.3.orig/src/roff/troff/troff.h	2014-11-04 10:38:35.204524000 +0200
+++ groff-1.22.3/src/roff/troff/troff.h	2015-05-01 16:44:14.699266200 +0300
@@ -18,6 +18,7 @@ You should have received a copy of the G
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
 
+#include "stringclass.h"
 #include "lib.h"
 
 #include <ctype.h>
diff -up -r groff-1.22.3.orig/src/utils/addftinfo/addftinfo.cpp groff-1.22.3/src/utils/addftinfo/addftinfo.cpp
--- groff-1.22.3.orig/src/utils/addftinfo/addftinfo.cpp	2014-11-04 10:38:35.310522000 +0200
+++ groff-1.22.3/src/utils/addftinfo/addftinfo.cpp	2015-05-01 17:06:59.353797000 +0300
@@ -17,6 +17,7 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
+#include "stringclass.h"
 #include "lib.h"
 
 #include <ctype.h>
@@ -25,7 +26,6 @@ along with this program. If not, see <ht
 #include <errno.h>
 #include "errarg.h"
 #include "error.h"
-#include "stringclass.h"
 #include "cset.h"
 #include "guess.h"
 
diff -up -r groff-1.22.3.orig/src/utils/hpftodit/hpftodit.cpp groff-1.22.3/src/utils/hpftodit/hpftodit.cpp
--- groff-1.22.3.orig/src/utils/hpftodit/hpftodit.cpp	2014-11-04 10:38:35.292523000 +0200
+++ groff-1.22.3/src/utils/hpftodit/hpftodit.cpp	2015-05-01 17:04:04.219071300 +0300
@@ -24,6 +24,7 @@ option to specify symbol sets to look in
 put filename in error messages (or fix lib)
 */
 
+#include "stringclass.h"
 #include "lib.h"
 
 #include <stdio.h>
diff -up -r groff-1.22.3.orig/src/utils/hpftodit/hpuni.cpp groff-1.22.3/src/utils/hpftodit/hpuni.cpp
--- groff-1.22.3.orig/src/utils/hpftodit/hpuni.cpp	2014-11-04 10:38:35.293523000 +0200
+++ groff-1.22.3/src/utils/hpftodit/hpuni.cpp	2015-05-01 17:04:37.003142400 +0300
@@ -17,8 +17,8 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
-#include "lib.h"
 #include "stringclass.h"
+#include "lib.h"
 #include "ptable.h"
 
 #include "unicode.h"
diff -up -r groff-1.22.3.orig/src/utils/indxbib/indxbib.cpp groff-1.22.3/src/utils/indxbib/indxbib.cpp
--- groff-1.22.3.orig/src/utils/indxbib/indxbib.cpp	2014-11-04 10:38:35.301523000 +0200
+++ groff-1.22.3/src/utils/indxbib/indxbib.cpp	2015-05-01 17:05:44.351839200 +0300
@@ -17,6 +17,7 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
+#include "stringclass.h"
 #include "lib.h"
 
 #include <stdlib.h>
@@ -26,7 +27,6 @@ along with this program. If not, see <ht
 #include "posix.h"
 #include "errarg.h"
 #include "error.h"
-#include "stringclass.h"
 #include "cset.h"
 #include "cmap.h"
 
diff -up -r groff-1.22.3.orig/src/utils/lkbib/lkbib.cpp groff-1.22.3/src/utils/lkbib/lkbib.cpp
--- groff-1.22.3.orig/src/utils/lkbib/lkbib.cpp	2014-11-04 10:38:35.305522000 +0200
+++ groff-1.22.3/src/utils/lkbib/lkbib.cpp	2015-05-01 17:06:23.586516000 +0300
@@ -17,6 +17,7 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
+#include "stringclass.h"
 #include "lib.h"
 
 #include <stdlib.h>
diff -up -r groff-1.22.3.orig/src/utils/lookbib/lookbib.cpp groff-1.22.3/src/utils/lookbib/lookbib.cpp
--- groff-1.22.3.orig/src/utils/lookbib/lookbib.cpp	2014-11-04 10:38:35.297523000 +0200
+++ groff-1.22.3/src/utils/lookbib/lookbib.cpp	2015-05-01 17:05:11.817670500 +0300
@@ -17,6 +17,7 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program. If not, see <http://www.gnu.org/licenses/>. */
 
+#include "stringclass.h"
 #include "lib.h"
 
 #include <stdlib.h>
diff -up -r groff-1.22.3.orig/src/utils/tfmtodit/tfmtodit.cpp groff-1.22.3/src/utils/tfmtodit/tfmtodit.cpp
--- groff-1.22.3.orig/src/utils/tfmtodit/tfmtodit.cpp	2014-11-04 10:38:35.288523000 +0200
+++ groff-1.22.3/src/utils/tfmtodit/tfmtodit.cpp	2015-05-01 17:03:19.345971600 +0300
@@ -46,6 +46,7 @@ This need only be done for a font for wh
 When it's true, the left_correction and subscript_correction should
 both be zero. */
 
+#include "stringclass.h"
 #include "lib.h"
 
 #include <stdlib.h>
