--- Begin Message ---Hello.This patch adds "source" directive to ifupdown. The syntax is: source filename -- WBR, Andrew--- ifupdown-0.7~alpha3.orig/ifupdown.nw 2007-12-21 16:22:19.000000000 +0200 +++ ifupdown-0.7~alpha3/ifupdown.nw 2010-01-06 13:14:07.346693395 +0200 @@ -1233,14 +1233,20 @@ <<exported symbols>>= interfaces_file *read_interfaces(char *filename); +interfaces_file *read_interfaces_defn(interfaces_file *defn, char *filename); @ <<config functions>>= interfaces_file *read_interfaces(char *filename) { - <<variables local to read interfaces>> interfaces_file *defn; <<allocate defn or [[return NULL]]>> + return read_interfaces_defn(defn, filename); +} + +interfaces_file *read_interfaces_defn(interfaces_file *defn, char *filename) { + <<variables local to read interfaces>> + <<open file or [[return NULL]]>> while (<<we've gotten a line from the file>>) { @@ -1562,6 +1568,9 @@ if (strcmp(firstword, "mapping") == 0) { <<process [[mapping]] line>> currently_processing = MAPPING; +} else if (strcmp(firstword, "source") == 0) { + <<process [[source]] line>> + currently_processing = NONE; } else if (strcmp(firstword, "iface") == 0) { <<process [[iface]] line>> currently_processing = IFACE; @@ -1590,6 +1599,18 @@ } @ +\subsubsection{Source Line} + +To source another file, we just call [[read_interfaces_defn]] again. + +<<process [[source]] line>>= +<<read interfaces recursively into already allocated defn>> +@ + +<<read interfaces recursively into already allocated defn>>= +read_interfaces_defn(defn, rest); +@ + \subsubsection{Mapping Line} Declaring a new mapping is reasonably copewithable --- we need to process --- ifupdown-0.7~alpha3.orig/interfaces.5.pre 2007-12-21 15:30:54.000000000 +0200 +++ ifupdown-0.7~alpha3/interfaces.5.pre 2010-01-06 13:17:32.662869787 +0200 @@ -29,14 +29,16 @@ A line may be extended across multiple lines by making the last character a backslash. .P -The file consists of zero or more "iface", "mapping", "auto" and "allow-" -stanzas. Here is an example. +The file consists of zero or more "iface", "mapping", "auto", "allow-" and +"source" stanzas. Here is an example. .EX auto lo eth0 allow-hotplug eth1 iface lo inet loopback +source interfaces.d/machine\-dependent + mapping eth0 script /usr/local/sbin/map\-scheme map HOME eth0\-home @@ -68,6 +70,10 @@ up eth0 or eth1 if it is listed in an "allow-hotplug" line. Note that "allow-auto" and "auto" are synonyms. .P +Lines beginning with "source" are used to include stanzas from other files, +so configuration can be split into many files. The word "source" is +followed by the path of file to be sourced. +.P Stanzas beginning with the word "mapping" are used to determine how a logical interface name is chosen for a physical interface that is to be brought up. The first line of a mapping stanza consists of the wordsignature.asc
Description: This is a digitally signed message part.
--- End Message ---
signature.asc
Description: This is a digitally signed message part.