| 1 |
/* mktexupdmain.c |
| 2 |
|
| 3 |
Copyright 2000, 2019 Akira Kakuto. |
| 4 |
|
| 5 |
This library is free software; you can redistribute it and/or |
| 6 |
modify it under the terms of the GNU Lesser General Public |
| 7 |
License as published by the Free Software Foundation; either |
| 8 |
version 2.1 of the License, or (at your option) any later version. |
| 9 |
|
| 10 |
This library is distributed in the hope that it will be useful, |
| 11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 |
Lesser General Public License for more details. |
| 14 |
|
| 15 |
You should have received a copy of the GNU Lesser General Public License |
| 16 |
along with this library; if not, see <http://www.gnu.org/licenses/>. |
| 17 |
*/ |
| 18 |
|
| 19 |
#include <kpathsea/kpathsea.h> |
| 20 |
#include "mktex.h" |
| 21 |
|
| 22 |
#define TBUF 512 |
| 23 |
|
| 24 |
int main(int argc, char **argv) |
| 25 |
{ |
| 26 |
char dir[TBUF]; |
| 27 |
char file[TBUF]; |
| 28 |
char path[TBUF]; |
| 29 |
size_t i; |
| 30 |
|
| 31 |
kpse_set_program_name (argv[0], NULL); |
| 32 |
if(argc != 3) { |
| 33 |
fprintf(stderr, "%s:: usage: %s DIR FILE\n", argv[0], argv[0]); |
| 34 |
return 1; |
| 35 |
} |
| 36 |
if (strlen(argv[1]) + strlen(argv[2]) > TBUF - 2) { |
| 37 |
fprintf (stderr, "Too long a string.\n"); |
| 38 |
exit (100); |
| 39 |
} |
| 40 |
strcpy(dir, argv[1]); |
| 41 |
strcpy(file, argv[2]); |
| 42 |
normalize (dir); |
| 43 |
i = strlen(dir); |
| 44 |
while(dir[i-1] == '/') |
| 45 |
i--; |
| 46 |
dir[i] = '\0'; |
| 47 |
strcpy(path, dir); |
| 48 |
strcat(path, "/"); |
| 49 |
strcat(path, file); |
| 50 |
mktexupd(path); |
| 51 |
return 0; |
| 52 |
} |