Subversion Repositories wimsdev

Rev

Rev 8185 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. /*    Copyright (C) 1998-2003 XIAO, Gang of Universite de Nice - Sophia Antipolis
  2.  *
  3.  *  This program is free software; you can redistribute it and/or modify
  4.  *  it under the terms of the GNU General Public License as published by
  5.  *  the Free Software Foundation; either version 2 of the License, or
  6.  *  (at your option) any later version.
  7.  *
  8.  *  This program is distributed in the hope that it will be useful,
  9.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11.  *  GNU General Public License for more details.
  12.  *
  13.  *  You should have received a copy of the GNU General Public License
  14.  *  along with this program; if not, write to the Free Software
  15.  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16.  */
  17.         /* Routines to update home directory. */
  18.  
  19.         /* The following directories will be relocatable. */
  20.         /* Clusterable directories (log, backup) should be avoided. */
  21. char *putlist[]={
  22.     "public_html/modules","public_html/modules/devel",
  23.       "public_html/modules/local",
  24.       "public_html/bases","public_html/bases/doc",
  25.       "other"
  26. };
  27. #define putcnt (sizeof(putlist)/sizeof(putlist[0]))
  28.  
  29. void homedir(void)
  30. {
  31.     char buf[MAX_LINELEN+1], fname[4096];
  32.     char *p1;
  33.     struct stat st;
  34.     int i,t;
  35.     for(i=0;i<putcnt;i++) {
  36.         t=stat(putlist[i],&st); if(t || !S_ISDIR(st.st_mode)) continue;
  37.         snprintf(fname,sizeof(fname),"%s/.wimshome",putlist[i]);
  38.         accessfile(buf,"r","%s",fname);
  39.         p1=find_word_start(buf); *find_word_end(p1)=0;
  40.         if(strcmp(p1,cwd)==0) continue;
  41.         accessfile(cwd,"w","%s",fname);
  42.         chmod(fname,S_IRUSR|S_IWUSR);
  43.     }
  44. }
  45.  
  46.