# HG changeset patch # User David A. Holland # Date 1370963638 14400 # Node ID 91f600e6647b53a782ae29bb1bde697d8c44ca38 # Parent 343af355df1b589f1ca8efce807a79743af150df Allow absolute paths in include files. diff -r 343af355df1b -r 91f600e6647b CHANGES --- a/CHANGES Tue Jun 11 11:00:01 2013 -0400 +++ b/CHANGES Tue Jun 11 11:13:58 2013 -0400 @@ -1,6 +1,7 @@ pending - auto-recognize more builtin PowerPC and mips macros - pass -Wunused (partly from Baptiste Daroussin) + - allow absolute paths in include files (partly from Baptiste Daroussin) release 0.1 (20130610) - first release, works with at least some imake templates diff -r 343af355df1b -r 91f600e6647b files.c --- a/files.c Tue Jun 11 11:00:01 2013 -0400 +++ b/files.c Tue Jun 11 11:13:58 2013 -0400 @@ -340,19 +340,29 @@ assert(place != NULL); - num = incdirarray_num(path); - for (i=0; iname, name); - fd = file_tryopen(file); + if (name[0] == '/') { + fd = file_tryopen(name); if (fd >= 0) { - pf = place_addfile(place, file, id->issystem); - file_read(pf, fd, file, false); - dostrfree(file); + pf = place_addfile(place, name, true); + file_read(pf, fd, name, false); close(fd); return; } - dostrfree(file); + } else { + num = incdirarray_num(path); + for (i=0; iname, name); + fd = file_tryopen(file); + if (fd >= 0) { + pf = place_addfile(place, file, id->issystem); + file_read(pf, fd, file, false); + dostrfree(file); + close(fd); + return; + } + dostrfree(file); + } } complain(place, "Include file %s not found", name); complain_fail();