[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lout 3.17] @SysPrependGraphic symbol out of place
From: |
John Gerard Malecki |
Subject: |
Re: [lout 3.17] @SysPrependGraphic symbol out of place |
Date: |
Tue, 22 May 2001 21:57:56 -0700 |
Efraim Yawitz wrote (2001-05-23T00:25:28-0700):
> I just got this same error when trying to run lout under UNIX on a file
> which had DOS line endings. I don't know why this happens, but it
> happened on even a very simple file. I'm also using 3.17.
Here are some changes I made a long time ago to allow lout-3.24 to
read eps files generated by some adobe program on the pc to be read by
lout on a unix system. I think more than half the code is Uwe's but
anything ugly is my fault.
-good luck
:; diff z12.c /nfs/ish1/tmp/johnm/ARCHIVE/lout-3.24/z12.c
331c331,333
< FULL_LENGTH b, f, dble_fwd, llx, lly, urx, ury; int status, read_status;
---
> FULL_LENGTH b, f, dble_fwd, llx, lly, urx, ury;
> BOOLEAN binary; long offset;
> int status, read_status;
1249c1251,1266
< if( fp == NULL ) status = IG_NOFILE;
---
> if( fp == NULL ) status = IG_NOFILE;
> else
> { unsigned char buff[12]; /* magic, offset, length - 4 bytes each
> */
> fread(buff, sizeof(unsigned char), sizeof(buff), fp);
> if( memcmp((unsigned char *)buff, EPSF_MAGIC, EPSF_MAGIC_SIZE) == 0 )
> { offset = buff[4] | (buff[5]<<8) | (buff[6]<<16) | (buff[7]<<24);
> fseek(fp, offset, SEEK_SET);
> offset += buff[8] | (buff[9]<<8) | (buff[10]<<16) | (buff[11]<<24);
> binary = TRUE;
> }
> else
> { rewind(fp);
> binary = FALSE;
> }
> }
>
1256c1273,1288
< read_status = fscanf(fp, "%[^\n\r]%*c", (char *) buff);
---
> if( binary && (ftell(fp) >= offset) )
> read_status = EOF;
> else
> #if 0
> read_status = fscanf(fp, "%[^\n\r]%*c", (char *) buff);
> #else
> /* we can encounter any of \n, \r or \r\n */
> {
> char c;
> read_status = fscanf(fp, "%[^\n\r]%c", (char *) buff,&c);
> if (read_status == 2 && c == '\r') {
> int c = fgetc(fp);
> if (c != '\n') ungetc(c,fp);
> }
> }
> #endif