Disable all code related to libXp
[oweals/cde.git] / cde / programs / dtinfo / DtMmdb / utility / prolatex.c
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $XConsortium: prolatex.c /main/3 1996/06/11 17:38:30 cde-hal $ */
24
25 #include <stdio.h> 
26 #include <string.h> 
27
28 #define BUFSIZ 1000
29
30 int replace();
31
32 main(argc, argv)
33 int argc;
34 char* argv[];
35 {
36    char buf[BUFSIZ];
37
38    while ( fgets(buf, BUFSIZ, stdin) != NULL ) {
39        buf[strlen(buf)-1] = '\0';
40        if ( replace(buf, "\\epsffile{", argv[1]) == 0 )
41           continue;
42        if ( replace(buf, "\\input{", argv[1]) == 0 )
43           continue;
44        else {
45          fputs(buf, stdout);
46          fputs("\n", stdout);
47       }
48    }
49 }
50
51 int replace(buf, pattern, s)
52 char* buf;
53 char* pattern;
54 char* s;
55 {
56    int loc = strlen(pattern);
57    char c = buf[loc];
58    buf[loc] = '\0';
59    if ( strcmp(buf, pattern) == 0 ) {
60      fputs(buf, stdout);
61      /*fputs(getenv("PWD"), stdout);*/
62      fputs(s, stdout);
63      fputs("/", stdout);
64      buf[loc] = c;
65      fputs(buf + loc, stdout);
66      fputs("\n", stdout);
67       return 0;
68    } else  {
69      buf[loc] = c;
70      return -1;
71    }
72 }