]> git.lyx.org Git - lyx.git/blob - development/cygwin/lyxeditor.c
c82a9f22bed7aa6c64210cc5d4c7b2798661b951
[lyx.git] / development / cygwin / lyxeditor.c
1 /**
2  * \file lyxeditor.c
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Enrico Forestieri
7  *
8  * Full author contact details are available in file CREDITS.
9  *
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.
12  */
13
14 #include "config.h"
15 #include <stdio.h>
16 #include <stdlib.h>
17 #include <limits.h>
18 #include <sys/cygwin.h>
19 #include <windows.h>
20
21 int main(int ac, char **av)
22 {
23         char buf[2 * PATH_MAX];
24         char posixpath[PATH_MAX + 1];
25
26         if (ac < 3 || ac > 4) {
27                 MessageBox(0, "Usage: lyxeditor [-g] <file.tex> <lineno>",
28                                 "ERROR: Wrong number of arguments", 0);
29                 return 1;
30         }
31
32         if (ac == 3) {
33                 cygwin_conv_to_full_posix_path(av[1], posixpath);
34                 sprintf(buf, "lyxeditor.sh" PROGRAM_SUFFIX " '%s' %s",
35                                 posixpath, av[2]);
36         } else {
37                 cygwin_conv_to_full_posix_path(av[2], posixpath);
38                 sprintf(buf, "lyxclient" PROGRAM_SUFFIX " %s '%s' %s",
39                                 av[1], posixpath, av[3]);
40         }
41         system(buf);
42         return 0;
43 }