Add line number in error output for lineparsing for
authorsteudten <steudten@users.sourceforge.net>
Wed, 7 Nov 2001 00:02:13 +0000 (00:02 +0000)
committersteudten <steudten@users.sourceforge.net>
Wed, 7 Nov 2001 00:02:13 +0000 (00:02 +0000)
actionsfile and configfile.
Special handling for CLF added.

errlog.c
loadcfg.c
loaders.c
loaders.h

index 739736c..58a3415 100644 (file)
--- a/errlog.c
+++ b/errlog.c
@@ -1,4 +1,4 @@
-const char errlog_rcs[] = "$Id: errlog.c,v 1.21 2001/10/25 03:40:47 david__schmidt Exp $";
+const char errlog_rcs[] = "$Id: errlog.c,v 1.22 2001/11/05 23:43:05 steudten Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/errlog.c,v $
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/errlog.c,v $
@@ -33,6 +33,9 @@ const char errlog_rcs[] = "$Id: errlog.c,v 1.21 2001/10/25 03:40:47 david__schmi
  *
  * Revisions   :
  *    $Log: errlog.c,v $
  *
  * Revisions   :
  *    $Log: errlog.c,v $
+ *    Revision 1.22  2001/11/05 23:43:05  steudten
+ *    Add time+date to log files.
+ *
  *    Revision 1.21  2001/10/25 03:40:47  david__schmidt
  *    Change in porting tactics: OS/2's EMX porting layer doesn't allow multiple
  *    threads to call select() simultaneously.  So, it's time to do a real, live,
  *    Revision 1.21  2001/10/25 03:40:47  david__schmidt
  *    Change in porting tactics: OS/2's EMX porting layer doesn't allow multiple
  *    threads to call select() simultaneously.  So, it's time to do a real, live,
@@ -404,6 +407,7 @@ void log_error(int loglevel, char *fmt, ...)
          outc = sprintf(outbuf, "IJB(%ld) Gif-Deanimate: ", this_thread);
          break;
       case LOG_LEVEL_CLF:
          outc = sprintf(outbuf, "IJB(%ld) Gif-Deanimate: ", this_thread);
          break;
       case LOG_LEVEL_CLF:
+        outbuf = outbuf_save;
          outc = 0;
          outbuf[0] = '\0';
          break;
          outc = 0;
          outbuf[0] = '\0';
          break;
index 0c0fae2..2a0ca9b 100644 (file)
--- a/loadcfg.c
+++ b/loadcfg.c
@@ -1,4 +1,4 @@
-const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.25 2001/10/25 03:40:48 david__schmidt Exp $";
+const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.26 2001/11/05 21:41:43 steudten Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/loadcfg.c,v $
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/loadcfg.c,v $
@@ -35,6 +35,15 @@ const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.25 2001/10/25 03:40:48 david__sch
  *
  * Revisions   :
  *    $Log: loadcfg.c,v $
  *
  * Revisions   :
  *    $Log: loadcfg.c,v $
+ *    Revision 1.26  2001/11/05 21:41:43  steudten
+ *    Add changes to be a real daemon just for unix os.
+ *    (change cwd to /, detach from controlling tty, set
+ *    process group and session leader to the own process.
+ *    Add DBG() Macro.
+ *    Add some fatal-error log message for failed malloc().
+ *    Add '-d' if compiled with 'configure --with-debug' to
+ *    enable debug output.
+ *
  *    Revision 1.25  2001/10/25 03:40:48  david__schmidt
  *    Change in porting tactics: OS/2's EMX porting layer doesn't allow multiple
  *    threads to call select() simultaneously.  So, it's time to do a real, live,
  *    Revision 1.25  2001/10/25 03:40:48  david__schmidt
  *    Change in porting tactics: OS/2's EMX porting layer doesn't allow multiple
  *    threads to call select() simultaneously.  So, it's time to do a real, live,
@@ -430,6 +439,7 @@ struct configuration_spec * load_config(void)
    struct configuration_spec * config = NULL;
    struct client_state * fake_csp;
    struct file_list *fs;
    struct configuration_spec * config = NULL;
    struct client_state * fake_csp;
    struct file_list *fs;
+   unsigned long linenum = 0;
 
    DBG(1, ("load_config() entered..\n") );
    if (!check_file_changed(current_configfile, configfile, &fs))
 
    DBG(1, ("load_config() entered..\n") );
    if (!check_file_changed(current_configfile, configfile, &fs))
@@ -487,7 +497,7 @@ struct configuration_spec * load_config(void)
       /* Never get here - LOG_LEVEL_FATAL causes program exit */
    }
 
       /* Never get here - LOG_LEVEL_FATAL causes program exit */
    }
 
-   while (read_config_line(buf, sizeof(buf), configfp) != NULL)
+   while (read_config_line(buf, sizeof(buf), configfp, &linenum) != NULL)
    {
       char cmd[BUFFER_SIZE];
       char arg[BUFFER_SIZE];
    {
       char cmd[BUFFER_SIZE];
       char arg[BUFFER_SIZE];
@@ -569,7 +579,7 @@ struct configuration_spec * load_config(void)
  ****************************************************************************/
          case hash_confdir :
             freez(config->confdir);
  ****************************************************************************/
          case hash_confdir :
             freez(config->confdir);
-            config->confdir = strdup(arg);
+            config->confdir = make_path( NULL, arg);
             continue;
 
 /****************************************************************************
             continue;
 
 /****************************************************************************
@@ -1212,8 +1222,11 @@ struct configuration_spec * load_config(void)
              * error.  To change back to an error, just change log level
              * to LOG_LEVEL_FATAL.
              */
              * error.  To change back to an error, just change log level
              * to LOG_LEVEL_FATAL.
              */
-            log_error(LOG_LEVEL_ERROR, "Unrecognized directive (%luul) in "
+            log_error(LOG_LEVEL_ERROR, "Unrecognized directive '%s' in line %lu in "
+                  "configuration file (%s).",  buf, linenum, configfile);
+            /* log_error(LOG_LEVEL_ERROR, "Unrecognized directive (%luul) in "
                   "configuration file: \"%s\"", hash_string( cmd ), buf);
                   "configuration file: \"%s\"", hash_string( cmd ), buf);
+           */
             config->proxy_args = strsav( config->proxy_args, "<br>\nWARNING: unrecognized directive : ");
             config->proxy_args = strsav( config->proxy_args, buf);
             config->proxy_args = strsav( config->proxy_args, "<br><br>\n");
             config->proxy_args = strsav( config->proxy_args, "<br>\nWARNING: unrecognized directive : ");
             config->proxy_args = strsav( config->proxy_args, buf);
             config->proxy_args = strsav( config->proxy_args, "<br><br>\n");
index dbfdc62..93bea4e 100644 (file)
--- a/loaders.c
+++ b/loaders.c
@@ -1,4 +1,4 @@
-const char loaders_rcs[] = "$Id: loaders.c,v 1.30 2001/10/25 03:40:48 david__schmidt Exp $";
+const char loaders_rcs[] = "$Id: loaders.c,v 1.31 2001/10/26 17:39:01 oes Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/loaders.c,v $
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/loaders.c,v $
@@ -35,6 +35,10 @@ const char loaders_rcs[] = "$Id: loaders.c,v 1.30 2001/10/25 03:40:48 david__sch
  *
  * Revisions   :
  *    $Log: loaders.c,v $
  *
  * Revisions   :
  *    $Log: loaders.c,v $
+ *    Revision 1.31  2001/10/26 17:39:01  oes
+ *    Removed csp->referrer
+ *    Moved ijb_isspace and ijb_tolower to project.h
+ *
  *    Revision 1.30  2001/10/25 03:40:48  david__schmidt
  *    Change in porting tactics: OS/2's EMX porting layer doesn't allow multiple
  *    threads to call select() simultaneously.  So, it's time to do a real, live,
  *    Revision 1.30  2001/10/25 03:40:48  david__schmidt
  *    Change in porting tactics: OS/2's EMX porting layer doesn't allow multiple
  *    threads to call select() simultaneously.  So, it's time to do a real, live,
@@ -604,12 +608,13 @@ int check_file_changed(const struct file_list * current,
  *          1  :  buf = Buffer to use.
  *          2  :  buflen = Size of buffer in bytes.
  *          3  :  fp = File to read from
  *          1  :  buf = Buffer to use.
  *          2  :  buflen = Size of buffer in bytes.
  *          3  :  fp = File to read from
+ *         4  :  linenum = linenumber in file
  *
  * Returns     :  NULL on EOF or error
  *                Otherwise, returns buf.
  *
  *********************************************************************/
  *
  * Returns     :  NULL on EOF or error
  *                Otherwise, returns buf.
  *
  *********************************************************************/
-char *read_config_line(char *buf, int buflen, FILE *fp)
+char *read_config_line(char *buf, int buflen, FILE *fp, unsigned long *linenum)
 {
    char *p;
    char *src;
 {
    char *p;
    char *src;
@@ -621,6 +626,7 @@ char *read_config_line(char *buf, int buflen, FILE *fp)
 
    while (fgets(linebuf, sizeof(linebuf), fp))
    {
 
    while (fgets(linebuf, sizeof(linebuf), fp))
    {
+       (*linenum)++;
       /* Trim off newline */
       if ((p = strpbrk(linebuf, "\r\n")) != NULL)
       {
       /* Trim off newline */
       if ((p = strpbrk(linebuf, "\r\n")) != NULL)
       {
@@ -737,6 +743,7 @@ int load_trustfile(struct client_state *csp)
    char  buf[BUFFER_SIZE], *p, *q;
    int reject, trusted;
    struct file_list *fs;
    char  buf[BUFFER_SIZE], *p, *q;
    int reject, trusted;
    struct file_list *fs;
+   unsigned long linenum = 0;
 
    if (!check_file_changed(current_trustfile, csp->config->trustfile, &fs))
    {
 
    if (!check_file_changed(current_trustfile, csp->config->trustfile, &fs))
    {
@@ -765,7 +772,7 @@ int load_trustfile(struct client_state *csp)
 
    tl = csp->config->trust_list;
 
 
    tl = csp->config->trust_list;
 
-   while (read_config_line(buf, sizeof(buf), fp) != NULL)
+   while (read_config_line(buf, sizeof(buf), fp, &linenum) != NULL)
    {
       trusted = 0;
       reject  = 1;
    {
       trusted = 0;
       reject  = 1;
@@ -903,6 +910,7 @@ int load_re_filterfile(struct client_state *csp)
 
    char  buf[BUFFER_SIZE];
    int error;
 
    char  buf[BUFFER_SIZE];
    int error;
+   unsigned long linenum = 0;
    pcrs_job *dummy;
 
    if (!check_file_changed(current_re_filterfile, csp->config->re_filterfile, &fs))
    pcrs_job *dummy;
 
    if (!check_file_changed(current_re_filterfile, csp->config->re_filterfile, &fs))
@@ -932,7 +940,7 @@ int load_re_filterfile(struct client_state *csp)
    }
 
    /* Read line by line */
    }
 
    /* Read line by line */
-   while (read_config_line(buf, sizeof(buf), fp) != NULL)
+   while (read_config_line(buf, sizeof(buf), fp, &linenum) != NULL)
    {
       enlist( bl->patterns, buf );
 
    {
       enlist( bl->patterns, buf );
 
index c4955e3..1c8fe6d 100644 (file)
--- a/loaders.h
+++ b/loaders.h
@@ -1,6 +1,6 @@
 #ifndef LOADERS_H_INCLUDED
 #define LOADERS_H_INCLUDED
 #ifndef LOADERS_H_INCLUDED
 #define LOADERS_H_INCLUDED
-#define LOADERS_H_VERSION "$Id: loaders.h,v 1.10 2001/09/22 16:36:59 jongfoster Exp $"
+#define LOADERS_H_VERSION "$Id: loaders.h,v 1.11 2001/10/23 21:38:53 jongfoster Exp $"
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/loaders.h,v $
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/loaders.h,v $
@@ -37,6 +37,9 @@
  *
  * Revisions   :
  *    $Log: loaders.h,v $
  *
  * Revisions   :
  *    $Log: loaders.h,v $
+ *    Revision 1.11  2001/10/23 21:38:53  jongfoster
+ *    Adding error-checking to create_url_spec()
+ *
  *    Revision 1.10  2001/09/22 16:36:59  jongfoster
  *    Removing unused parameter fs from read_config_line()
  *
  *    Revision 1.10  2001/09/22 16:36:59  jongfoster
  *    Removing unused parameter fs from read_config_line()
  *
@@ -122,7 +125,7 @@ struct configuration_spec;
 struct url_spec;
 
 extern void sweep(void);
 struct url_spec;
 
 extern void sweep(void);
-extern char *read_config_line(char *buf, int buflen, FILE *fp);
+extern char *read_config_line(char *buf, int buflen, FILE *fp, unsigned long *linenum);
 extern int check_file_changed(const struct file_list * current,
                               const char * filename,
                               struct file_list ** newfl);
 extern int check_file_changed(const struct file_list * current,
                               const char * filename,
                               struct file_list ** newfl);