Break long lines in debian/control
[idzebra-moved-to-github.git] / dict / scan.c
index 27621f4..76032f3 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the Zebra server.
-   Copyright (C) 1994-2010 Index Data
+   Copyright (C) 1994-2011 Index Data
 
    Zebra is free software; you can redistribute it and/or modify it under
    the terms of the GNU General Public License as published by the Free
@@ -18,6 +18,9 @@
 */
 
 
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
@@ -196,10 +199,27 @@ void dict_scan_r(Dict dict, Dict_ptr ptr, int pos, Dict_char *str,
                        scan_direction(dict, subptr, pos+1, str, -1, 
                                        after, client, userfunc, 1);
                 }
-               else if (subptr)
+               else
                 {
-                    dict_scan_r(dict, subptr, pos+1, str, before, after,
-                                client, userfunc);
+                    if (subptr)
+                        dict_scan_r(dict, subptr, pos+1, str, before, after,
+                                    client, userfunc);
+                   if (info[sizeof(Dict_ptr)+sizeof(Dict_char)])
+                    {
+                        if (*before)
+                        {
+                            str[pos+1] = DICT_EOS;
+                            if ((*userfunc)((char*) str,
+                                            info+sizeof(Dict_ptr)+
+                                            sizeof(Dict_char),
+                                            - *before, client))
+                            {
+                                *before = 0;
+                            }
+                            else
+                                --(*before);
+                        }
+                    }
                 }
                 break;
             }