[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bugs 1.29b? skeletons
From: |
Akim Demaille |
Subject: |
Re: bugs 1.29b? skeletons |
Date: |
02 Oct 2001 16:57:24 +0200 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Artificial Intelligence) |
| Sorri for my english.
| I learn it using only Help Files...
It is good enough!
| My Operation Systems:
| Windows Me, Windows 2000 Pro
| Localizations: Russian
Missing the Bison version. 1.29b?
What is your name?
I applied this for to look for the skeletons. I need you to sign FSF
papers to apply patches written by you.
In the future, bison will use `-I', so this won't be needed, and
finally I'll be happy not to have to see `MSDOS' in the code :)
Index: ChangeLog
from Akim Demaille <address@hidden>
* src/output.c (output_parser): Assert `skeleton'.
* src/files.c (skeleton_find): Look harder for skeletons on DOSish
systems.
From Shura.
Index: src/files.c
===================================================================
RCS file: /cvsroot/bison/bison/src/files.c,v
retrieving revision 1.51.2.8
diff -u -u -r1.51.2.8 files.c
--- src/files.c 2001/09/25 18:35:04 1.51.2.8
+++ src/files.c 2001/10/02 14:44:23
@@ -200,17 +200,42 @@
{
const char *res = getenv (envvar);
-#ifdef MSDOS
- const char *cp;
-
- /* File doesn't exist in current directory; try in INIT directory. */
- if (!res && (cp = getenv ("INIT")))
+#if defined (MSDOS) || defined (_WIN32)
+ if (!res)
{
- res = XMALLOC (char, strlen (cp) + strlen (skeleton_name) + 2);
- sprintf (res, "%s%c%s", cp, '/', skeleton_name);
- }
-#endif /* !MSDOS */
+ /* Skeleton file name without path */
+ const char *skel_name = strrchr(skeleton_name, '/');
+ if (!skel_name)
+ skel_name = strrchr(skeleton_name, '\\');
+ if (!skel_name)
+ skel_name = skeleton_name;
+ else
+ ++skel_name;
+ /* File doesn't exist in current directory; try in INIT directory. */
+ const char *cp = getenv ("INIT");
+ if (cp)
+ {
+ res = XMALLOC (char, strlen (cp) + strlen (skel_name) + 2);
+ sprintf (res, "%s%c%s", cp, '\\', skel_name);
+ }
+ else if (access (skel_name, 4) == 0) /* Look in current dir. */
+ res = skel_name;
+ else
+ {
+ /* Look in program locations dir. */
+ extern char *program_name;
+ cp = strrchr(program_name, '\\');
+ if (!cp)
+ return skeleton_name;
+ else
+ ++cp;
+ res = XMALLOC (char, cp - program_name + strlen (skel_name) + 1);
+ strncpy (res, program_name, cp - program_name);
+ strcpy (res + (cp - program_name), skel_name);
+ }
+ }
+#endif /* defined (MSDOS) || defined (_WIN32) */
if (!res)
res = skeleton_name;
Index: src/output.c
===================================================================
RCS file: /cvsroot/bison/bison/src/output.c,v
retrieving revision 1.39.2.4
diff -u -u -r1.39.2.4 output.c
--- src/output.c 2001/09/25 18:35:04 1.39.2.4
+++ src/output.c 2001/10/02 14:44:23
@@ -1160,6 +1160,7 @@
else
skeleton = skeleton_find ("BISON_SIMPLE", BISON_SIMPLE);
}
+ assert (skeleton);
fskel = xfopen (skeleton, "r");
/* Set LINE to 2, not 1: `#line LINENUM' -- Here LINENUM is a