1: /* Bed -- file names collected together for easy reference and change. */
2: /* $Header: file.c,v 1.1 85/08/22 15:44:30 timo Exp $ */
3:
4: #include "b.h"
5: #include "file.h"
6:
7: /* These are only defaults -- may be changed from environment */
8:
9: #ifdef unix
10: Visible string tmpdir= "/tmp";
11: Visible string homedir= ".";
12: Visible string libdir= "/usr/new/lib/B";
13:
14: Visible string helpfile= "/usr/new/lib/B/Bed_help";
15: Visible string posfile= ".Bed_pos"; /* With $HOME prepended */
16: Visible string buffile= ".Bed_buf"; /* With $HOME prepended */
17: Visible string keyfile= ".Bed_"; /* Some dir prepended, term.type appended */
18: Visible string deftype= "def"; /* Default terminal type affix for keyfile */
19: #endif unix
20:
21: #ifdef IBMPC
22: Visible string tmpdir= "\\";
23: Visible string homedir= "."; /* Can't get home... */
24: Visible string libdir= "\\LIB";
25:
26: Visible string helpfile= "\\LIB\\BED.HLP";
27: Visible string posfile= "BED.POS";
28: Visible string buffile= "BED.BUF";
29: Visible string keyfile= "BED."; /* Some dir prepended, deftype appended */
30: Visible string deftype= "KEY"; /* Default terminal type affix for keyfile */
31: #endif IBMPC
32:
33:
34: Hidden string setdefault(envname, def)
35: string envname;
36: string def; /* 'default' is a C reserved word! */
37: {
38: string envval= getenv(envname);
39: if (envval != NULL && envval[0] != '\0')
40: return envval;
41: return def;
42: }
43:
44:
45: Visible initfile()
46: {
47: static char copysavefile[200];
48: static char saveposfile[200];
49:
50: homedir= setdefault("HOME", homedir);
51: tmpdir= setdefault("TEMPDIR", tmpdir);
52: libdir= setdefault("BED_LIB", libdir);
53:
54: sprintf(copysavefile, "%.150s/%.40s", homedir, buffile);
55: sprintf(saveposfile, "%.150s/%.40s", homedir, posfile);
56:
57: helpfile= setdefault("BED_HELP", helpfile);
58: posfile= setdefault("BED_POS", saveposfile);
59: buffile= setdefault("BED_BUF", copysavefile);
60: }
Defined functions
Defined variables