projects
/
pspp-builds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
por-file-reader: Tolerate short lines when detecting portable files.
[pspp-builds.git]
/
src
/
data
/
por-file-reader.c
diff --git
a/src/data/por-file-reader.c
b/src/data/por-file-reader.c
index 52c0cc8edab5dca9a59b142d83cf9c3466489a3e..823361b09593aacc7eb33dae402f1fb31e798bdf 100644
(file)
--- a/
src/data/por-file-reader.c
+++ b/
src/data/por-file-reader.c
@@
-1,5
+1,5
@@
/* PSPP - a program for statistical analysis.
/* PSPP - a program for statistical analysis.
- Copyright (C) 1997-9, 2000, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1997-9, 2000, 2006
, 2009
Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@
-867,17
+867,30
@@
pfm_detect (FILE *file)
{
unsigned char header[464];
char trans[256];
{
unsigned char header[464];
char trans[256];
- int cooked_cnt, raw_cnt;
+ int cooked_cnt, raw_cnt
, line_len
;
int i;
cooked_cnt = raw_cnt = 0;
int i;
cooked_cnt = raw_cnt = 0;
+ line_len = 0;
while (cooked_cnt < sizeof header)
{
int c = getc (file);
if (c == EOF || raw_cnt++ > 512)
return false;
while (cooked_cnt < sizeof header)
{
int c = getc (file);
if (c == EOF || raw_cnt++ > 512)
return false;
- else if (c != '\n' && c != '\r')
- header[cooked_cnt++] = c;
+ else if (c == '\n')
+ {
+ while (line_len < 80 && cooked_cnt < sizeof header)
+ {
+ header[cooked_cnt++] = ' ';
+ line_len++;
+ }
+ line_len = 0;
+ }
+ else if (c != '\r')
+ {
+ header[cooked_cnt++] = c;
+ line_len++;
+ }
}
memset (trans, 0, 256);
}
memset (trans, 0, 256);