[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Improved autofix patch
In <01HW5TDMJD2S004NHI@CATHY.IJS.SI>,
Matija Grabnar (Matija.Grabnar@ijs.si) wrote:
>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).
My `patch.ttp' somehow doesn't like this diff...
What happens is this:
N:\mint-1.12.4> patch <autofix_patch.dif
Hmm... Looks like a new-style context diff to me...
The text leading up to this was:
--------------------------
|*** /f/freemint.12/main.c Wed Aug 9 19:29:18 1995
|--- main.c Sat Oct 7 00:09:26 1995
--------------------------
Patching file main.c using Plan A...
patch: **** unexpected end of hunk at line 57
N:\mint-1.12.4>
Did anybody else have problems with this diff?
Or is my `patch' broken (or too old)? (It worked fine with all
diffs I threw at it in the past, though, as long as correct line
terminators were used...)
Where can I find a more current version?
And of `diff', too?
(I'm currently using a `diff' from 1991 and a `patch' 1992 - both
clearly not MiNT-aware...:-()
(BTW: IMHO, whenever possible, a unified diff should be created - it's
both shorter and more readable than a normal context diff...)
>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.
You're right on both points; since my own setup is more TOS-like
than Unix-like, I didn't quite see the advantages of being able
to set a different directory for the INIT process...
I hereby formally revoke my original patch suggestion! :-)
Your patch still has a few problems, though; in particular:
- the current directory during auto folder execution should be
root, *not* \AUTO
- we probably shouldn't intermix calls to "internal" MiNT functions
like d_getdrv() and GEMDOS functions like Dgetdrv() (actually,
this only matters if we're in kernel mode, which is not the case
at this point [I think]; still, it's cleaner to always use the
"internal" functions...)
- use PATH_MAX instead of some constant (64) for the path buffer
size...
I appended a "fixed" and more streamlined version of your patch to this
message.
Martin
--- ..\mk-src-1\main.c Thu Oct 12 18:22:10 1995
+++ main.c Thu Oct 12 20:44:20 1995
@@ -1668,6 +1668,8 @@
long r;
static char pathspec[32] = "\\AUTO\\";
short runthem = 0; /* set to 1 after we find MINT.PRG */
+ char curpath[PATH_MAX];
+ int curdriv,bootdriv;
/* if the AES is running, don't check AUTO */
@@ -1676,6 +1678,15 @@
/* OK, now let's run through \\AUTO looking for
* programs...
*/
+ d_getpath(curpath,0);
+ curdriv = d_getdrv();
+ /*
+ * We are in Supervisor mode, so we can do this
+ */
+ bootdriv=*((short*)0x446);
+ d_setdrv(bootdriv);
+ d_setpath("\\");
+
dta = (DTABUF *)f_getdta();
r = f_sfirst("\\AUTO\\*.PRG", 0);
while (r >= 0) {
@@ -1692,4 +1703,6 @@
}
r = f_snext();
}
+ d_setdrv(curdriv);
+ d_setpath(curpath);
}
--
Martin Koehling // NEW email address: mk@anuurn.ruhr.de