Changes in owl.c [78667f3:34509d5]
Legend:
- Unmodified
- Added
- Removed
-
owl.c
r78667f3 r34509d5 48 48 #include <termios.h> 49 49 #include <sys/stat.h> 50 #include <locale.h> 50 51 #include "owl.h" 51 52 … … 64 65 owl_global g; 65 66 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 73 67 int main(int argc, char **argv, char **env) 74 68 { … … 80 74 struct sigaction sigact; 81 75 char *configfile, *tty, *perlout, *perlerr, **argvsave, buff[LINE], startupmsg[LINE]; 82 char *confdir;83 76 owl_filter *f; 84 77 owl_style *s; … … 95 88 argvsave=argv; 96 89 configfile=NULL; 97 confdir = NULL;98 90 tty=NULL; 99 91 debug=0; 100 92 initialsubs=1; 93 94 setlocale(LC_ALL, ""); 95 101 96 if (argc>0) { 102 97 argv++; … … 110 105 } else if (!strcmp(argv[0], "-c")) { 111 106 if (argc<2) { 112 113 114 107 fprintf(stderr, "Too few arguments to -c\n"); 108 usage(); 109 exit(1); 115 110 } 116 111 configfile=argv[1]; … … 119 114 } else if (!strcmp(argv[0], "-t")) { 120 115 if (argc<2) { 121 122 123 116 fprintf(stderr, "Too few arguments to -t\n"); 117 usage(); 118 exit(1); 124 119 } 125 120 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];135 121 argv+=2; 136 122 argc-=2; … … 145 131 argc--; 146 132 } 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); 148 134 exit(0); 149 135 } else { … … 177 163 /* screen init */ 178 164 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); 180 168 } else { 181 169 owl_function_debugmsg("startup: leaving TERMINFO as %s from envrionment", getenv("TERMINFO")); … … 207 195 /* owl global init */ 208 196 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); 211 198 owl_function_debugmsg("startup: first available debugging message"); 212 199 owl_global_set_startupargs(&g, argcsave, argvsave); … … 230 217 /* create the owl directory, in case it does not exist */ 231 218 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); 233 220 mkdir(dir, S_IRWXU); 221 owl_free(dir); 234 222 235 223 /* set the tty, either from the command line, or by figuring it out */ … … 275 263 owl_function_debugmsg("startup: creating default filters"); 276 264 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$"); 280 266 owl_list_append_element(owl_global_get_filterlist(&g), f); 281 267 … … 547 533 j=wgetch(typwin); 548 534 if (j==ERR) { 549 usleep(10 000);535 usleep(10); 550 536 } else { 551 537 owl_global_update_lastinputtime(&g); … … 714 700 void usage() 715 701 { 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"); 718 704 fprintf(stderr, " -n don't load zephyr subscriptions\n"); 719 705 fprintf(stderr, " -d enable debugging\n"); 720 706 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"); 722 708 fprintf(stderr, " -h print this help message\n"); 723 709 fprintf(stderr, " -c specify an alternate config file\n"); 724 fprintf(stderr, " -s specify an alternate config dir (default ~/.owl)\n");725 710 fprintf(stderr, " -t set the tty name\n"); 726 711 }
Note: See TracChangeset
for help on using the changeset viewer.