Added $include var to load configfiles inside of other configfiles
authorNikolas Garofil <garo@dunaldi.garofil.be>
Fri, 31 Jul 2009 13:28:55 +0000 (15:28 +0200)
committerNikolas Garofil <garo@dunaldi.garofil.be>
Fri, 31 Jul 2009 13:28:55 +0000 (15:28 +0200)
ChangeLog
doc/variables.xml
extras/nano/conky.nanorc
extras/vim/syntax/conkyrc.vim
src/conky.c
src/text_object.h

index 00d2c59..554e219 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
 2009-07-31
        * Removed alias config option due to brokenness
+       * Added support for $include
 
 2009-07-29
        * Add icon data_type for xoap weather
index 6efb08e..3f2d625 100644 (file)
     <varlistentry>
         <term>
             <command>
+                <option>include</option>
+            </command>
+            <option>path</option>
+        </term>
+        <listitem>Loads the configfile at path, places the configsettings
+        behind the configsettings in the orginal config and places the
+        vars where the includevar stood.
+        <para /></listitem>
+    </varlistentry>
+    <varlistentry>
+        <term>
+            <command>
                 <option>ioscheduler</option>
             </command>
             <option>disk</option>
index cf883e3..e3d2d2a 100644 (file)
@@ -11,7 +11,7 @@ color green "\<(alignment|append_file|background|border_inner_margin|border_oute
 color yellow "\<(above|below|bottom_left|bottom_right|bottom_middle|desktop|dock|no|none|normal|override|skip_pager|skip_taskbar|sticky|top_left|top_right|top_middle|middle_left|middle_right|undecorated|yes)\>"
 
 ## Variables
-color brightblue "\<(acpiacadapter|acpifan|acpitemp|addr|addrs|adt746xcpu|adt746xfan|alignc|alignr|apcupsd|apcupsd_cable|apcupsd_charge|apcupsd_lastxfer|apcupsd_linev|apcupsd_load|apcupsd_loadbar|apcupsd_loadgauge|apcupsd_loadgraph|apcupsd_model|apcupsd_name|apcupsd_status|apcupsd_temp|apcupsd_timeleft|apcupsd_upsmode|apm_adapter|apm_battery_life|apm_battery_time|audacious_bar|audacious_bitrate|audacious_channels|audacious_filename|audacious_frequency|audacious_length|audacious_length_seconds|audacious_main_volume|audacious_playlist_length|audacious_playlist_position|audacious_position|audacious_position_seconds|audacious_status|audacious_title|battery|battery_bar|battery_percent|battery_short|battery_time|blink|bmpx_album|bmpx_artist|bmpx_bitrate|bmpx_title|bmpx_track|bmpx_uri|buffers|cached|color|color0|color1|color2|color3|color4|color5|color6|color7|color8|color9|combine|conky_build_arch|conky_build_date|conky_version|cpu|cpubar|cpugauge|cpugraph|curl|desktop|desktop_name|desktop_number|disk_protect|diskio|diskio_read|diskio_write|diskiograph|diskiograph_read|diskiograph_write|downspeed|downspeedf|downspeedgraph|draft_mails|else|endif|entropy_avail|entropy_bar|entropy_perc|entropy_poolsize|eval|eve|exec|execbar|execgauge|execgraph|execi|execibar|execigauge|execigraph|execp|execpi|flagged_mails|font|forwarded_mails|freq|freq_g|fs_bar|fs_bar_free|fs_free|fs_free_perc|fs_size|fs_type|fs_used|fs_used_perc|goto|gw_iface|gw_ip|hddtemp|head|hr|hwmon|i2c|i8k_ac_status|i8k_bios|i8k_buttons_status|i8k_cpu_temp|i8k_left_fan_rpm|i8k_left_fan_status|i8k_right_fan_rpm|i8k_right_fan_status|i8k_serial|i8k_version|ibm_brightness|ibm_fan|ibm_temps|ibm_volume|iconv_start|iconv_stop|if_empty|if_existing|if_gw|if_match|if_mixer_mute|if_mounted|if_mpd_playing|if_running|if_smapi_bat_installed|if_up|if_updatenr|if_xmms2_connected|image|imap_messages|imap_unseen|ioscheduler|kernel|laptop_mode|lines|loadavg|loadgraph|lua|lua_bar|lua_gauge|lua_graph|lua_parse|machine|mails|mboxscan|mem|membar|memeasyfree|memfree|memgauge|memgraph|memmax|memperc|mixer|mixerbar|mixerl|mixerlbar|mixerr|mixerrbar|moc_album|moc_artist|moc_bitrate|moc_curtime|moc_file|moc_rate|moc_song|moc_state|moc_timeleft|moc_title|moc_totaltime|monitor|monitor_number|mpd_album|mpd_artist|mpd_bar|mpd_bitrate|mpd_elapsed|mpd_file|mpd_length|mpd_name|mpd_percent|mpd_random|mpd_repeat|mpd_smart|mpd_status|mpd_title|mpd_track|mpd_vol|nameserver|new_mails|nodename|nvidia|obsd_product|obsd_sensors_fan|obsd_sensors_temp|obsd_sensors_volt|obsd_vendor|offset|outlinecolor|pb_battery|platform|pop3_unseen|pop3_used|pre_exec|processes|read_tcp|replied_mails|rss|running_processes|scroll|seen_mails|shadecolor|smapi|smapi_bat_bar|smapi_bat_perc|smapi_bat_power|smapi_bat_temp|sony_fanspeed|stippled_hr|swap|swapbar|swapfree|swapmax|swapperc|sysname|tab|tail|tcp_portmon|template0|template1|template2|template3|template4|template5|template6|template7|template8|template9|texeci|time|to_bytes|top|top_io|top_mem|top_time|totaldown|totalup|trashed_mails|tztime|unflagged_mails|unforwarded_mails|unreplied_mails|unseen_mails|updates|upspeed|upspeedf|upspeedgraph|uptime|uptime_short|user_names|user_number|user_terms|user_times|utime|voffset|voltage_mv|voltage_v|weather|wireless_ap|wireless_bitrate|wireless_essid|wireless_link_bar|wireless_link_qual|wireless_link_qual_max|wireless_link_qual_perc|wireless_mode|words|xmms2_album|xmms2_artist|xmms2_bar|xmms2_bitrate|xmms2_comment|xmms2_date|xmms2_duration|xmms2_elapsed|xmms2_genre|xmms2_id|xmms2_percent|xmms2_playlist|xmms2_size|xmms2_smart|xmms2_status|xmms2_timesplayed|xmms2_title|xmms2_tracknr|xmms2_url)\>"
+color brightblue "\<(acpiacadapter|acpifan|acpitemp|addr|addrs|adt746xcpu|adt746xfan|alignc|alignr|apcupsd|apcupsd_cable|apcupsd_charge|apcupsd_lastxfer|apcupsd_linev|apcupsd_load|apcupsd_loadbar|apcupsd_loadgauge|apcupsd_loadgraph|apcupsd_model|apcupsd_name|apcupsd_status|apcupsd_temp|apcupsd_timeleft|apcupsd_upsmode|apm_adapter|apm_battery_life|apm_battery_time|audacious_bar|audacious_bitrate|audacious_channels|audacious_filename|audacious_frequency|audacious_length|audacious_length_seconds|audacious_main_volume|audacious_playlist_length|audacious_playlist_position|audacious_position|audacious_position_seconds|audacious_status|audacious_title|battery|battery_bar|battery_percent|battery_short|battery_time|blink|bmpx_album|bmpx_artist|bmpx_bitrate|bmpx_title|bmpx_track|bmpx_uri|buffers|cached|color|color0|color1|color2|color3|color4|color5|color6|color7|color8|color9|combine|conky_build_arch|conky_build_date|conky_version|cpu|cpubar|cpugauge|cpugraph|curl|desktop|desktop_name|desktop_number|disk_protect|diskio|diskio_read|diskio_write|diskiograph|diskiograph_read|diskiograph_write|downspeed|downspeedf|downspeedgraph|draft_mails|else|endif|entropy_avail|entropy_bar|entropy_perc|entropy_poolsize|eval|eve|exec|execbar|execgauge|execgraph|execi|execibar|execigauge|execigraph|execp|execpi|flagged_mails|font|forwarded_mails|freq|freq_g|fs_bar|fs_bar_free|fs_free|fs_free_perc|fs_size|fs_type|fs_used|fs_used_perc|goto|gw_iface|gw_ip|hddtemp|head|hr|hwmon|i2c|i8k_ac_status|i8k_bios|i8k_buttons_status|i8k_cpu_temp|i8k_left_fan_rpm|i8k_left_fan_status|i8k_right_fan_rpm|i8k_right_fan_status|i8k_serial|i8k_version|ibm_brightness|ibm_fan|ibm_temps|ibm_volume|iconv_start|iconv_stop|if_empty|if_existing|if_gw|if_match|if_mixer_mute|if_mounted|if_mpd_playing|if_running|if_smapi_bat_installed|if_up|if_updatenr|if_xmms2_connected|image|imap_messages|imap_unseen|include|ioscheduler|kernel|laptop_mode|lines|loadavg|loadgraph|lua|lua_bar|lua_gauge|lua_graph|lua_parse|machine|mails|mboxscan|mem|membar|memeasyfree|memfree|memgauge|memgraph|memmax|memperc|mixer|mixerbar|mixerl|mixerlbar|mixerr|mixerrbar|moc_album|moc_artist|moc_bitrate|moc_curtime|moc_file|moc_rate|moc_song|moc_state|moc_timeleft|moc_title|moc_totaltime|monitor|monitor_number|mpd_album|mpd_artist|mpd_bar|mpd_bitrate|mpd_elapsed|mpd_file|mpd_length|mpd_name|mpd_percent|mpd_random|mpd_repeat|mpd_smart|mpd_status|mpd_title|mpd_track|mpd_vol|nameserver|new_mails|nodename|nvidia|obsd_product|obsd_sensors_fan|obsd_sensors_temp|obsd_sensors_volt|obsd_vendor|offset|outlinecolor|pb_battery|platform|pop3_unseen|pop3_used|pre_exec|processes|read_tcp|replied_mails|rss|running_processes|scroll|seen_mails|shadecolor|smapi|smapi_bat_bar|smapi_bat_perc|smapi_bat_power|smapi_bat_temp|sony_fanspeed|stippled_hr|swap|swapbar|swapfree|swapmax|swapperc|sysname|tab|tail|tcp_portmon|template0|template1|template2|template3|template4|template5|template6|template7|template8|template9|texeci|time|to_bytes|top|top_io|top_mem|top_time|totaldown|totalup|trashed_mails|tztime|unflagged_mails|unforwarded_mails|unreplied_mails|unseen_mails|updates|upspeed|upspeedf|upspeedgraph|uptime|uptime_short|user_names|user_number|user_terms|user_times|utime|voffset|voltage_mv|voltage_v|weather|wireless_ap|wireless_bitrate|wireless_essid|wireless_link_bar|wireless_link_qual|wireless_link_qual_max|wireless_link_qual_perc|wireless_mode|words|xmms2_album|xmms2_artist|xmms2_bar|xmms2_bitrate|xmms2_comment|xmms2_date|xmms2_duration|xmms2_elapsed|xmms2_genre|xmms2_id|xmms2_percent|xmms2_playlist|xmms2_size|xmms2_smart|xmms2_status|xmms2_timesplayed|xmms2_title|xmms2_tracknr|xmms2_url)\>"
 
 color brightblue "\$\{?[0-9A-Z_!@#$*?-]+\}?"
 color cyan "(\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|&|\|)"
index 9b28d40..e0ba646 100644 (file)
@@ -49,7 +49,7 @@ syn region ConkyrcVar start=/\$\w\@=/ end=/\W\@=\|$/ contained contains=ConkyrcV
 
 syn match ConkyrcVarStuff /{\@<=/ms=s contained nextgroup=ConkyrcVarName
 
-syn keyword ConkyrcVarName contained nextgroup=ConkyrcNumber,ConkyrcColour skipwhite acpiacadapter acpifan acpitemp addr addrs adt746xcpu adt746xfan alignc alignr apcupsd apcupsd_cable apcupsd_charge apcupsd_lastxfer apcupsd_linev apcupsd_load apcupsd_loadbar apcupsd_loadgauge apcupsd_loadgraph apcupsd_model apcupsd_name apcupsd_status apcupsd_temp apcupsd_timeleft apcupsd_upsmode apm_adapter apm_battery_life apm_battery_time audacious_bar audacious_bitrate audacious_channels audacious_filename audacious_frequency audacious_length audacious_length_seconds audacious_main_volume audacious_playlist_length audacious_playlist_position audacious_position audacious_position_seconds audacious_status audacious_title battery battery_bar battery_percent battery_short battery_time blink bmpx_album bmpx_artist bmpx_bitrate bmpx_title bmpx_track bmpx_uri buffers cached color color0 color1 color2 color3 color4 color5 color6 color7 color8 color9 combine conky_build_arch conky_build_date conky_version cpu cpubar cpugauge cpugraph curl desktop desktop_name desktop_number disk_protect diskio diskio_read diskio_write diskiograph diskiograph_read diskiograph_write downspeed downspeedf downspeedgraph draft_mails else endif entropy_avail entropy_bar entropy_perc entropy_poolsize eval eve exec execbar execgauge execgraph execi execibar execigauge execigraph execp execpi flagged_mails font forwarded_mails freq freq_g fs_bar fs_bar_free fs_free fs_free_perc fs_size fs_type fs_used fs_used_perc goto gw_iface gw_ip hddtemp head hr hwmon i2c i8k_ac_status i8k_bios i8k_buttons_status i8k_cpu_temp i8k_left_fan_rpm i8k_left_fan_status i8k_right_fan_rpm i8k_right_fan_status i8k_serial i8k_version ibm_brightness ibm_fan ibm_temps ibm_volume iconv_start iconv_stop if_empty if_existing if_gw if_match if_mixer_mute if_mounted if_mpd_playing if_running if_smapi_bat_installed if_up if_updatenr if_xmms2_connected image imap_messages imap_unseen ioscheduler kernel laptop_mode lines loadavg loadgraph lua lua_bar lua_gauge lua_graph lua_parse machine mails mboxscan mem membar memeasyfree memfree memgauge memgraph memmax memperc mixer mixerbar mixerl mixerlbar mixerr mixerrbar moc_album moc_artist moc_bitrate moc_curtime moc_file moc_rate moc_song moc_state moc_timeleft moc_title moc_totaltime monitor monitor_number mpd_album mpd_artist mpd_bar mpd_bitrate mpd_elapsed mpd_file mpd_length mpd_name mpd_percent mpd_random mpd_repeat mpd_smart mpd_status mpd_title mpd_track mpd_vol nameserver new_mails nodename nvidia obsd_product obsd_sensors_fan obsd_sensors_temp obsd_sensors_volt obsd_vendor offset outlinecolor pb_battery platform pop3_unseen pop3_used pre_exec processes read_tcp replied_mails rss running_processes scroll seen_mails shadecolor smapi smapi_bat_bar smapi_bat_perc smapi_bat_power smapi_bat_temp sony_fanspeed stippled_hr swap swapbar swapfree swapmax swapperc sysname tab tail tcp_portmon template0 template1 template2 template3 template4 template5 template6 template7 template8 template9 texeci time to_bytes top top_io top_mem top_time totaldown totalup trashed_mails tztime unflagged_mails unforwarded_mails unreplied_mails unseen_mails updates upspeed upspeedf upspeedgraph uptime uptime_short user_names user_number user_terms user_times utime voffset voltage_mv voltage_v weather wireless_ap wireless_bitrate wireless_essid wireless_link_bar wireless_link_qual wireless_link_qual_max wireless_link_qual_perc wireless_mode words xmms2_album xmms2_artist xmms2_bar xmms2_bitrate xmms2_comment xmms2_date xmms2_duration xmms2_elapsed xmms2_genre xmms2_id xmms2_percent xmms2_playlist xmms2_size xmms2_smart xmms2_status xmms2_timesplayed xmms2_title xmms2_tracknr xmms2_url
+syn keyword ConkyrcVarName contained nextgroup=ConkyrcNumber,ConkyrcColour skipwhite acpiacadapter acpifan acpitemp addr addrs adt746xcpu adt746xfan alignc alignr apcupsd apcupsd_cable apcupsd_charge apcupsd_lastxfer apcupsd_linev apcupsd_load apcupsd_loadbar apcupsd_loadgauge apcupsd_loadgraph apcupsd_model apcupsd_name apcupsd_status apcupsd_temp apcupsd_timeleft apcupsd_upsmode apm_adapter apm_battery_life apm_battery_time audacious_bar audacious_bitrate audacious_channels audacious_filename audacious_frequency audacious_length audacious_length_seconds audacious_main_volume audacious_playlist_length audacious_playlist_position audacious_position audacious_position_seconds audacious_status audacious_title battery battery_bar battery_percent battery_short battery_time blink bmpx_album bmpx_artist bmpx_bitrate bmpx_title bmpx_track bmpx_uri buffers cached color color0 color1 color2 color3 color4 color5 color6 color7 color8 color9 combine conky_build_arch conky_build_date conky_version cpu cpubar cpugauge cpugraph curl desktop desktop_name desktop_number disk_protect diskio diskio_read diskio_write diskiograph diskiograph_read diskiograph_write downspeed downspeedf downspeedgraph draft_mails else endif entropy_avail entropy_bar entropy_perc entropy_poolsize eval eve exec execbar execgauge execgraph execi execibar execigauge execigraph execp execpi flagged_mails font forwarded_mails freq freq_g fs_bar fs_bar_free fs_free fs_free_perc fs_size fs_type fs_used fs_used_perc goto gw_iface gw_ip hddtemp head hr hwmon i2c i8k_ac_status i8k_bios i8k_buttons_status i8k_cpu_temp i8k_left_fan_rpm i8k_left_fan_status i8k_right_fan_rpm i8k_right_fan_status i8k_serial i8k_version ibm_brightness ibm_fan ibm_temps ibm_volume iconv_start iconv_stop if_empty if_existing if_gw if_match if_mixer_mute if_mounted if_mpd_playing if_running if_smapi_bat_installed if_up if_updatenr if_xmms2_connected image imap_messages imap_unseen include ioscheduler kernel laptop_mode lines loadavg loadgraph lua lua_bar lua_gauge lua_graph lua_parse machine mails mboxscan mem membar memeasyfree memfree memgauge memgraph memmax memperc mixer mixerbar mixerl mixerlbar mixerr mixerrbar moc_album moc_artist moc_bitrate moc_curtime moc_file moc_rate moc_song moc_state moc_timeleft moc_title moc_totaltime monitor monitor_number mpd_album mpd_artist mpd_bar mpd_bitrate mpd_elapsed mpd_file mpd_length mpd_name mpd_percent mpd_random mpd_repeat mpd_smart mpd_status mpd_title mpd_track mpd_vol nameserver new_mails nodename nvidia obsd_product obsd_sensors_fan obsd_sensors_temp obsd_sensors_volt obsd_vendor offset outlinecolor pb_battery platform pop3_unseen pop3_used pre_exec processes read_tcp replied_mails rss running_processes scroll seen_mails shadecolor smapi smapi_bat_bar smapi_bat_perc smapi_bat_power smapi_bat_temp sony_fanspeed stippled_hr swap swapbar swapfree swapmax swapperc sysname tab tail tcp_portmon template0 template1 template2 template3 template4 template5 template6 template7 template8 template9 texeci time to_bytes top top_io top_mem top_time totaldown totalup trashed_mails tztime unflagged_mails unforwarded_mails unreplied_mails unseen_mails updates upspeed upspeedf upspeedgraph uptime uptime_short user_names user_number user_terms user_times utime voffset voltage_mv voltage_v weather wireless_ap wireless_bitrate wireless_essid wireless_link_bar wireless_link_qual wireless_link_qual_max wireless_link_qual_perc wireless_mode words xmms2_album xmms2_artist xmms2_bar xmms2_bitrate xmms2_comment xmms2_date xmms2_duration xmms2_elapsed xmms2_genre xmms2_id xmms2_percent xmms2_playlist xmms2_size xmms2_smart xmms2_status xmms2_timesplayed xmms2_title xmms2_tracknr xmms2_url
 
 hi def link ConkyrcComment   Comment
 hi def link ConkyrcSetting   Keyword
index d9df955..0b8d644 100644 (file)
@@ -1126,10 +1126,13 @@ static void free_text_objects(struct text_object *root, int internal)
                                free_moc();
                                break;
 #endif /* MOC */
+                       case OBJ_include:
                        case OBJ_blink:
                        case OBJ_to_bytes:
-                               free_text_objects(obj->sub, 1);
-                               free(obj->sub);
+                               if(obj->sub) {
+                                       free_text_objects(obj->sub, 1);
+                                       free(obj->sub);
+                               }
                                break;
                        case OBJ_scroll:
                                free(data.scroll.text);
@@ -1314,6 +1317,53 @@ static int parse_top_args(const char *s, const char *arg, struct text_object *ob
 
 long current_text_color;
 
+struct conftree {
+       char* string;
+       struct conftree* horz_next;
+       struct conftree* vert_next;
+       struct conftree* back;
+};
+
+//adds newstring to to the tree unless you can already see it when travelling back.
+//if it's possible to attach it then it returns a pointer to the leaf, else it returns NULL
+struct conftree* conftree_add(struct conftree* previous, const char* newstring) {
+       struct conftree* node;
+       struct conftree* node2;
+
+       for(node = previous; node != NULL; node = node->back) {
+               if(strcmp(node->string, newstring) == 0) {
+                       return NULL;
+               }
+       }
+       node = malloc(sizeof(struct conftree));
+       if (previous != NULL) {
+               if(previous->vert_next == NULL) {
+                       previous->vert_next = node;
+               } else {
+                       for(node2 = previous->vert_next; node2->horz_next != NULL; node2 = node2->horz_next ) { }
+                       node2->horz_next = node;
+               }
+       }
+       node->string = strdup(newstring);
+       node->horz_next = NULL;
+       node->vert_next = NULL;
+       node->back = previous;
+       return node;
+}
+
+void conftree_empty(struct conftree* tree) {
+       if(tree) {
+               conftree_empty(tree->horz_next);
+               conftree_empty(tree->vert_next);
+               free(tree->string);
+               free(tree);
+       }
+}
+
+struct conftree *currentconffile;
+
+char load_config_file(const char *);
+
 /* construct_text_object() creates a new text_object */
 static struct text_object *construct_text_object(const char *s,
                const char *arg, long line, void **ifblock_opaque, void *free_at_crash)
@@ -3039,6 +3089,24 @@ static struct text_object *construct_text_object(const char *s,
        END OBJ(entropy_bar, INFO_ENTROPY)
                SIZE_DEFAULTS(bar);
                scan_bar(arg, &obj->a, &obj->b);
+       END OBJ(include, 0)
+               if(arg) {
+                       struct conftree *leaf = conftree_add(currentconffile, arg);
+                       if(leaf) {
+                               if( load_config_file(arg) == TRUE) {
+                                       obj->sub = malloc(sizeof(struct text_object));
+                                       currentconffile = leaf;
+                                       extract_variable_text_internal(obj->sub, global_text);
+                                       currentconffile = leaf->back;
+                               } else {
+                                       ERR("Can't load configfile '%s'.", arg);
+                               }
+                       } else {
+                               ERR("You are trying to load '%s' recursively, I'm only going to load it once to prevent an infinite loop.", arg);
+                       }
+               } else {
+                       CRIT_ERR(obj, free_at_crash, "include needs a argument");
+               }
        END OBJ(blink, 0)
                if(arg) {
                        obj->sub = malloc(sizeof(struct text_object));
@@ -5772,6 +5840,16 @@ static void generate_text_internal(char *p, int p_max_size,
                        }
 #endif /* X11 */
 #endif /* IBM */
+                       OBJ(include) {
+                               if(obj->sub) {
+                                       char buf[max_user_text];
+
+                                       generate_text_internal(buf, max_user_text, *obj->sub, cur);
+                                       snprintf(p, p_max_size, "%s", buf);
+                               } else {
+                                       p[0] = 0;
+                               }
+                       }
                        OBJ(blink) {
                                //blinking like this can look a bit ugly if the chars in the font don't have the same width
                                char buf[max_user_text];
@@ -7581,7 +7659,6 @@ static void main_loop(void)
 #endif /* HAVE_SYS_INOTIFY_H */
 }
 
-static void load_config_file(const char *);
 #ifdef X11
 static void load_config_file_x11(const char *);
 #endif /* X11 */
@@ -7599,6 +7676,7 @@ static void reload_config(void)
 void clean_up(void *memtofree1, void* memtofree2)
 {
        int i;
+       conftree_empty(currentconffile);
        if(memtofree1) {
                free(memtofree1);
        }
@@ -8103,15 +8181,14 @@ static int do_config_step(int *line, FILE *fp, char *buf, char **name, char **va
        return 0;
 }
 
-static void load_config_file(const char *f)
+char load_config_file(const char *f)
 {
        int line = 0;
        FILE *fp;
 
-       set_default_configurations();
        fp = open_config_file(f);
        if (!fp) {
-               return;
+               return FALSE;
        }
        DBGP("reading contents from config file '%s'", f);
 
@@ -8755,7 +8832,7 @@ static void load_config_file(const char *f)
                                CRIT_ERR(NULL, NULL, "no text supplied in configuration; exiting");
                        }
                        global_text_lines = line + 1;
-                       return;
+                       return TRUE;
                }
 #ifdef TCP_PORT_MONITOR
                CONF("max_port_monitor_connections") {
@@ -8853,6 +8930,7 @@ static void load_config_file(const char *f)
        if (!global_text) { // didn't supply any text
                CRIT_ERR(NULL, NULL, "missing text block in configuration; exiting");
        }
+       return TRUE;
 }
 
 #ifdef X11
@@ -9121,7 +9199,9 @@ static const struct option longopts[] = {
 void initialisation(int argc, char **argv) {
        struct sigaction act, oact;
 
+       set_default_configurations();
        load_config_file(current_config);
+       currentconffile = conftree_add(currentconffile, current_config);
 
        /* init specials array */
        if ((specials = calloc(sizeof(struct special_t), max_specials)) == 0) {
index 4efff85..46d62ff 100644 (file)
@@ -405,6 +405,7 @@ enum text_object_type {
 #ifdef HDDTEMP
        OBJ_hddtemp,
 #endif /* HDDTEMP */
+       OBJ_include,
        OBJ_blink,
        OBJ_to_bytes,
        OBJ_scroll,