Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • owl.c

    r78667f3 r34509d5  
    4848#include <termios.h>
    4949#include <sys/stat.h>
     50#include <locale.h>
    5051#include "owl.h"
    5152
     
    6465owl_global g;
    6566
    66 char * owl_get_datadir() {
    67     char * datadir = getenv("BARNOWL_DATA_DIR");
    68     if(datadir != NULL)
    69         return strchr(datadir, '=') + 1;
    70     return DATADIR;
    71 }
    72 
    7367int main(int argc, char **argv, char **env)
    7468{
     
    8074  struct sigaction sigact;
    8175  char *configfile, *tty, *perlout, *perlerr, **argvsave, buff[LINE], startupmsg[LINE];
    82   char *confdir;
    8376  owl_filter *f;
    8477  owl_style *s;
     
    9588  argvsave=argv;
    9689  configfile=NULL;
    97   confdir = NULL;
    9890  tty=NULL;
    9991  debug=0;
    10092  initialsubs=1;
     93
     94  setlocale(LC_ALL, "");
     95 
    10196  if (argc>0) {
    10297    argv++;
     
    110105    } else if (!strcmp(argv[0], "-c")) {
    111106      if (argc<2) {
    112         fprintf(stderr, "Too few arguments to -c\n");
    113         usage();
    114         exit(1);
     107        fprintf(stderr, "Too few arguments to -c\n");
     108        usage();
     109        exit(1);
    115110      }
    116111      configfile=argv[1];
     
    119114    } else if (!strcmp(argv[0], "-t")) {
    120115      if (argc<2) {
    121         fprintf(stderr, "Too few arguments to -t\n");
    122         usage();
    123         exit(1);
     116        fprintf(stderr, "Too few arguments to -t\n");
     117        usage();
     118        exit(1);
    124119      }
    125120      tty=argv[1];
    126       argv+=2;
    127       argc-=2;
    128     } else if (!strcmp(argv[0], "-s")){
    129       if (argc<2) {
    130         fprintf(stderr, "Too few arguments to -s\n");
    131         usage();
    132         exit(1);
    133       }
    134       confdir = argv[1];
    135121      argv+=2;
    136122      argc-=2;
     
    145131      argc--;
    146132    } else if (!strcmp(argv[0], "-v")) {
    147       printf("This is barnowl version %s\n", OWL_VERSION_STRING);
     133      printf("This is owl version %s\n", OWL_VERSION_STRING);
    148134      exit(0);
    149135    } else {
     
    177163  /* screen init */
    178164  if (!getenv("TERMINFO")) {
    179     owl_function_debugmsg("startup: Not setting TERMINFO");
     165    sprintf(buff, "TERMINFO=%s", TERMINFO);
     166    putenv(buff);
     167    owl_function_debugmsg("startup: setting TERMINFO to %s", TERMINFO);
    180168  } else {
    181169    owl_function_debugmsg("startup: leaving TERMINFO as %s from envrionment", getenv("TERMINFO"));
     
    207195  /* owl global init */
    208196  owl_global_init(&g);
    209   if (debug) owl_global_set_debug_on(&g);
    210   if (confdir) owl_global_set_confdir(&g, confdir);
     197    if (debug) owl_global_set_debug_on(&g);
    211198  owl_function_debugmsg("startup: first available debugging message");
    212199  owl_global_set_startupargs(&g, argcsave, argvsave);
     
    230217  /* create the owl directory, in case it does not exist */
    231218  owl_function_debugmsg("startup: creating owl directory, if not present");
    232   dir=owl_global_get_confdir(&g);
     219  dir=owl_sprintf("%s/%s", owl_global_get_homedir(&g), OWL_CONFIG_DIR);
    233220  mkdir(dir, S_IRWXU);
     221  owl_free(dir);
    234222
    235223  /* set the tty, either from the command line, or by figuring it out */
     
    275263  owl_function_debugmsg("startup: creating default filters");
    276264  f=owl_malloc(sizeof(owl_filter));
    277   owl_filter_init_fromstring(f, "personal", "isprivate ^true$ and ( not type ^zephyr$"
    278                              " or ( class ^message and"
    279                              " ( instance ^personal$ or instance ^urgent$ ) ) )");
     265  owl_filter_init_fromstring(f, "personal", "isprivate ^true$");
    280266  owl_list_append_element(owl_global_get_filterlist(&g), f);
    281267
     
    547533    j=wgetch(typwin);
    548534    if (j==ERR) {
    549       usleep(10000);
     535      usleep(10);
    550536    } else {
    551537      owl_global_update_lastinputtime(&g);
     
    714700void usage()
    715701{
    716   fprintf(stderr, "Barnowl version %s\n", OWL_VERSION_STRING);
    717   fprintf(stderr, "Usage: barnowl [-n] [-d] [-D] [-v] [-h] [-c <configfile>] [-s <confdir>] [-t <ttyname>]\n");
     702  fprintf(stderr, "Owl version %s\n", OWL_VERSION_STRING);
     703  fprintf(stderr, "Usage: owl [-n] [-d] [-D] [-v] [-h] [-c <configfile>] [-t <ttyname>]\n");
    718704  fprintf(stderr, "  -n      don't load zephyr subscriptions\n");
    719705  fprintf(stderr, "  -d      enable debugging\n");
    720706  fprintf(stderr, "  -D      enable debugging and delete previous debug file\n");
    721   fprintf(stderr, "  -v      print the Barnowl version number and exit\n");
     707  fprintf(stderr, "  -v      print the Owl version number and exit\n");
    722708  fprintf(stderr, "  -h      print this help message\n");
    723709  fprintf(stderr, "  -c      specify an alternate config file\n");
    724   fprintf(stderr, "  -s      specify an alternate config dir (default ~/.owl)\n");
    725710  fprintf(stderr, "  -t      set the tty name\n");
    726711}
Note: See TracChangeset for help on using the changeset viewer.