All of lore.kernel.org
 help / color / mirror / Atom feed
* #include Code in Dev86 to debug
@ 2006-05-08  5:21 Jody
  0 siblings, 0 replies; only message in thread
From: Jody @ 2006-05-08  5:21 UTC (permalink / raw)
  To: ELKS

I'm releasing an updated clean tarball with DOS line endings stripped 
and the latest patches applied.

For ease in debugging the Dev86 problem here, this is the chunk of code 
in cpp.c from the most recent Dev86 that handles #include files.  We 
can't have random included files being detected as non-existent when 
they are clearly present.  If you're a C programmer, please figure out 
where this is going awry.  It happens for both <xxx> and "xxx" #include 
directives.

I cleaned out the MS-DOS CRLF line endings that I happened upon and the 
problem persists.

cpp.c code in question follows:

--------------

static void
do_proc_include()
{
    int ch, ch1;
    char * p;
    FILE * fd;

    ch = get_onetok(SKIP_SPACE);
    if( ch == '<' || ch == '"' )
    {
       if( ch == '"' ) ch1 = ch; else ch1 = '>';
       p = curword;
       while(p< curword+WORDSIZE-1)
       {
          ch = pgetc();
          if( ch == '\n' ) break;
          if( ch == ch1 )
          {
             *p = '\0';
	    p = strdup(curword);

	    do { ch1 = pgetc(); } while(ch1 == ' ' || ch1 == '\t');
	    unchget(ch1);
             do_proc_tail();

	    saved_files[fi_count] = curfile;
	    saved_fname[fi_count] = c_fname;
	    saved_lines[fi_count] = c_lineno;

             fd = open_include(p, "r", (ch=='"'));
             if( fd ) {
	       fi_count++;
	       curfile = fd;
	    } else
                cerror("Cannot open include file");

             return;
          }
          *p++ = ch;
       }
    }
    cerror("Bad #include command");
    while(ch != '\n') ch = pgetc();
    return;
}

--------------

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-05-08  5:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-08  5:21 #include Code in Dev86 to debug Jody

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.