- Fix build on FreeBSD 4.11

Reported by:	pointihat(kris)
Approved by:	maintainer
This commit is contained in:
Andrey Slusar 2006-01-03 20:18:03 +00:00
parent 5019835482
commit 734fca235a
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=152683
2 changed files with 62 additions and 0 deletions

View File

@ -0,0 +1,26 @@
--- cpdetect.c.orig Sat Dec 24 18:32:27 2005
+++ cpdetect.c Sun Jan 1 15:57:17 2006
@@ -64,6 +64,8 @@
struct cpinfo *in_cp = def_cp;
for (cur_cp = cp; cur_cp->cp_name; cur_cp++) {
+ u_char *p;
+ float cur_exp = .0; /* an expectancy of current code page */
memset(tab, 255, sizeof(tab));
memset(freq, 0, sizeof(freq));
@@ -71,13 +73,11 @@
tab[cur_cp->cp_data[i]] = i;
}
- u_char *p = buf + len - 1;
+ p = buf + len - 1;
while ((p - buf) >= 0) {
++freq[tab[*p--]]; /* freq[0xff] is a heap :) */
}
-
- float cur_exp = .0; /* an expectancy of current code page */
for (i = 0; i < cp_size; i++) {
float freq_factor = freq[i] / (float)len;

View File

@ -0,0 +1,36 @@
--- rux.c.orig Sun Dec 25 00:22:01 2005
+++ rux.c Sun Jan 1 15:46:52 2006
@@ -70,9 +70,10 @@
extern int optind;
char *buf = NULL; /* analizing buffer */
+ int flag;
+ int readstdin = 0; /* read from stdin */
o_cp = &codepage[2]; /* sets koi8-r as default outcp */
- int flag;
while ((flag = getopt(argc, argv, "i:o:thegTs:")) != -1) {
switch (flag) {
@@ -133,19 +134,18 @@
}
}
- int readstdin = 0; /* read from stdin */
-
if (argc == 0)
readstdin = 1;
while (1) {
+ int buflen = 0;
+
if (readstdin) {
in = stdin;
} else if ((in = fopen(*argv, "r")) == NULL) {
perror(*argv);
return errno;
}
- int buflen = 0;
if (fdetect) {
buflen = fread(buf, 1, ansize, in);