[BACK]Return to log.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / mg

Diff for /src/usr.bin/mg/log.c between version 1.10 and 1.11

version 1.10, 2019/06/28 13:35:02 version 1.11, 2019/07/18 10:50:24
Line 55 
Line 55 
   
 #include "log.h"  #include "log.h"
   
 char    *mglogfiles_create(char *);  static char     *mglogfiles_create(char *);
 int      mglog_lines(PF);  static int       mglog_lines(PF);
 int      mglog_undo(void);  static int       mglog_undo(void);
 int      mglog_window(void);  static int       mglog_window(void);
 int      mglog_key(KEYMAP *map);  static int       mglog_key(KEYMAP *map);
   
 char            *mglogdir;  char            *mglogdir;
 extern char     *mglogpath_lines;  extern char     *mglogpath_lines;
 extern char     *mglogpath_undo;  extern char     *mglogpath_undo;
 extern char     *mglogpath_window;  extern char     *mglogpath_window;
 extern char     *mglogpath_key;  extern char     *mglogpath_key;
   extern char     *mglogpath_interpreter;
 int              mgloglevel;  int              mgloglevel;
   
 int  int
Line 84 
Line 85 
 }  }
   
   
 int  static int
 mglog_key(KEYMAP *map)  mglog_key(KEYMAP *map)
 {  {
         struct stat      sb;          struct stat      sb;
Line 127 
Line 128 
         return (TRUE);          return (TRUE);
 }  }
   
 int  static int
 mglog_window(void)  mglog_window(void)
 {  {
         struct mgwin    *wp;          struct mgwin    *wp;
Line 169 
Line 170 
         return (TRUE);          return (TRUE);
 }  }
   
 int  static int
 mglog_undo(void)  mglog_undo(void)
 {  {
         struct undo_rec *rec;          struct undo_rec *rec;
Line 230 
Line 231 
         return (TRUE);          return (TRUE);
 }  }
   
 int  static int
 mglog_lines(PF funct)  mglog_lines(PF funct)
 {  {
         struct line     *lp;          struct line     *lp;
Line 294 
Line 295 
         return (TRUE);          return (TRUE);
 }  }
   
   /*
    * See what the eval variable code is up to.
    */
   int
   mglog_isvar(
           const char* const argbuf,
           const char* const argp,
           const int         sizof
   )
   {
           FILE            *fd;
   
           fd = fopen(mglogpath_interpreter, "a");
   
           if (fprintf(fd, " argbuf:%s,argp:%s,sizof:%d<\n",
               argbuf,
               argp,
               sizof
               ) == -1) {
                   fclose(fd);
                   return (FALSE);
           }
           fclose(fd);
           return (TRUE);
   }
   
 /*  /*
    * See what the eval line code is up to.
    */
   int
   mglog_execbuf(
           const char* const pre,
           const char* const excbuf,
           const char* const argbuf,
           const char* const argp,
           const int         last,
           const int         inlist,
           const char* const cmdp,
           const char* const p,
           const char* const contbuf
   )
   {
           FILE            *fd;
   
           fd = fopen(mglogpath_interpreter, "a");
   
           if (fprintf(fd, "%sexcbuf:%s,argbuf:%s,argp:%s,last:%d,inlist:%d,"\
               "cmdp:%s,p:%s,contbuf:%s<\n",
               pre,
               excbuf,
               argbuf,
               argp,
               last,
               inlist,
               cmdp,
               p,
               contbuf
               ) == -1) {
                   fclose(fd);
                   return (FALSE);
           }
           fclose(fd);
           return (TRUE);
   }
   
   /*
  * Make sure logging to log files can happen.   * Make sure logging to log files can happen.
  */   */
 int  int
Line 304 
Line 369 
         struct stat      sb;          struct stat      sb;
         mode_t           dir_mode, f_mode, oumask;          mode_t           dir_mode, f_mode, oumask;
         char            *mglogfile_lines, *mglogfile_undo, *mglogfile_window;          char            *mglogfile_lines, *mglogfile_undo, *mglogfile_window;
         char            *mglogfile_key;          char            *mglogfile_key, *mglogfile_interpreter;
   
         mglogdir = "./log/";          mglogdir = "./log/";
         mglogfile_lines = "line.log";          mglogfile_lines = "line.log";
         mglogfile_undo = "undo.log";          mglogfile_undo = "undo.log";
         mglogfile_window = "window.log";          mglogfile_window = "window.log";
         mglogfile_key = "key.log";          mglogfile_key = "key.log";
           mglogfile_interpreter = "interpreter.log";
   
         /*          /*
          * Change mgloglevel for desired level of logging.           * Change mgloglevel for desired level of logging.
Line 340 
Line 406 
         mglogpath_key = mglogfiles_create(mglogfile_key);          mglogpath_key = mglogfiles_create(mglogfile_key);
         if (mglogpath_key == NULL)          if (mglogpath_key == NULL)
                 return (FALSE);                  return (FALSE);
           mglogpath_interpreter = mglogfiles_create(mglogfile_interpreter);
           if (mglogpath_interpreter == NULL)
                   return (FALSE);
   
         return (TRUE);          return (TRUE);
 }  }
   
   
 char *  static char *
 mglogfiles_create(char *mglogfile)  mglogfiles_create(char *mglogfile)
 {  {
         struct stat      sb;          struct stat      sb;
         char             tmp[20], *tmp2;          char             tmp[NFILEN], *tmp2;
         int              fd;          int              fd;
   
         if (strlcpy(tmp, mglogdir, sizeof(tmp)) >          if (strlcpy(tmp, mglogdir, sizeof(tmp)) >
Line 358 
Line 427 
         if (strlcat(tmp, mglogfile, sizeof(tmp)) >          if (strlcat(tmp, mglogfile, sizeof(tmp)) >
             sizeof(tmp))              sizeof(tmp))
                 return (NULL);                  return (NULL);
         if ((tmp2 = strndup(tmp, 20)) == NULL)          if ((tmp2 = strndup(tmp, NFILEN)) == NULL)
                 return (NULL);                  return (NULL);
   
         if(stat(tmp2, &sb))          if(stat(tmp2, &sb))

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11