• Add support for Ultrix 4.5 and ucode cc (?)

‣ I/O redirection seems broken:
    $ (date; date >/dev/null; date) | wc -l
    1 (expected: 2)
  ‣ other than that: working fine
  ‣ -YBSD (default) and -YSYSTEM_FIVE don’t work, just -YPOSIX, somehow
• Fix $(…) to `…` for OSF/1 V2.0 /bin/sh
  ‣ this compiler is FUBAR though:
	$ cat >t.c
	main() { return (foo()); }
	$ cc t.c
	ld:
	Unresolved :
	foo
	$ echo $?
	0
	$ ls -l a.out
	-rwxr-xr-x   1 mirbsd   users      10835 Jul 21 17:12 a.out
  ‣ it seems to have ucode, but man is not installed
• new mirtoconf check: mkstemp(3)
• if !HAVE_MKSTEMP (Ultrix), use tempnam(3)
• only use printf(1) if it exists (it doesn’t on Ultrix)
• a few more signals
• add S_ISLNK if the OS doesn’t define it
• add strcasecmp(3) proto for Ultrix (it _is_ in <portability.h>, but
  only for -YBSD I think)
• fgrep(1) on Ultrix doesn’t do “-e ① -e ②”

10x DEChengst:#UnixNL for giving access
This commit is contained in:
tg
2008-03-25 21:34:45 +00:00
parent b8b52a7c92
commit def9c172df
5 changed files with 69 additions and 22 deletions

22
main.c
View File

@ -13,7 +13,7 @@
#include <locale.h>
#endif
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.92 2008/03/01 13:57:36 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.93 2008/03/25 21:34:44 tg Exp $");
extern char **environ;
@ -1113,13 +1113,31 @@ maketemp(Area *ap, Temp_type type, struct temp **tlist)
const char *dir;
dir = tmpdir ? tmpdir : "/tmp";
#if HAVE_MKSTEMP
len = strlen(dir) + 6 + 10 + 1;
#else
pathname = tempnam(dir, "mksh.");
len = ((pathname == NULL) ? 0 : strlen(pathname)) + 1;
#endif
tp = (struct temp *) alloc(sizeof(struct temp) + len, ap);
tp->name = pathname = (char *)&tp[1];
tp->name = (char *)&tp[1];
#if !HAVE_MKSTEMP
if (pathname == NULL)
tp->name[0] = '\0';
else {
memcpy(tp->name, pathname, len);
free(pathname);
}
#endif
pathname = tp->name;
tp->shf = NULL;
tp->type = type;
#if HAVE_MKSTEMP
shf_snprintf(pathname, len, "%s/mksh.XXXXXXXXXX", dir);
if ((fd = mkstemp(pathname)) >= 0)
#else
if (tp->name[0] && (fd = open(tp->name, O_CREAT | O_RDWR, 0600)) >= 0)
#endif
tp->shf = shf_fdopen(fd, SHF_WR, NULL);
tp->pid = procpid;