From c39712dda2b7b0d176f9dbe67e8595624990bee0 Mon Sep 17 00:00:00 2001 From: jesusc Date: Wed, 17 Sep 2003 21:45:01 +0000 Subject: [PATCH] Generate correct file offsets for Unix/Linux and Windows/DOS git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2895 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 5 +++++ support/librarian/sdcclib.c | 14 +++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 91fa0b01..bffa8bb4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-07-06 Jesus Calvino-Fraga + + * support/librarian/sdcclib.c: Generate correct offsets for libraries with + Unix (/n) and DOS (/r/n) line terminations. + 2003-09-17 Erik Petrich * src/SDCCopt.c (cnvFromFloatCast, cnvToFloatCast): fixed diff --git a/support/librarian/sdcclib.c b/support/librarian/sdcclib.c index 1d77bc89..7598431f 100644 --- a/support/librarian/sdcclib.c +++ b/support/librarian/sdcclib.c @@ -188,6 +188,7 @@ void AddRel(void) long newlibpos, indexsize; char symname[MAXLINE+1]; char c; + int IsDOSStyle=0; strcpy(LibNameTmp, LibName); ChangeExtension(LibNameTmp, "__L"); @@ -332,10 +333,17 @@ void AddRel(void) lib=fopen(LibName, "w"); libindex=fopen(IndexName, "r"); - fprintf(lib, "\n\n"); - fprintf(lib, "\n"); + fprintf(lib, "\n\n\n"); + + /*Find out if the \n is expanded to \r\n or not*/ + if(ftell(lib)!=(long)strlen("\n\n\n")) + { + IsDOSStyle=1; + } + + indexsize+=ftell(lib)+strlen("0123456789\n\n\n\n"); + if(IsDOSStyle) indexsize+=4; - indexsize+=ftell(lib)+12+14; fprintf(lib, "%10ld\n", indexsize); while(!feof(libindex)) -- 2.47.2