comparison src/octave.cc @ 1744:fc63680a4dc9

[project @ 1996-01-12 12:16:21 by jwe]
author jwe
date Fri, 12 Jan 1996 12:17:51 +0000
parents a02f140ed897
children 3a9462b655f1
comparison
equal deleted inserted replaced
1743:ab8612a09449 1744:fc63680a4dc9
168 { 168 {
169 raw_prog_name = strsave (name); 169 raw_prog_name = strsave (name);
170 char *tmp = strrchr (raw_prog_name, '/'); 170 char *tmp = strrchr (raw_prog_name, '/');
171 prog_name = tmp ? strsave (tmp+1) : strsave (raw_prog_name); 171 prog_name = tmp ? strsave (tmp+1) : strsave (raw_prog_name);
172 172
173 kpse_set_progname (name);
174
175 struct passwd *entry = getpwuid (getuid ()); 173 struct passwd *entry = getpwuid (getuid ());
176 if (entry) 174 if (entry)
177 user_name = strsave (entry->pw_name); 175 user_name = strsave (entry->pw_name);
178 else 176 else
179 user_name = strsave ("I have no name!"); 177 user_name = strsave ("I have no name!");
188 char *hd = getenv ("HOME"); 186 char *hd = getenv ("HOME");
189 if (hd) 187 if (hd)
190 home_directory = strsave (hd); 188 home_directory = strsave (hd);
191 else 189 else
192 home_directory = strsave ("I have no home!"); 190 home_directory = strsave ("I have no home!");
193
194 // This may seem odd, but doing it this way means that we don't have
195 // to modify the kpathsea library...
196
197 char *odb = getenv ("OCTAVE_DB_DIR");
198
199 if (odb)
200 oct_putenv ("TEXMF", odb);
201 else
202 {
203 char *oh = getenv ("OCTAVE_HOME");
204
205 if (oh)
206 {
207 int len = strlen (oh) + 12;
208 char *putenv_val = new char [len];
209 sprintf (putenv_val, "%s/lib/octave", oh);
210 oct_putenv ("TEXMF", putenv_val);
211 }
212 else
213 oct_putenv ("TEXMF", OCTAVE_DATADIR "/octave");
214 }
215 191
216 exec_path = default_exec_path (); 192 exec_path = default_exec_path ();
217 193
218 load_path = default_path (); 194 load_path = default_path ();
219 195
372 348
373 initialize_error_handlers (); 349 initialize_error_handlers ();
374 350
375 initialize_globals (argv[0]); 351 initialize_globals (argv[0]);
376 352
353 initialize_pathsearch (argv[0]);
354
377 int optc; 355 int optc;
378 while ((optc = getopt_long (argc, argv, short_opts, long_opts, 0)) != EOF) 356 while ((optc = getopt_long (argc, argv, short_opts, long_opts, 0)) != EOF)
379 { 357 {
380 switch (optc) 358 switch (optc)
381 { 359 {