The patches below were required to get squidGuard 1.2.0 to build on
Solaris 2.5.1, Tru64 UNIX, and AIX. There are non build-related fixes
as well:
  1. (configure.in, src/config.h.in)
     Add check for <inttypes.h> as Tru64 UNIX needs this.
  2. (src/Makefile.in)
     Create --with-sg-dbhome directory.
  3. (src/sg.h.in)
     Include <config.h> first to determine if <inttypes.h>
     is available.
  4. It is not enough to '#if __STDC__' to check for ANSI C. This
     assumes __STDC__ == 1 which is not always the case. However,
     rather than replacing this with '#ifdef __STDC__', I've
     removed the old K&R prototypes. Any reason not to?
  5. // as a comment is not legal ANSI C. Changed to /* ... */
     where applicable.

-- 
albert chin ([EMAIL PROTECTED])

-- snip snip
*** configure.in.orig   Mon Mar 25 11:20:45 2002
--- configure.in        Mon Mar 25 18:56:12 2002
***************
*** 83,89 ****
  
  dnl Checks for header files.
  AC_HEADER_STDC
! AC_CHECK_HEADERS(db.h regex.h unistd.h)
  
  if test $DB.H = no; then
        echo
--- 83,89 ----
  
  dnl Checks for header files.
  AC_HEADER_STDC
! AC_CHECK_HEADERS(db.h regex.h unistd.h inttypes.h)
  
  if test $DB.H = no; then
        echo
*** src/config.h.in.orig        Mon Mar 25 15:14:02 2002
--- src/config.h.in     Mon Mar 25 18:56:06 2002
***************
*** 18,20 ****
--- 18,23 ----
  
  /* Define if you have dbversion greater than 3.2  */
  #undef DB_VERSION_GT2
+ 
+ /* Define if you have inttypes.h.  */
+ #undef HAVE_INTTYPES_H
*** src/Makefile.in.orig        Mon Mar 25 11:56:18 2002
--- src/Makefile.in     Mon Mar 25 11:57:07 2002
***************
*** 36,41 ****
--- 36,42 ----
  bindir        = $(exec_prefix)/bin
  logdir        = @sg_logdir@
  cfgdir        = @sg_cfgdir@
+ dbdir   = @sg_dbhome@
  infodir       = $(prefix)/info
  
  OBJS  = main.o sgLog.o sgDb.o sgDiv.o y.tab.o lex.yy.o
***************
*** 97,103 ****
  
  install.bin:: squidGuard
        @echo making $@ in `basename \`pwd\``
!       @$(MKDIR) $(bindir) $(logdir) $(cfgdir)
        $(INSTALL_PROGRAM) squidGuard $(bindir)/squidGuard
  
  uninstall.bin::
--- 98,104 ----
  
  install.bin:: squidGuard
        @echo making $@ in `basename \`pwd\``
!       @$(MKDIR) $(bindir) $(logdir) $(dbdir) $(cfgdir)
        $(INSTALL_PROGRAM) squidGuard $(bindir)/squidGuard
  
  uninstall.bin::
*** src/sg.h.in.orig    Mon Mar 25 15:14:55 2002
--- src/sg.h.in Mon Mar 25 15:21:43 2002
***************
*** 16,23 ****
--- 16,30 ----
    (GPL) along with this program.
  */
  
+ #include <config.h>
+ 
  #include <stdio.h>
  #include <unistd.h>
+ 
+ #ifdef HAVE_INTTYPES_H
+ #include <inttypes.h>
+ #endif
+ 
  #include <db.h>
  #include <errno.h>
  #include <netdb.h>
***************
*** 34,42 ****
  #include <sys/types.h>
  #include <sys/stat.h>
  #include <sys/signal.h>
- #include <config.h>
  #include "version.h"
! #if __STDC__
  # include <stdarg.h>
  # define VA_START(a, n) va_start(a, n)
  # ifndef __P
--- 41,49 ----
  #include <sys/types.h>
  #include <sys/stat.h>
  #include <sys/signal.h>
  #include "version.h"
! 
! #ifdef __STDC__
  # include <stdarg.h>
  # define VA_START(a, n) va_start(a, n)
  # ifndef __P
*** src/sg.y.orig       Mon Mar 25 11:41:41 2002
--- src/sg.y    Mon Mar 25 12:21:01 2002
***************
*** 318,329 ****
  
  %%
  
- #if __STDC__
  void sgReadConfig (char *file)
- #else
- void sgReadConfig (file)
-      char *file;
- #endif
  {
    char *defaultFile=DEFAULT_CONFIGFILE;
    lineno = 1;
--- 318,324 ----
***************
*** 347,360 ****
  
  */
  
- #if __STDC__
  void sgLogFile (int block, int anonymous, char *file)
- #else
- void sgLogFile (block, anonymous, file)
-      int block;
-      int anonymous;
-      char *file;
- #endif
  {
    void **v;
    char *name;
--- 342,348 ----
***************
*** 396,407 ****
    }
  }
  
- #if __STDC__
  struct LogFileStat *sgLogFileStat(char *file)
- #else
- struct LogFileStat *sgLogFileStat(file)
-      char *file;
- #endif
  {
    struct LogFileStat *sg;
    struct stat s;
--- 384,390 ----
***************
*** 459,470 ****
  
  */
  
- #if __STDC__
  void sgSource(char *source)
- #else
- void sgSource(source)
-      char *source;
- #endif
  {
    struct Source *sp;
    if(Source != NULL){
--- 442,448 ----
***************
*** 508,519 ****
   }
  }
  
- #if __STDC__
  void sgSourceUser(char *user)
- #else
- void sgSourceUser(user)
-      char *user;
- #endif
  {
    struct Source *sp;
    char *lc;
--- 486,492 ----
***************
*** 529,540 ****
             sizeof(struct UserQuotaInfo));
  }
  
- #if __STDC__
  void sgSourceUserList(char *file)
- #else
- void sgSourceUserList(file)
-      char *file;
- #endif
  {
    char *dbhome = NULL, *f;
    FILE *fd;
--- 502,508 ----
***************
*** 595,608 ****
    fclose(fd);
  }
  
- #if __STDC__
  void sgSourceUserQuota(char *seconds, char *sporadic, char *renew)
- #else
- void sgSourceUserQuota(seconds, sporadic, renew)
-      char *file;
-      char *sporadic;
-      char *renew;
- #endif
  {
    int s;
    struct UserQuota *uq;
--- 563,569 ----
***************
*** 624,635 ****
  }
  
  
- #if __STDC__
  void sgSourceDomain(char *domain)
- #else
- void sgSourceDomain(domain)
-      char *domain;
- #endif
  {
    struct Source *sp;
    sp = lastSource;
--- 585,591 ----
***************
*** 641,653 ****
    sgDbUpdate(sp->domainDb,domain, NULL, 0);
  }
  
- #if __STDC__
  void sgSourceTime(char *name, int within)
- #else
- void sgSourceTime(name, within)
-      char *name;
-      int within;
- #endif
  {
    struct Time *time = NULL;
    struct Source *sp;
--- 597,603 ----
***************
*** 660,671 ****
    sp->time = time;
  }
  
- #if __STDC__
  struct Source *sgSourceFindName(char *name)
- #else
- struct Source *sgSourceFindName(name)
-      char *name;
- #endif
  {
    struct Source *p;
    for(p=Source; p != NULL; p = p->next){
--- 610,616 ----
***************
*** 675,686 ****
    return NULL;
  }
  
- #if __STDC__
  void sgSourceIpList(char *file)
- #else
- void sgSourceIpList(file)
-      char *file;
- #endif
  {
    char *dbhome = NULL, *f;
    FILE *fd;
--- 620,626 ----
***************
*** 752,767 ****
  
   */
  
- #if __STDC__
  struct Source *sgFindSource (struct Source *bsrc, 
                             char *net, char *ident, char *domain)
- #else
- struct Source *sgFindSource (bsrc, net, ident, domain)
-      struct Source *bsrc;
-      char *net;
-      char *ident;
-      char *domain;
- #endif
  {
    struct Source *s;
    struct Ip *ip;
--- 692,699 ----
***************
*** 811,825 ****
          if(s->userquota.seconds != 0){
            struct UserQuotaInfo uq;
            time_t t = time(NULL) + globalDebugTimeDelta;
!           //sgLogError("status %d time %d lasttime %d consumed %d", 
userquota->status, userquota->time, userquota->last, userquota->consumed);
!           //sgLogError("renew %d seconds %d", s->userquota.renew, 
s->userquota.seconds);
!           if(userquota->status == 0){ //first time
              userquota->status = 1;
              userquota->time = t;
              userquota->last = t;
!             //sgLogError("user %s first time %d", ident, userquota->time);
            } else if(userquota->status == 1){
!             //sgLogError("user %s other time %d %d",ident,userquota->time,t);
              if(s->userquota.sporadic > 0){
                if(t - userquota->last  < s->userquota.sporadic){
                  userquota->consumed += t - userquota->last;
--- 743,757 ----
          if(s->userquota.seconds != 0){
            struct UserQuotaInfo uq;
            time_t t = time(NULL) + globalDebugTimeDelta;
!           /*sgLogError("status %d time %d lasttime %d consumed %d", 
userquota->status, userquota->time, userquota->last, userquota->consumed);*/
!           /*sgLogError("renew %d seconds %d", s->userquota.renew, 
s->userquota.seconds);*/
!           if(userquota->status == 0){ /*first time*/
              userquota->status = 1;
              userquota->time = t;
              userquota->last = t;
!             /*sgLogError("user %s first time %d", ident, userquota->time);*/
            } else if(userquota->status == 1){
!             /*sgLogError("user %s other time %d %d",ident,userquota->time,t);*/
              if(s->userquota.sporadic > 0){
                if(t - userquota->last  < s->userquota.sporadic){
                  userquota->consumed += t - userquota->last;
***************
*** 826,845 ****
                  userquota->time = t;
                }
                if(userquota->consumed > s->userquota.seconds){
!                 userquota->status = 2; // block this user, time is up
                  unblockeduser = 0;
                }
                userquota->last = t;
!               //sgLogError("user %s consumed %d %d",ident,userquota->consumed, 
userquota->last);
              } else if(userquota->time + s->userquota.seconds < t){
                sgLogError("time is up user %s blocket", ident);
!               userquota->status = 2; // block this user, time is up
                unblockeduser = 0;
              } 
            } else {
!             //sgLogError("user %s blocket %d %d %d %d", ident, userquota->status, 
userquota->time, t, (userquota->time + s->userquota.renew) - t);
!             if(userquota->time + s->userquota.renew < t){ // new chance
!               //sgLogError("user %s new chance", ident);
                unblockeduser = 1;
                userquota->status = 1;
                userquota->time = t;
--- 758,777 ----
                  userquota->time = t;
                }
                if(userquota->consumed > s->userquota.seconds){
!                 userquota->status = 2; /* block this user, time is up */
                  unblockeduser = 0;
                }
                userquota->last = t;
!               /*sgLogError("user %s consumed %d %d",ident,userquota->consumed, 
userquota->last);*/
              } else if(userquota->time + s->userquota.seconds < t){
                sgLogError("time is up user %s blocket", ident);
!               userquota->status = 2; /* block this user, time is up */
                unblockeduser = 0;
              } 
            } else {
!             /*sgLogError("user %s blocket %d %d %d %d", ident, userquota->status, 
userquota->time, t, (userquota->time + s->userquota.renew) - t);*/
!             if(userquota->time + s->userquota.renew < t){ /* new chance */
!               /*sgLogError("user %s new chance", ident);*/
                unblockeduser = 1;
                userquota->status = 1;
                userquota->time = t;
***************
*** 878,889 ****
  
  /*destination block funtions */
  
- #if __STDC__
  void sgDest(char *dest)
- #else
- void sgDest(dest)
-      char *dest;
- #endif
  {
    struct Destination *sp;
    if(Dest != NULL){
--- 810,816 ----
***************
*** 926,937 ****
   }
  }
  
- #if __STDC__
  void sgDestDomainList(char *domainlist)
- #else
- void sgDestDomainList(domainlist)
-      char *domainlist;
- #endif
  {
    struct Destination *sp;
    char *dbhome = NULL, *dl = domainlist, *name;
--- 853,859 ----
***************
*** 970,981 ****
    }
  }
  
- #if __STDC__
  void sgDestUrlList(char *urllist)
- #else
- void sgDestUrlList(urllist)
-      char *urllist;
- #endif
  {
    struct Destination *sp;
    char *dbhome = NULL, *dl = urllist, *name;
--- 892,898 ----
***************
*** 1014,1026 ****
    }
  }
  
- #if __STDC__
  void sgDestExpressionList(char *exprlist, char *chcase)
- #else
- void sgDestExpressionList(exprlist, chcase)
-      char *exprlist;
-      char *chcase;
- #endif
  {
    FILE *fp;
    char buf[MAX_BUF],errbuf[256];
--- 931,937 ----
***************
*** 1081,1092 ****
    fclose(fp);
  }
  
- #if __STDC__
  void sgDestRedirect(char *value)
- #else
- void sgDestRedirect(value)
-      char *value;
- #endif
  {
    struct Destination *sp;
    sp = lastDest;
--- 992,998 ----
***************
*** 1105,1117 ****
    sp->rewrite = rewrite;
  }
  
- #if __STDC__
  int sgRegExpMatch(struct sgRegExp *regexp, char *str)
- #else
- int sgRegExpMatch(regexp, str)
-      struct sgRegExp *regexp;
-      char *str;
- #endif
  {
    struct sgRegExp *rp;
    static char errbuf[256];
--- 1011,1017 ----
***************
*** 1128,1140 ****
    return 0;
  }
  
- #if __STDC__
  void sgDestTime(char *name, int within)
- #else
- void sgDestTime(name, within)
-      char *name;
-      int within;
- #endif
  {
    struct Time *time = NULL;
    struct Destination *sp;
--- 1028,1034 ----
***************
*** 1147,1158 ****
    sp->time = time;
  }
  
- #if __STDC__
  struct Destination *sgDestFindName(char *name)
- #else
- struct Destination *sgDestFindName(name)
-      char *name;
- #endif
  {
    struct Destination *p;
    for(p=Dest; p != NULL; p = p->next){
--- 1041,1047 ----
***************
*** 1167,1179 ****
  */
  
  
- #if __STDC__
  void sgSetting(char *name, char *value)
- #else
- void sgSetting(name, value)
-      char *name;
-      char *value;
- #endif
  {
    struct Setting *sp;
    if(Setting != NULL){
--- 1056,1062 ----
***************
*** 1198,1209 ****
    }
  }
  
- #if __STDC__
  struct Setting *sgSettingFindName(char *name)
- #else
- struct Setting *sgSettingFindName(name)
-      char *name;
- #endif
  {
    struct Setting *p;
    for(p=Setting; p != NULL; p = p->next){
--- 1081,1087 ----
***************
*** 1214,1225 ****
  }
  
  
- #if __STDC__
  char *sgSettingGetValue(char *name)
- #else
- char *sgSettingGetValue(name)
-      char *name;
- #endif
  {
    struct Setting *p;
    p = sgSettingFindName(name);
--- 1092,1098 ----
***************
*** 1235,1246 ****
  
   */
  
- #if __STDC__
  void sgRewrite(char *rewrite)
- #else
- void sgRewrite(rewrite)
-      char *rewrite;
- #endif
  {
    struct sgRewrite *rew;
    if(Rewrite != NULL){
--- 1108,1114 ----
***************
*** 1266,1278 ****
    }
  }
  
- #if __STDC__
  void sgRewriteTime(char *name, int within)
- #else
- void sgRewriteTime(name, within)
-      char *name;
-      int within;
- #endif
  {
    struct Time *time = NULL;
    struct sgRewrite *sp;
--- 1134,1140 ----
***************
*** 1285,1296 ****
    sp->time = time;
  }
  
- #if __STDC__
  void sgRewriteSubstitute (char *string)
- #else
- void sgRewriteSubstitute (string)
-      char *string;
- #endif
  {
    char *pattern, *subst = NULL , *p;
    int flags = REG_EXTENDED ;
--- 1147,1153 ----
***************
*** 1337,1349 ****
    lastRewriteRegExec = regexp;
  }
  
- #if __STDC__
  char *sgRewriteExpression(struct sgRewrite *rewrite, char *subst)
- #else
- char *sgRewriteExpression(rewrite, subst)
-      struct sgRewrite *rewrite;
-      char *subst;
- #endif
  {
    char *result = NULL;
    result = sgRegExpSubst(rewrite->rewrite, subst);
--- 1194,1200 ----
***************
*** 1350,1361 ****
    return result;
  }
  
- #if __STDC__
  struct sgRewrite *sgRewriteFindName(char *name)
- #else
- struct sgRewrite *sgRewriteFindName(name)
-      char *name;
- #endif
  {
    struct sgRewrite *p;
    for(p=Rewrite; p != NULL; p = p->next){
--- 1201,1207 ----
***************
*** 1371,1382 ****
    Time functions
  */
  
- #if __STDC__
  void sgTime(char *name)
- #else
- void sgTime(name)
-      char *name;
- #endif
  {
    struct Time *t;
    if(Time != NULL){
--- 1217,1223 ----
***************
*** 1400,1410 ****
    }
  }
  
- #if __STDC__
  void sgTimeElementInit()
- #else
- void sgTimeElementInit()
- #endif
  {
    struct TimeElement *te;
    te = (struct TimeElement *) sgCalloc(1,sizeof(struct TimeElement));
--- 1241,1247 ----
***************
*** 1416,1426 ****
    lastTimeElement = te;
  }
  
- #if __STDC__
  void sgTimeElementEnd ()
- #else
- void sgTimeElementEnd ()
- #endif
  {
    time_switch = 0;
    date_switch = 0;
--- 1253,1259 ----
***************
*** 1434,1446 ****
      lastTimeElement->to = 1439; /* set time to 23:59 */
  }
  
- #if __STDC__
  void sgTimeElementAdd (char *element, char type) 
- #else
- void sgTimeElementAdd (element, type) 
-      char *element;
-      char type;
- #endif
  {
    struct TimeElement *te;
    char *p;
--- 1267,1273 ----
***************
*** 1566,1577 ****
  }
  
  
- #if __STDC__
  struct Time *sgTimeFindName(char *name)
- #else
- struct Time *sgTimeFindName(name)
-      char *name;
- #endif
  {
    struct Time *p;
    for(p=Time; p != NULL; p = p->next){
--- 1393,1399 ----
***************
*** 1581,1602 ****
    return NULL;
  }
  
- #if __STDC__
  int sgTimeCmp(const int *a, const int *b)
- #else
- int sgTimeCmp(a, b)
-      const int *a;
-      const int *b;
- #endif
  {
    return *a - *b;
  }
  
- #if __STDC__
  void sgTimeElementSortEvents()
- #else
- void sgTimeElementSortEvents()
- #endif
  {
   struct Time *p;
   struct TimeElement *te;
--- 1403,1414 ----
***************
*** 1628,1638 ****
   }
  }
  
- #if __STDC__
  int sgTimeNextEvent()
- #else
- int sgTimeNextEvent()
- #endif
  {
    time_t t;
    struct tm *lt;
--- 1440,1446 ----
***************
*** 1681,1693 ****
    return 0;
  }
  
- #if __STDC__
  int sgTimeCheck(struct tm *lt, time_t t)
- #else
- int sgTimeCheck(lt, t)
-      struct tm *lt;
-      time_t t;
- #endif
  {
    struct Time *sg;
    struct TimeElement *te;
--- 1489,1495 ----
***************
*** 1834,1847 ****
  */
  
  
- #if __STDC__
  void sgSetIpType(int type, char *file, int line)
- #else
- void sgSetIpType(type, file, line)
-      int type;
-      char *file;
-      int line;
- #endif
  {
    struct Ip *ip = sgIpLast(lastSource),*nip;
    char *p;
--- 1636,1642 ----
***************
*** 1887,1898 ****
    ip->next = nip ;
  }
  
- #if __STDC__
  void sgIp(char *name)
- #else
- void sgIp(name)
-      char *name;
- #endif
  {
    struct Ip *ip;
    unsigned long *op;
--- 1682,1688 ----
***************
*** 1916,1927 ****
    }
  }
  
- #if __STDC__
  struct Ip *sgIpLast(struct Source *s)
- #else
- struct Ip *sgIpLast(s)
-      struct Source *s;
- #endif
  {
    struct Ip *ip,*ret = NULL ;
    for(ip=s->ip; ip != NULL; ip = ip->next)
--- 1706,1712 ----
***************
*** 1934,1947 ****
  */
  
  
- #if __STDC__
  void sgAcl(char *name, char *value, int within)
- #else
- void sgAcl(name, value, within)
-      char *name;
-      char *value;
-      int within;
- #endif
  {
    struct Acl *acl;
    struct Source *source = NULL;
--- 1719,1725 ----
***************
*** 2002,2015 ****
    }
  }
  
- #if __STDC__
  void sgAclSetValue (char *what, char *value, int allowed) 
- #else
- void sgAclSetValue (what, value, allowed)
-      char *what;
-      char *value;
-      int allowed;
- #endif
  {
    struct Destination *dest = NULL;
    struct sgRewrite *rewrite = NULL;
--- 1780,1786 ----
***************
*** 2068,2079 ****
    }
  }
  
- #if __STDC__
  struct Acl *sgAclFindName(char *name)
- #else
- struct Acl *sgAclFindName(name)
-      char *name;
- #endif
  {
    struct Acl *p;
    for(p=Acl; p != NULL; p = p->next){
--- 1839,1845 ----
***************
*** 2084,2095 ****
  }
  
  
- #if __STDC__
  struct Acl *sgAclCheckSource(struct Source *source)
- #else
- struct Acl *sgAclCheckSource(source)
-      struct Source *source;
- #endif
  {
    struct Acl *acl = defaultAcl;
    int found = 0;
--- 1850,1856 ----
***************
*** 2114,2127 ****
    return acl;
  }
  
- #if __STDC__
  char *sgAclAccess(struct Source *src, struct Acl *acl, struct SquidInfo *req)
- #else
- char *sgAclAccess(src, acl, req)
-      struct Source *src;
-      struct Acl *acl;
-      struct SquidInfo *req;
- #endif
  {
    int access = 1,result;
    char *redirect = NULL, *dbdata = NULL, *p;
--- 1875,1881 ----
***************
*** 2233,2254 ****
    return redirect;
  }
  
- #if __STDC__
  void yyerror(char *s)
- #else
- void yyerror(s)
-      char *s;
- #endif
  {
    sgLogFatalError("%s in configfile %s line %d",s,configFile,lineno);
  }
  
  
- #if __STDC__
  int yywrap()
- #else
- int yywrap()
- #endif
  {
    return 1;
  }
--- 1987,1999 ----
*** src/sgDb.c.orig     Mon Mar 25 11:37:09 2002
--- src/sgDb.c  Mon Mar 25 18:25:11 2002
***************
*** 24,36 ****
  extern char *globalCreateDb;
  extern char **globalArgv;
  
- #if __STDC__
  void sgDbInit(struct sgDb *Db, char *file)
- #else
- void sgDbInit(Db, file)
-      struct sgDb *Db;
-      char *file;
- #endif
  {
    struct stat st;
    char *dbfile = NULL;
--- 24,30 ----
***************
*** 63,71 ****
      Db->dbinfo.bt_compare = domainCompare;
  #else
    /*since we are not sharing the db's, we does not nedd dbenv */
!   //ret = db_init(Db->dbhome, &Db->dbenv);
!   //if(ret)
!   //  sgLogFatalError("error db_init %s", strerror(ret)); 
    Db->entries = 1;
    Db->dbenv = NULL;
    if ((ret = db_create(&Db->dbp, Db->dbenv, 0)) != 0){
--- 57,65 ----
      Db->dbinfo.bt_compare = domainCompare;
  #else
    /*since we are not sharing the db's, we does not nedd dbenv */
!   /*ret = db_init(Db->dbhome, &Db->dbenv);*/
!   /*if(ret)*/
!   /*  sgLogFatalError("error db_init %s", strerror(ret));  */
    Db->entries = 1;
    Db->dbenv = NULL;
    if ((ret = db_create(&Db->dbp, Db->dbenv, 0)) != 0){
***************
*** 72,79 ****
      sgLogFatalError("Error db_create: %s", strerror(ret));
    }
    /*please feel free to experiment with cacesize and pagesize */
!   //Db->dbp->set_cachesize(Db->dbp, 0, 1024 * 1024,0);
!   //Db->dbp->set_pagesize(Db->dbp, 1024);
    if(Db->type == SGDBTYPE_DOMAINLIST)
      Db->dbp->set_bt_compare(Db->dbp, (void *) domainCompare);
  #endif
--- 66,73 ----
      sgLogFatalError("Error db_create: %s", strerror(ret));
    }
    /*please feel free to experiment with cacesize and pagesize */
!   /*Db->dbp->set_cachesize(Db->dbp, 0, 1024 * 1024,0);*/
!   /*Db->dbp->set_pagesize(Db->dbp, 1024);*/
    if(Db->type == SGDBTYPE_DOMAINLIST)
      Db->dbp->set_bt_compare(Db->dbp, (void *) domainCompare);
  #endif
***************
*** 118,124 ****
        db_appexit(Db->dbenv);
        Db->dbenv = NULL;
  #else
!       //Db->dbenv->close(Db->dbenv, 0);
        Db->dbenv = NULL;
  #endif
        }
--- 112,118 ----
        db_appexit(Db->dbenv);
        Db->dbenv = NULL;
  #else
!       /*Db->dbenv->close(Db->dbenv, 0);*/
        Db->dbenv = NULL;
  #endif
        }
***************
*** 131,137 ****
        db_appexit(Db->dbenv);
        Db->dbenv = NULL;
  #else
!       //Db->dbenv->close(Db->dbenv, 0);
        Db->dbenv = NULL;
  #endif
        } else {
--- 125,131 ----
        db_appexit(Db->dbenv);
        Db->dbenv = NULL;
  #else
!       /*Db->dbenv->close(Db->dbenv, 0);*/
        Db->dbenv = NULL;
  #endif
        } else {
***************
*** 157,170 ****
    }
  }
  
- #if __STDC__
  int defined(struct sgDb *Db, char *request, char **retval)
- #else
- int defined(Db, request, retval)
-      struct sgDb *Db;
-      char *request;
-      char **retval;
- #endif
  {
    int errno, result = 0 ;
    u_int32_t   dbmethod = DB_SET_RANGE;
--- 151,157 ----
***************
*** 265,278 ****
    return result;
  }
  
- #if __STDC__
  void sgDbLoadTextFile(struct sgDb *Db, char *filename, int update)
- #else
- void sgDbLoadTextFile(Db, filename, update)
-      struct sgDb *Db;
-      char *filename;
-      int update;
- #endif
  {
    DB *dbp ;
    char *key,*val,*p,line[MAX_BUF];
--- 252,258 ----
***************
*** 361,375 ****
  }
  
  
- #if __STDC__
  void sgDbUpdate(struct sgDb *Db, char *key, char *value, size_t len)
- #else
- void sgDbUpdate(Db, key)
-      struct sgDb *Db;
-      char *key;
-      char *value;
-      int len;
- #endif
  {
    DB *dbp ;
    u_int32_t flags = DB_NOOVERWRITE;
--- 341,347 ----
***************
*** 403,414 ****
  }
  
  #if DB_VERSION_MAJOR == 2
- #if __STDC__
  DB_ENV *db_init(char *dbhome)
- #else
- DB_ENV *db_init(dbhome)
-      char *dbhome;
- #endif
  {
    DB_ENV *dbenv;
    
--- 375,381 ----
***************
*** 423,435 ****
  }
  /* db version greater than 2 */
  #else
- #if __STDC__
  int db_init(char *dbhome, DB_ENV **dbenvp)
- #else
- int db_init(dbhome, dbenvp)
-      char *dbhome;
-      DB_ENV **dbenvp;
- #endif
  {
    int ret;
    DB_ENV *dbenv;
--- 390,396 ----
***************
*** 436,442 ****
  
    if((ret = db_env_create(&dbenv, 0)) != 0)
      return ret;
!   //dbenv->set_errfile(dbenv, stderr);  
    
    if((ret = dbenv->open(dbenv, dbhome, DB_CREATE | DB_INIT_MPOOL, 0)) == 0) {
      *dbenvp = dbenv;
--- 397,403 ----
  
    if((ret = db_env_create(&dbenv, 0)) != 0)
      return ret;
!   /*dbenv->set_errfile(dbenv, stderr);*/
    
    if((ret = dbenv->open(dbenv, dbhome, DB_CREATE | DB_INIT_MPOOL, 0)) == 0) {
      *dbenvp = dbenv;
***************
*** 453,465 ****
  */
  
  #if DB_VERSION_MAJOR == 2
- #if __STDC__
  int domainCompare (const DBT *a, const DBT *b)
- #else
- int domainCompare (a, b)
-      DBT *a;
-      DBT *b;
- #endif
  {
    register const char *a1 , *b1;
    register char ac1 , bc1;
--- 414,420 ----
***************
*** 481,494 ****
    return ac1 - bc1;
  }
  #else
- #if __STDC__
  int domainCompare (const DB *dbp, const DBT *a, const DBT *b)
- #else
- int domainCompare (dbp, a, b)
-      DB  *dbp;
-      DBT *a;
-      DBT *b;
- #endif
  {
    register const char *a1 , *b1;
    register char ac1 , bc1;
--- 436,442 ----
*** src/sgDiv.c.orig    Mon Mar 25 11:37:04 2002
--- src/sgDiv.c Mon Mar 25 12:17:50 2002
***************
*** 30,41 ****
  extern struct Source *Source ;
  extern struct Destination *Dest ;
  
- #if __STDC__
  void sgHandlerSigHUP(int signal)
- #else
- void sgHandlerSigHUP(signal)
-      int signal;
- #endif
  {
    sig_hup = 1;
  }
--- 30,36 ----
***************
*** 68,79 ****
    fprintf(stderr,"error execve: %d\n",errno);
  }
  
- #if __STDC__
  void sgAlarm(int signal)
- #else
- void sgAlarm(signal)
-      int signal;
- #endif
  {
    sig_alrm = 1;
    sgTimeNextEvent();
--- 63,69 ----
***************
*** 84,96 ****
    URL ip-address/fqdn ident method
  */
  
- #if __STDC__
  int parseLine(char *line, struct SquidInfo *s)
- #else
- int parseLine(line, s)
-      char *line;
-      struct SquidInfo *s;
- #endif
  {
    char *p, *d = NULL, *a = NULL, *e = NULL, *o, *field;
    char *up, *upp;
--- 74,80 ----
***************
*** 186,192 ****
      *(s->domain + (e - o)) = '\0';
      *(s->surl + (e - p)) = '\0';
    }
!   //strcpy(s->surl,s->domain);
    if(strspn(s->domain,".0123456789") == strlen(s->domain))
      s->dot = 1;
    if(d != NULL)
--- 170,176 ----
      *(s->domain + (e - o)) = '\0';
      *(s->surl + (e - p)) = '\0';
    }
!   /*strcpy(s->surl,s->domain);*/
    if(strspn(s->domain,".0123456789") == strlen(s->domain))
      s->dot = 1;
    if(d != NULL)
***************
*** 226,237 ****
    return 1;
  }
  
- #if __STDC__
  char *sgStripUrl (char *url)
- #else
- char *sgStripUrl (url)
-      char *url;
- #endif
  {
    static char newurl[MAX_BUF];
    char *p, *d = NULL, *a = NULL, *e = NULL;
--- 210,216 ----
***************
*** 260,271 ****
     so www.abc.xyz.dom/index.html -> xyz.dom/index.html
  */
  
- #if __STDC__
  char *sgSkipHostPart (char *domain)
- #else
- char *sgSkipHostPart (domain)
-      char *domain;
- #endif
  {
    char *p = domain , *d1 = NULL, *d2 = NULL, *path = NULL;
    if((path = (char *) strchr(p,'/')) == NULL)
--- 239,245 ----
***************
*** 282,293 ****
    return domain;
  }
  
- #if __STDC__
  void *sgMalloc(size_t elsize)
- #else
- void *sgMalloc(elsize)
-      size_t elsize;
- #endif
  {
    void *p;
    if((p=(void *) malloc(elsize)) == NULL){
--- 256,262 ----
***************
*** 297,309 ****
    return (void *) p;
  }
  
- #if __STDC__
  void *sgCalloc(size_t nelem, size_t elsize)
- #else
- void *sgCalloc(nelem, elsize)
-      size_t nelem;
-      size_t elsize;
- #endif
  {
    void *p;
    if((p=(void *) calloc(nelem,elsize)) == NULL){
--- 266,272 ----
***************
*** 314,326 ****
  }
  
  
- #if __STDC__
  void *sgRealloc(void *ptr, size_t elsize)
- #else
- void *sgRealloc(ptr, elsize)
-      void *ptr;
-      size_t elsize;
- #endif
  {
    void *p;
    if((p=(void *) realloc(ptr,elsize)) == NULL){
--- 277,283 ----
***************
*** 330,341 ****
    return (void *) p;
  }
  
- #if __STDC__
  void sgFree(void *ptr)
- #else
- void sgFree(ptr)
-      void *ptr;
- #endif
  {
    free(ptr);
  }
--- 287,293 ----
***************
*** 347,358 ****
  
  */
  
- #if __STDC__
  ulong *sgConvDot (char *dot)
- #else
- ulong *sgConvDot (dot)
-      char *dot;
- #endif
  {
    static unsigned long ipaddr = 0;
    int octet;
--- 299,305 ----
***************
*** 386,398 ****
   Reverses cmp of strings
  */
  
- #if __STDC__
  int sgStrRcmp(char *a, char *b)
- #else
- int sgStrRcmp(a, b)
-      char *a;
-      char *b;
- #endif
  {
    char *a1 = (char *) strchr(a,'\0');
    char *b1 = (char *) strchr(b,'\0');
--- 333,339 ----
***************
*** 410,423 ****
    return *a1 - *b1;
  }
  
- #if __STDC__
  int sgStrRncmp(char *a, char *b, int blen)
- #else
- int sgStrRncmp(a, b, blen)
-      char *a;
-      char *b;
-      int blen;
- #endif
  {
    char *a1 = (char *) strchr(a,'\0');
    char *b1 = (char *) strchr(b,'\0');
--- 351,357 ----
***************
*** 444,456 ****
   */
  
  
- #if __STDC__
  int sgDomStrRcmp(char *p1, char *p2)
- #else
- int sgDomStrRncmp(p1, p2)
-      char *p1;
-      char *p2;
- #endif
  {
    char *p11 = (char *) strchr(p1,'\0');
    char *p22 = (char *) strchr(p2,'\0');
--- 378,384 ----
***************
*** 470,482 ****
    
  */
  
- #if __STDC__
  struct sgRegExp *sgNewPatternBuffer(char *pattern, int flags)
- #else
- struct sgRegExp *sgNewPatternBuffer(pattern, flags)
-      char *pattern;
-      int flags;
- #endif
  {
    regex_t *compiled = (regex_t *) sgCalloc(1,sizeof(regex_t));
    struct sgRegExp *regexp;
--- 398,404 ----
***************
*** 491,503 ****
    return regexp;
  }
  
- #if __STDC__
  char *sgRegExpSubst(struct sgRegExp *regexp, char *pattern)
- #else
- char *sgRegExpSubst(regexp, pattern)
-      struct sgRegExp *regexp;
-      char *pattern;
- #endif
  {
    struct sgRegExp *re;
    regmatch_t pm;
--- 413,419 ----
***************
*** 541,558 ****
   */
  
  
- #if __STDC__
  char *sgParseRedirect(char *redirect,
                      struct SquidInfo *req,
                      struct Acl *acl, 
                      struct AclDest *aclpass)
- #else
- char *sgParseRedirect(redirect, req, acl, aclpass)
-      char *redirect;
-      struct SquidInfo *req;
-      struct Acl *acl;
-      struct AclDest *aclpass;
- #endif
  {
    static char buf[MAX_BUF + MAX_BUF];
    char *p = redirect, *q = NULL, *t = NULL;
--- 457,466 ----
***************
*** 659,669 ****
    return q;
  }
  
- #if __STDC__
  void sgEmergency ()
- #else
- void sgEmergency ()
- #endif
  {
    char buf[MAX_BUF];
    sgLogError("going into emergency mode");
--- 567,573 ----
***************
*** 680,691 ****
  converts yyyy.mm.ddTHH:MM:SS to seconds since EPOC
   */
  
- #if __STDC__
  time_t iso2sec(char *date)
- #else
- time_t iso2sec(date)
-      char *date;
- #endif
  {
    struct tm *t;
    int y,m,d,H,M,S;
--- 584,590 ----
***************
*** 710,721 ****
  converts yyyy.mm.dd to seconds since EPOC
   */
  
- #if __STDC__
  time_t date2sec(char *date)
- #else
- time_t date2sec(date)
-      char *date;
- #endif
  {
    struct tm *t;
    int y,m,d;
--- 609,615 ----
***************
*** 731,742 ****
    return (time_t) mktime(t);
  }
  
- #if __STDC__
  char *niso(time_t t)
- #else
- char *niso(t)
-      time_t t;
- #endif
  {
    static char buf[20];
    time_t tp;
--- 625,631 ----
***************
*** 751,761 ****
    return buf;
  }
  
- #if __STDC__
  struct UserQuotaInfo *setuserquota()
- #else
- struct UserQuotaInfo *setuserquota()
- #endif
  {
    static struct UserQuotaInfo uq;
    uq.status = 0; 
--- 640,646 ----
*** src/sgLog.c.orig    Mon Mar 25 11:37:01 2002
--- src/sgLog.c Mon Mar 25 15:15:06 2002
***************
*** 23,33 ****
  extern char *globalLogDir; /* from main.c */
  extern struct LogFileStat *globalErrorLog;
  
- #if __STDC__
  void sgSetGlobalErrorLogFile()
- #else
- void sgSetGlobalErrorLogFile()
- #endif
  {
    static char file[MAX_BUF];
    if(globalDebug)
--- 23,29 ----
***************
*** 41,54 ****
    globalErrorLog = sgLogFileStat(file);
  }
  
- #if __STDC__
  void sgLog(struct LogFileStat *log, char *format, ...)
- #else
- void sgLog(log, format, va_alist)
-      struct LogFileStat *log;
-      char *format;
-      va_dcl
- #endif
  {
    FILE *fd;
    char *date = NULL;
--- 37,43 ----
***************
*** 76,88 ****
    }
  }
  
- #if __STDC__
  void sgLogError(char *format, ...)
- #else
- void sgLogError(format, va_alist)
-      char *format;
-      va_dcl
- #endif
  {
    char msg[MAX_BUF];
    va_list ap;
--- 65,71 ----
***************
*** 93,105 ****
    sgLog(globalErrorLog,"%s",msg);
  }
  
- #if __STDC__
  void sgLogFatalError(char *format, ...)
- #else
- void sgLogFatalError(format, va_alist)
-      char *format;
-      va_dcl
- #endif
  {
    char msg[MAX_BUF];
    va_list ap;
--- 76,82 ----
***************
*** 112,131 ****
  }
  
  
- #if __STDC__
  void sgLogRequest(struct LogFile *log,
                  struct SquidInfo *req,
                  struct Acl *acl, 
                  struct AclDest *aclpass,
                  struct sgRewrite *rewrite)
- #else
- void sgLogRequest(log, req, acl, aclpass, rewrite)
-      struct LogFile *log;
-      struct SquidInfo *req;
-      struct Acl *acl;
-      struct AclDest *aclpass;
-      struct sgRewrite *rewrite;
- #endif
  {
    char *ident = req->ident;
    char *srcDomain = req->srcDomain;
--- 89,99 ----
*** src/main.c.orig     Mon Mar 25 11:36:19 2002
--- src/main.c  Mon Mar 25 15:15:03 2002
***************
*** 67,82 ****
  char *globalLogDir = NULL;
  
  
- #if __STDC__
  int main(int    argc,
           char   **argv,
         char   **envp)
- #else
- int main(argc, argv)
-      int argc;
-      char *argv[],
-      char *envp[];
- #endif
  {
    int ch;
    struct SquidInfo squidInfo;
--- 67,75 ----
***************
*** 235,245 ****
    exit(0);
  }
  
- #if __STDC__
  void usage()
- #else
- void usage()
- #endif
  {
    fprintf(stderr, 
          "Usage: squidGuard [-u] [-C block] [-t time] [-c file] [-v] [-d]\n");
--- 228,234 ----

Reply via email to