Changeset e1c4636 for logging.c


Ignore:
Timestamp:
Jul 9, 2002, 12:04:35 AM (22 years ago)
Author:
Erik Nygren <nygren@mit.edu>
Branches:
master, barnowl_perlaim, debian, owl, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
2c8a07c
Parents:
10b866d
Message:
* Added owl::send_zwrite(command, message) to the perl glue
         to allow for the direct sending of multi-line messages.
         For example:  owl::send_zwrite("-c foo -i bar", "hello");
* Reverted attempted fix for the pagedown problem
         which just made things worse.
* Changed owl_fmtext_print_plain to return an alloc'd string to
         avoid buffer overrun risks.
* Added owl::ztext_stylestrip("...") function to perlglue
          which returns the ztext with formatting stripped out.
* Added colorztext variable which can be used to disable @color()
          strings arriving in messages after it is set.
          (Currently, changing its value won't reformat messages).
* Outgoing zephyr logging now obeys the logpath variable.
* The '~' character in logpath and classlogpath now gets
          replaced with the user's home directory.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • logging.c

    r1aee7d9 re1c4636  
    99void owl_log_outgoing(char *to, char *text) {
    1010  FILE *file;
    11   char filename[MAXPATHLEN];
     11  char filename[MAXPATHLEN], *logpath;
    1212  char *tobuff, *ptr;
    1313
     
    2121  }
    2222
    23   sprintf(filename, "%s/zlog/people/%s", owl_global_get_homedir(&g), tobuff);
     23  /* expand ~ in path names */
     24  logpath = owl_util_substitute(owl_global_get_logpath(&g), "~",
     25                                owl_global_get_homedir(&g));
     26
     27  snprintf(filename, MAXPATHLEN, "%s/%s", logpath, tobuff);
    2428  file=fopen(filename, "a");
    2529  if (!file) {
    2630    owl_function_makemsg("Unable to open file for outgoing logging");
     31    owl_free(logpath);
    2732    return;
    2833  }
     
    3338  fclose(file);
    3439
    35   sprintf(filename, "%s/zlog/people/all", owl_global_get_homedir(&g));
     40  snprintf(filename, MAXPATHLEN, "%s/all", logpath);
     41  owl_free(logpath);
    3642  file=fopen(filename, "a");
    3743  if (!file) {
     
    5056void owl_log_incoming(owl_message *m) {
    5157  FILE *file, *allfile;
    52   char filename[MAXPATHLEN], allfilename[MAXPATHLEN];
     58  char filename[MAXPATHLEN], allfilename[MAXPATHLEN], *logpath;
    5359  char *frombuff, *ptr, *from, *buff, *tmp;
    5460  int len, ch, i, personal;
     
    8692
    8793  for (i=0; i<len; i++) {
    88     if (frombuff[i]<'!' || frombuff[i]>'~') from="weird";
     94    if (frombuff[i]<'!' || frombuff[i]>='~') from="weird";
    8995  }
    9096
     
    95101  }
    96102
    97   /* create the filename */
     103  /* create the filename (expanding ~ in path names) */
    98104  if (personal) {
    99     sprintf(filename, "%s/%s", owl_global_get_logpath(&g), from);
    100     sprintf(allfilename, "%s/all", owl_global_get_logpath(&g));
     105    logpath = owl_util_substitute(owl_global_get_logpath(&g), "~",
     106                                  owl_global_get_homedir(&g));
     107    snprintf(filename, MAXPATHLEN, "%s/%s", logpath, from);
     108    snprintf(allfilename, MAXPATHLEN, "%s/all", logpath);
     109
    101110  } else {
    102     sprintf(filename, "%s/%s", owl_global_get_classlogpath(&g), from);
     111    logpath = owl_util_substitute(owl_global_get_classlogpath(&g), "~",
     112                                owl_global_get_homedir(&g));
     113
     114    snprintf(filename, MAXPATHLEN, "%s/%s", logpath, from);
    103115  }
     116  owl_free(logpath);
    104117 
    105118  file=fopen(filename, "a");
Note: See TracChangeset for help on using the changeset viewer.