Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • owl.c

    r34509d5 r78667f3  
    4848#include <termios.h>
    4949#include <sys/stat.h>
    50 #include <locale.h>
    5150#include "owl.h"
    5251
     
    6564owl_global g;
    6665
     66char * owl_get_datadir() {
     67    char * datadir = getenv("BARNOWL_DATA_DIR");
     68    if(datadir != NULL)
     69        return strchr(datadir, '=') + 1;
     70    return DATADIR;
     71}
     72
    6773int main(int argc, char **argv, char **env)
    6874{
     
    7480  struct sigaction sigact;
    7581  char *configfile, *tty, *perlout, *perlerr, **argvsave, buff[LINE], startupmsg[LINE];
     82  char *confdir;
    7683  owl_filter *f;
    7784  owl_style *s;
     
    8895  argvsave=argv;
    8996  configfile=NULL;
     97  confdir = NULL;
    9098  tty=NULL;
    9199  debug=0;
    92100  initialsubs=1;
    93 
    94   setlocale(LC_ALL, "");
    95  
    96101  if (argc>0) {
    97102    argv++;
     
    105110    } else if (!strcmp(argv[0], "-c")) {
    106111      if (argc<2) {
    107         fprintf(stderr, "Too few arguments to -c\n");
    108         usage();
    109         exit(1);
     112        fprintf(stderr, "Too few arguments to -c\n");
     113        usage();
     114        exit(1);
    110115      }
    111116      configfile=argv[1];
     
    114119    } else if (!strcmp(argv[0], "-t")) {
    115120      if (argc<2) {
    116         fprintf(stderr, "Too few arguments to -t\n");
    117         usage();
    118         exit(1);
     121        fprintf(stderr, "Too few arguments to -t\n");
     122        usage();
     123        exit(1);
    119124      }
    120125      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];
    121135      argv+=2;
    122136      argc-=2;
     
    131145      argc--;
    132146    } else if (!strcmp(argv[0], "-v")) {
    133       printf("This is owl version %s\n", OWL_VERSION_STRING);
     147      printf("This is barnowl version %s\n", OWL_VERSION_STRING);
    134148      exit(0);
    135149    } else {
     
    163177  /* screen init */
    164178  if (!getenv("TERMINFO")) {
    165     sprintf(buff, "TERMINFO=%s", TERMINFO);
    166     putenv(buff);
    167     owl_function_debugmsg("startup: setting TERMINFO to %s", TERMINFO);
     179    owl_function_debugmsg("startup: Not setting TERMINFO");
    168180  } else {
    169181    owl_function_debugmsg("startup: leaving TERMINFO as %s from envrionment", getenv("TERMINFO"));
     
    195207  /* owl global init */
    196208  owl_global_init(&g);
    197     if (debug) owl_global_set_debug_on(&g);
     209  if (debug) owl_global_set_debug_on(&g);
     210  if (confdir) owl_global_set_confdir(&g, confdir);
    198211  owl_function_debugmsg("startup: first available debugging message");
    199212  owl_global_set_startupargs(&g, argcsave, argvsave);
     
    217230  /* create the owl directory, in case it does not exist */
    218231  owl_function_debugmsg("startup: creating owl directory, if not present");
    219   dir=owl_sprintf("%s/%s", owl_global_get_homedir(&g), OWL_CONFIG_DIR);
     232  dir=owl_global_get_confdir(&g);
    220233  mkdir(dir, S_IRWXU);
    221   owl_free(dir);
    222234
    223235  /* set the tty, either from the command line, or by figuring it out */
     
    263275  owl_function_debugmsg("startup: creating default filters");
    264276  f=owl_malloc(sizeof(owl_filter));
    265   owl_filter_init_fromstring(f, "personal", "isprivate ^true$");
     277  owl_filter_init_fromstring(f, "personal", "isprivate ^true$ and ( not type ^zephyr$"
     278                             " or ( class ^message and"
     279                             " ( instance ^personal$ or instance ^urgent$ ) ) )");
    266280  owl_list_append_element(owl_global_get_filterlist(&g), f);
    267281
     
    533547    j=wgetch(typwin);
    534548    if (j==ERR) {
    535       usleep(10);
     549      usleep(10000);
    536550    } else {
    537551      owl_global_update_lastinputtime(&g);
     
    700714void usage()
    701715{
    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");
     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");
    704718  fprintf(stderr, "  -n      don't load zephyr subscriptions\n");
    705719  fprintf(stderr, "  -d      enable debugging\n");
    706720  fprintf(stderr, "  -D      enable debugging and delete previous debug file\n");
    707   fprintf(stderr, "  -v      print the Owl version number and exit\n");
     721  fprintf(stderr, "  -v      print the Barnowl version number and exit\n");
    708722  fprintf(stderr, "  -h      print this help message\n");
    709723  fprintf(stderr, "  -c      specify an alternate config file\n");
     724  fprintf(stderr, "  -s      specify an alternate config dir (default ~/.owl)\n");
    710725  fprintf(stderr, "  -t      set the tty name\n");
    711726}
Note: See TracChangeset for help on using the changeset viewer.