Mercurial > hg > xemacs-beta
diff src/postgresql.c @ 771:943eaba38521
[xemacs-hg @ 2002-03-13 08:51:24 by ben]
The big ben-mule-21-5 check-in!
Various files were added and deleted. See CHANGES-ben-mule.
There are still some test suite failures. No crashes, though.
Many of the failures have to do with problems in the test suite itself
rather than in the actual code. I'll be addressing these in the next
day or so -- none of the test suite failures are at all critical.
Meanwhile I'll be trying to address the biggest issues -- i.e. build
or run failures, which will almost certainly happen on various platforms.
All comments should be sent to ben@xemacs.org -- use a Cc: if necessary
when sending to mailing lists. There will be pre- and post- tags,
something like
pre-ben-mule-21-5-merge-in, and
post-ben-mule-21-5-merge-in.
author | ben |
---|---|
date | Wed, 13 Mar 2002 08:54:06 +0000 |
parents | 183866b06e0b |
children | e38acbeb1cae |
line wrap: on
line diff
--- a/src/postgresql.c Fri Mar 08 13:33:14 2002 +0000 +++ b/src/postgresql.c Wed Mar 13 08:54:06 2002 +0000 @@ -106,7 +106,7 @@ #define TO_EXTERNAL_FORMAT(a,from,b,to,c) GET_C_STRING_EXT_DATA_ALLOCA(from,FORMAT_FILENAME,to) #else #ifdef MULE -#define PG_OS_CODING Fget_coding_system(Vpg_coding_system) +#define PG_OS_CODING get_coding_system_for_text_file (Vpg_coding_system, 1) #else #define PG_OS_CODING Qnative #endif @@ -1796,140 +1796,46 @@ /* These initializations should not be done at dump-time. */ void -init_postgresql_from_environment(void) +init_postgresql_from_environment (void) { - char *p; - - if ((p = getenv ("PGHOST"))) - { - VXPGHOST = build_ext_string (p, PG_OS_CODING); - } - else - { - VXPGHOST = Qnil; - } + Intbyte *p; - if ((p = getenv ("PGUSER"))) - { - VXPGUSER = build_ext_string (p, PG_OS_CODING); - } - else - { - VXPGUSER = Qnil; - } +#define FROB(envvar, var) \ + if ((p = egetenv (envvar))) \ + var = build_intstring (p); \ + else \ + var = Qnil - if ((p = getenv ("PGOPTIONS"))) - { - VXPGOPTIONS = build_ext_string (p, PG_OS_CODING); - } - else - { - VXPGOPTIONS = Qnil; - } - - if ((p = getenv ("PGPORT"))) - { - VXPGPORT = make_int (atoi (p)); - } - else + if (initialized) { - VXPGPORT = Qnil; - } - - if ((p = getenv ("PGTTY"))) - { - VXPGTTY = build_ext_string (p, PG_OS_CODING); - } - else - { - VXPGTTY = Qnil; - } - - if ((p = getenv ("PGDATABASE"))) - { - VXPGDATABASE = build_ext_string (p, PG_OS_CODING); - } - else - { - VXPGDATABASE = Qnil; - } + FROB ("PGHOST", VXPGHOST); + FROB ("PGUSER", VXPGUSER); + FROB ("PGOPTIONS", VXPGOPTIONS); - if ((p = getenv ("PGREALM"))) - { - VXPGREALM = build_ext_string (p, PG_OS_CODING); - } - else - { - VXPGREALM = Qnil; - } + if ((p = egetenv ("PGPORT"))) + VXPGPORT = make_int (atoi ((char *) p)); + else + VXPGPORT = Qnil; + FROB ("PGTTY", VXPGTTY); + FROB ("PGDATABASE", VXPGDATABASE); + FROB ("PGREALM", VXPGREALM); #ifdef MULE - /* It's not clear whether this is any use. My intent is to - autodetect the coding system from the database. */ - if ((p = getenv ("PGCLIENTENCODING"))) - { - VXPGCLIENTENCODING = build_ext_string (p, PG_OS_CODING); - } - else - { - VXPGCLIENTENCODING = Qnil; - } + /* It's not clear whether this is any use. My intent is to + autodetect the coding system from the database. */ + FROB ("PGCLIENTENCODING", VXPGCLIENTENCODING); #endif #if !defined(HAVE_POSTGRESQLV7) - if ((p = getenv ("PGAUTHTYPE"))) - { - VXPGAUTHTYPE = build_ext_string (p, PG_OS_CODING); - } - else - { - VXPGAUTHTYPE = Qnil; - } + FROB ("PGAUTHTYPE", VXPGAUTHTYPE); #endif - if ((p = getenv ("PGGEQO"))) - { - VXPGGEQO = build_ext_string (p, PG_OS_CODING); - } - else - { - VXPGGEQO = Qnil; - } - - if ((p = getenv ("PGCOSTINDEX"))) - { - VXPGCOSTINDEX = build_ext_string (p, PG_OS_CODING); - } - else - { - VXPGCOSTINDEX = Qnil; - } - - if ((p = getenv ("PGCOSTHEAP"))) - { - VXPGCOSTHEAP = build_ext_string (p, PG_OS_CODING); - } - else - { - VXPGCOSTHEAP = Qnil; - } - - if ((p = getenv ("PGTZ"))) - { - VXPGTZ = build_ext_string (p, PG_OS_CODING); - } - else - { - VXPGTZ = Qnil; - } - - if ((p = getenv ("PGDATESTYLE"))) - { - VXPGDATESTYLE = build_ext_string (p, PG_OS_CODING); - } - else - { - VXPGDATESTYLE = Qnil; + FROB ("PGGEQO", VXPGGEQO); + FROB ("PGCOSTINDEX", VXPGCOSTINDEX); + FROB ("PGCOSTHEAP", VXPGCOSTHEAP); + FROB ("PGTZ", VXPGTZ); + FROB ("PGDATESTYLE", VXPGDATESTYLE); +#undef FROB } }