1 /* Copyright 2007 TeX Users Group
2 Copyright 2014 Clerk Ma
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2 of the License, or
6 (at your option) any later version.
8 This program is distributed in the hope that it will be useful, but
9 WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 // texk/web2c/lib/uexit.c
25 void uexit (int unix_code)
34 final_code = EXIT_SUCCESS;
35 else if (unix_code == 1)
36 final_code = EXIT_FAILURE;
38 final_code = unix_code;
42 show_line("Jump Buffer already used\n", 1);
49 // texk/web2c/lib/zround.c
50 integer zround (double r)
56 else if (r < -2147483647.0)
59 i = (integer) (r + 0.5);
61 i = (integer) (r - 0.5);
65 // texk/web2c/lib/eofeoln.c
66 boolean eoln (FILE * file)
76 (void) ungetc (c, file);
78 return c == '\n' || c == '\r' || c == EOF;
80 // Unixify filename and path (turn \ into /)
81 // --- assumes null terminated
82 char * unixify (char * t)
102 printf("Unixified name: %s\n", t);
103 //sprintf(log_line, "Unixified name: %s\n", t);
104 //show_line(log_line, 0);
110 char * md5_file_name(const char * file_name)
112 md5_state_t md5_ship;
113 md5_byte_t md5_data[1024];
114 md5_byte_t md5_digest[16];
115 static char md5_hex[33];
120 ship_file = fopen(file_name, "rb");
124 while ((md5_len = fread(md5_data, 1, 1024, ship_file)) != 0)
125 md5_append(&md5_ship, md5_data, md5_len);
127 md5_finish(&md5_ship, md5_digest);
131 for (i = 0; i < 16; ++i)
132 sprintf(md5_hex + i * 2, "%02X", md5_digest[i]);
137 char * md5_file(FILE * in_file)
139 md5_state_t md5_ship;
140 md5_byte_t md5_data[1024];
141 md5_byte_t md5_digest[16];
142 static char md5_hex[33];
148 while ((md5_len = fread(md5_data, 1, 1024, in_file)) != 0)
149 md5_append(&md5_ship, md5_data, md5_len);
151 md5_finish(&md5_ship, md5_digest);
155 for (i = 0; i < 16; ++i)
156 sprintf(md5_hex + i * 2, "%02X", md5_digest[i]);