[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Improved autofix patch



Following comments abot the previous patch I posted here, I am posting
a new patch. This one is a context diff (thanks for the tip). It checks
the system variable _bootdev to determine where we are booting from and
runs programs following mint in the AUTO folder of that drive. It restores
the current directory back to whatever was set by the MINT.CNF.

I do think that the cd command in MINT.CNF should be obeyed, but I also think
AUTOFIX _must_ ensure that programs following MiNT get executed - otherwise
it is too confusing for the users. 

*** /f/freemint.12/main.c	Wed Aug  9 19:29:18 1995
--- main.c	Sat Oct  7 00:09:26 1995
***************
*** 1668,1686 ****
  {
  	DTABUF *dta;
  	long r;
! 	static char pathspec[32] = "\\AUTO\\";
  	short runthem = 0;	/* set to 1 after we find MINT.PRG */
  
  /* if the AES is running, don't check AUTO */
- 
  	if (gem_active)	return;
  
  /* OK, now let's run through \\AUTO looking for
   * programs...
   */
  	dta = (DTABUF *)f_getdta();
! 	r = f_sfirst("\\AUTO\\*.PRG", 0);
  	while (r >= 0) {
  #ifdef AUTO_FIX
  		if ( strcmp(dta->dta_name, my_name)==0 )
  #else
--- 1665,1697 ----
  {
  	DTABUF *dta;
  	long r;
! 	static char pathspec[32] = "C:\\AUTO\\"; /* C is just a placeholder here */
  	short runthem = 0;	/* set to 1 after we find MINT.PRG */
+ 	static char tmp[64],tmp2[64];
+ 	int	curdriv,bootdriv;
  
  /* if the AES is running, don't check AUTO */	
  	if (gem_active)	return;
  
  /* OK, now let's run through \\AUTO looking for
   * programs...
   */
+ 	d_getpath(tmp,0);
+ 	curdriv=Dgetdrv();
+ /*
+  *	We are in Supervisor mode, so we can do this
+  */
+ 	bootdriv=*((int *)0x446);
+ 	Dsetdrv(bootdriv);
+ 	pathspec[0]='A'+bootdriv;
+ 	strcpy(tmp2,pathspec);
+ 	strcat(tmp2,"*.PRG");
+ 	d_setpath(pathspec);
  	dta = (DTABUF *)f_getdta();
! 	r = f_sfirst(tmp2, 0);
  	while (r >= 0) {
+ 		
  #ifdef AUTO_FIX
  		if ( strcmp(dta->dta_name, my_name)==0 )
  #else
***************
*** 1689,1697 ****
  #endif
  			runthem = 1;
  		else if (runthem) {
! 			strcpy(pathspec+6, dta->dta_name);
  			p_exec(0, pathspec, (char *)"", init_env);
  		}
  		r = f_snext();
  	}
  }
--- 1700,1710 ----
  #endif
  			runthem = 1;
  		else if (runthem) {
! 			strcpy(pathspec+8, dta->dta_name);
  			p_exec(0, pathspec, (char *)"", init_env);
  		}
  		r = f_snext();
  	}
+ 	Dsetdrv(curdriv);
+ 	d_setpath(tmp);
  }