WIN32/Unix installation sections
[idzebra-moved-to-github.git] / index / trav.c
index c4768fe..267fedf 100644 (file)
@@ -1,15 +1,28 @@
-/*
- * Copyright (C) 1994-2002, Index Data
- * All rights reserved.
- *
- * $Id: trav.c,v 1.39 2002-04-04 20:50:37 adam Exp $
- */
+/* $Id: trav.c,v 1.41 2002-09-03 11:44:54 adam Exp $
+   Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
+   Index Data Aps
 
+This file is part of the Zebra server.
+
+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
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Zebra; see the file LICENSE.zebra.  If not, write to the
+Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA.
+*/
 
 #include <stdio.h>
 #include <assert.h>
 #include <sys/types.h>
-#include <sys/stat.h>
 #ifdef WIN32
 #include <io.h>
 #define S_ISREG(x) (x & _S_IFREG)
@@ -38,7 +51,7 @@ static void repositoryExtractR (ZebraHandle zh, int deleteFlag, char *rep,
     int i;
     size_t rep_len = strlen (rep);
 
-    e = dir_open (rep, zh->path_reg);
+    e = dir_open (rep, zh->path_reg, rGroup->followLinks);
     if (!e)
         return;
     logf (LOG_LOG, "dir %s", rep);
@@ -113,7 +126,7 @@ static void fileUpdateR (ZebraHandle zh,
     size_t src_len = strlen (src);
 
     sprintf (tmppath, "%s%s", base, src);
-    e_src = dir_open (tmppath, zh->path_reg);
+    e_src = dir_open (tmppath, zh->path_reg, rGroup->followLinks);
     logf (LOG_LOG, "dir %s", tmppath);
 
 #if 0
@@ -259,6 +272,16 @@ static void groupRes (ZebraHandle zh, struct recordGroup *rGroup)
     sprintf (resStr, "%sdatabasePath", gPrefix);
     rGroup->databaseNamePath =
        atoi (res_get_def (zh->res, resStr, "0"));
+
+    rGroup->databaseNamePath =
+       atoi (res_get_def (zh->res, resStr, "0"));
+
+    if (rGroup->followLinks == -1)
+    {
+        sprintf (resStr, "%sfollowLinks", gPrefix);
+        rGroup->followLinks = 
+            atoi (res_get_def (zh->res, resStr, "1"));
+    }
 }
 
 void repositoryShow (ZebraHandle zh)
@@ -315,7 +338,7 @@ static void fileUpdate (ZebraHandle zh,
     else
         *src = '\0';
     strcat (src, path);
-    stat (src, &sbuf);
+    zebra_file_stat (src, &sbuf, rGroup->followLinks);
 
     strcpy (src, path);
     src_len = strlen (src);
@@ -376,7 +399,7 @@ static void repositoryExtract (ZebraHandle zh,
     else
         *src = '\0';
     strcat (src, path);
-    stat (src, &sbuf);
+    zebra_file_stat (src, &sbuf, rGroup->followLinks);
 
     strcpy (src, path);