[13555] in Athena Bugs
mk_cmds patch for writing to current directory
daemon@ATHENA.MIT.EDU (ghudson@MIT.EDU)
Mon Jun 5 15:42:20 1995
From: ghudson@MIT.EDU
Date: Mon, 5 Jun 1995 15:42:10 -0400
To: rel-eng@MIT.EDU, bugs@MIT.EDU
Cc: tytso@MIT.EDU
Athena sources commonly use two utilities, compile_et and mk_cmds, to
generate C source files from error tables or command tables.
compile_et writes its output to the current directory, which is
convenient if you are building in a build directory separate from the
source directory. Unfortunately, mk_cmds writes its output to the
source directory; that is, if you run "mk_cmds /foo/bar/baz.ct", it
will write its output to "/foo/bar/baz.c" instead of just "baz.c" in
the current directory. This is decidedly inconvenient for source
trees which support compilation in separate build directories, and
leads to make rules like:
# mk_cmds insists on writing output to source directory.
zctl_cmds.c: zctl_cmds.ct
cp $(srcdir)/zctl_cmds.ct /var/tmp/zctl_cmds.$$$$.ct; \
$(MK_CMDS) /var/tmp/zctl_cmds.$$$$.ct; \
mv /var/tmp/zctl_cmds.$$$$.c zctl_cmds.c; \
rm -f /var/tmp/zctl_cmds.$$$$.ct
Anyway, here is a patch to fix mk_cmds to act like com_err. The file
mk_cmds.c is located in /afs/dev.mit.edu/source/src/athena/lib/ss. I
would appreciate it if this patch would make it into the next Athena
release, despite it being past official code cut, since I consider
the current behavior to be a bug.
*** mk_cmds.c.old Mon Jun 5 15:30:12 1995
--- mk_cmds.c Mon Jun 5 15:36:31 1995
***************
*** 33,39 ****
{
char c_file[MAXPATHLEN];
int result;
! char *path, *p;
if (argc != 2) {
fputs("Usage: ", stderr);
--- 33,39 ----
{
char c_file[MAXPATHLEN];
int result;
! char *path, *p, *q;
if (argc != 2) {
fputs("Usage: ", stderr);
***************
*** 60,66 ****
p = rindex(path, '.');
*p = '\0';
! strcpy(c_file, path);
strcat(c_file, ".c");
*p = '.';
--- 60,67 ----
p = rindex(path, '.');
*p = '\0';
! q = rindex(path, '/');
! strcpy(c_file, (q) ? q + 1 : path);
strcat(c_file, ".c");
*p = '.';