rjk's `make install' patch.
[sgt/halibut] / main.c
diff --git a/main.c b/main.c
index 61b37f7..847aea8 100644 (file)
--- a/main.c
+++ b/main.c
@@ -263,7 +263,7 @@ int main(int argc, char **argv) {
        in.pushback = NULL;
        in.reportcols = reportcols;
        in.stack = NULL;
-       in.defcharset = locale_charset();
+       in.defcharset = charset_from_locale();
 
        idx = make_index();
 
@@ -288,8 +288,6 @@ int main(int argc, char **argv) {
 
        sfree(in.pushback);
 
-       mark_attr_ends(sourceform);
-
        sfree(infiles);
 
        keywords = get_keywords(sourceform);
@@ -304,6 +302,20 @@ int main(int argc, char **argv) {
 
        build_index(idx);
 
+       /*
+        * Set up attr_First / attr_Last / attr_Always, in the main
+        * document and in the index entries.
+        */
+       for (p = sourceform; p; p = p->next)
+           mark_attr_ends(p->words);
+       {
+           int i;
+           indexentry *entry;
+
+           for (i = 0; (entry = index234(idx->entries, i)) != NULL; i++)
+               mark_attr_ends(entry->text);
+       }
+
        if (debug) {
            index_debug(idx);
            dbg_prtkws(keywords);