[279] in BarnOwl Developers
[D-O-H] r439 - / trunk/owl
daemon@ATHENA.MIT.EDU (hartmans@MIT.EDU)
Thu Oct 29 18:04:26 2009
Resent-From: nelhage@mit.edu
Resent-To: barnowl-dev-mtg@charon.mit.edu
To: dirty-owl-hackers@mit.edu
From: hartmans@MIT.EDU
Reply-To: dirty-owl-hackers@MIT.EDU
Date: Wed, 1 Nov 2006 00:59:54 -0500 (EST)
Author: hartmans
Date: 2006-11-01 00:59:52 -0500 (Wed, 01 Nov 2006)
New Revision: 439
Modified:
/
trunk/owl/owl.c
trunk/owl/perlconfig.c
trunk/owl/perlwrap.pm
Log:
r1343@luminous: hartmans | 2006-10-31 23:53:05 -0500
Reorder configuration handling so that perlwrap.m is pulled in before .owlconf.
Initialize perl *always* even without owlconf.
Disable -c command line argument
Property changes on:
___________________________________________________________________
Name: svk:merge
- 6aa88b72-b502-0410-8cb4-a5dd0230fb79:/owl-local:1342
+ 6aa88b72-b502-0410-8cb4-a5dd0230fb79:/owl-local:1343
Modified: trunk/owl/owl.c
===================================================================
--- trunk/owl/owl.c 2006-11-01 05:59:43 UTC (rev 438)
+++ trunk/owl/owl.c 2006-11-01 05:59:52 UTC (rev 439)
@@ -107,6 +107,7 @@
exit(1);
}
configfile=argv[1];
+ abort(); /*We dirty hackers have broken -c for now--hartmans*/
argv+=2;
argc-=2;
} else if (!strcmp(argv[0], "-t")) {
@@ -310,7 +311,7 @@
/* read the config file */
owl_function_debugmsg("startup: processing config file");
owl_context_set_readconfig(owl_global_get_context(&g));
- perlerr=owl_perlconfig_readconfig(configfile);
+ perlerr=owl_perlconfig_readconfig();
if (perlerr) {
endwin();
owl_function_error("Error parsing configfile: %s\n", perlerr);
Modified: trunk/owl/perlconfig.c
===================================================================
--- trunk/owl/perlconfig.c 2006-11-01 05:59:43 UTC (rev 438)
+++ trunk/owl/perlconfig.c 2006-11-01 05:59:52 UTC (rev 439)
@@ -161,23 +161,13 @@
return out;
}
-char *owl_perlconfig_readconfig(char *file)
+char *owl_perlconfig_readconfig(void)
{
- int ret, fd;
+ int ret;
PerlInterpreter *p;
- char filename[1024];
- char *embedding[5];
char *err;
- struct stat statbuff;
+ char *args[4] = {"", "-e", "0;", NULL};
- if (file==NULL) {
- sprintf(filename, "%s/%s", getenv("HOME"), ".owlconf");
- } else {
- strcpy(filename, file);
- }
- embedding[0]="";
- embedding[1]=filename;
- embedding[2]=0;
/* create and initialize interpreter */
p=perl_alloc();
@@ -186,29 +176,8 @@
owl_global_set_no_have_config(&g);
- /* Before we let perl have at it, we'll do our own checks on the the
- * file to see if it's present, readnable etc.
- */
- /* Not present, start without it */
- ret=stat(filename, &statbuff);
- if (ret) {
- return(NULL);
- }
-
- /* present, but stat thinks it's unreadable */
- if (! (statbuff.st_mode & S_IREAD)) {
- return(owl_sprintf("%s present but not readable", filename));
- }
-
- /* can we open it? */
- fd=open(filename, O_RDONLY);
- if (fd==-1) {
- return(owl_sprintf("could not open %s for reading", filename));
- }
- close(fd);
-
- ret=perl_parse(p, owl_perl_xs_init, 2, embedding, NULL);
+ ret=perl_parse(p, owl_perl_xs_init, 2, args, NULL);
if (ret || SvTRUE(ERRSV)) {
STRLEN n_a;
err=owl_strdup(SvPV(ERRSV, n_a));
Modified: trunk/owl/perlwrap.pm
===================================================================
--- trunk/owl/perlwrap.pm 2006-11-01 05:59:43 UTC (rev 438)
+++ trunk/owl/perlwrap.pm 2006-11-01 05:59:52 UTC (rev 439)
@@ -17,6 +17,8 @@
use lib($::ENV{'HOME'}."/.owl/lib");
+our $configfile = $::ENV{'HOME'}."/.owlconf";
+
# populate global variable space for legacy owlconf files
sub _format_msg_legacy_wrap {
my ($m) = @_;
@@ -282,4 +284,9 @@
# switch to package main when we're done
package main;
+# load the config file
+if (-r $owl::configfile) {
+do $owl::configfile or die $@;
+}
+
1;