From c1ef6f543d6c1d7163fd07015b1e8807ca1458ae Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Wed, 23 Apr 2025 06:28:48 +0300 Subject: DOS: the ini file is called TECO.INI and is located in the binary's directory You can also `set VTECO=...` to the directory of TECO.INI (usually the installation directory). This is helpful if the location of the binary's directory is unreliable. --- teco.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/teco.c b/teco.c index 9e92e4b..a980739 100644 --- a/teco.c +++ b/teco.c @@ -110,7 +110,7 @@ char *copyright = "Copyright (c) 1985-2007 Paul Cantrell"; * Prototypes */ void init_signals(void); - void teco_ini(void); + void teco_ini(const char *); void process_directory(char *,char*,int); int match_name(char *,char *); int map_baud(int); @@ -161,7 +161,7 @@ register int i; handle_command_line(1,argc,argv); - teco_ini(); + teco_ini(argv[0]); teco_startup = NO; @@ -848,7 +848,7 @@ int cmd_winch(void); * Q-Register contents he has specified. It also executes Q-Register 0. */ void -teco_ini() +teco_ini(const char *prg) { register char *cp; register int c,dc; @@ -877,12 +877,24 @@ char comment_flag = NO; #ifdef MSDOS /* - * FIXME: We should use the location - * of teco.exe. + * Locate TECO.INI in the same directory + * as the executable. + * This approach may fail in some command interpreters, + * so you may have to point the VTECO environment + * variable to the directory with TECO.INI instead. */ - (void) strcat(filename,".teco_ini"); + if((cp = getenv("VTECO"))){ + strcpy(filename,cp); + }/* End If */ + else if((cp = strrchr(prg,'\\'))){ + strncpy(filename,prg,cp-prg); + filename[cp-prg] = '\0'; + }/* End If */ + else return; -#endif + strcat(filename,"\\TECO.INI"); + +#endif /* MSDOS */ #ifdef VMS -- cgit v1.2.3