Re: ncr53c8xx.c dependancy problem

Ion Badulescu (ionut@moisil.wal.rhno.columbia.edu)
Tue, 3 Dec 1996 19:39:24 -0500 (EST)


On Tue, 3 Dec 1996, Kevin Lentin wrote:

> #include <linux/version.h>
> #if LINUX_VERSION_CODE >= LinuxVersionCode(1,3,0)
> #include "linux/blk.h"
> #else
> #include "../block/blk.h"
> #endif
>
> breaks mkdep.c on the second dependancy as we already know but the first is
> wrong too. It should be in <> not in "".

It's not _optimal_ indeed, but it's not wrong per se - "header.h" will
search into the current directory first, then into all the directories
<header.h> would search.

The following patch (which includes my previous patch for mkdep) makes
mkdep's behavior more consistent with cpp's behavior.

NOTE: I'm not encouraging #include's like the one above!

NOTE #2: there is no penalty for the default/most common case.

Ionut

--
  It is better to keep your mouth shut and be thought a fool,
            than to open it and remove all doubt.

--- linux/scripts/mkdep.c.old Sun Dec 1 15:24:50 1996 +++ linux/scripts/mkdep.c Tue Dec 3 19:36:03 1996 @@ -24,8 +24,9 @@ static void handle_include(int type, char *name, int len) { int plen; - struct path_struct *path = path_array+type; + struct path_struct *path; +new_path: if (!type) { if (memcmp(name, "linux/", 6) && memcmp(name, "asm/", 4) && @@ -36,10 +37,16 @@ hasconfig = 1; } + path = path_array + type; plen = path->len; memcpy(path->buffer+plen, name, len); - len += plen; - path->buffer[len] = '\0'; + path->buffer[len + plen] = '\0'; + if (access(path->buffer, F_OK)) + if (type) { + type--; + goto new_path; + } else + return; if (!hasdep) { hasdep = 1;