3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Enrico Forestieri
8 * Full author contact details are available in file CREDITS.
10 * This is a wrapper program for the lyxeditor.sh script or lyxclient program,
11 * meant to be used with yap or sumatrapdf for inverse search.
18 #include <cygwin/version.h>
19 #include <sys/cygwin.h>
22 void convert_to_full_posix_path(char const * from, char *to)
24 #if CYGWIN_VERSION_DLL_MAJOR >= 1007
25 cygwin_conv_path(CCP_WIN_A_TO_POSIX, from, to, PATH_MAX);
27 cygwin_conv_to_full_posix_path(from, to);
31 int main(int ac, char **av)
35 char posixpath[PATH_MAX];
37 if (ac < 3 || ac > 4) {
38 MessageBox(0, "Usage: lyxeditor [-g] <file.tex> <lineno>",
39 "ERROR: Wrong number of arguments", 0);
44 char const * fmt = "lyxeditor.sh" PROGRAM_SUFFIX " '%s' %s";
45 convert_to_full_posix_path(av[1], posixpath);
46 bufsize = snprintf(0, 0, fmt, posixpath, av[2]) + 1;
47 if ((buf = malloc(bufsize)))
48 snprintf(buf, bufsize, fmt, posixpath, av[2]);
50 char const * fmt = "lyxclient" PROGRAM_SUFFIX " %s '%s' %s";
51 convert_to_full_posix_path(av[2], posixpath);
52 bufsize = snprintf(0, 0, fmt, av[1], posixpath, av[3]) + 1;
53 if ((buf = malloc(bufsize)))
54 snprintf(buf, bufsize, fmt, av[1], posixpath, av[3]);
58 MessageBox(0, "Too long arguments", "lyxeditor", 0);