1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00
cde/src/cmd/builtin/features/pty
Martijn Dekker dd0d03b973 Eliminate LDFLAGS hack to compile on certain OSs
Instead, we now link to the libm system math library where needed
by adding -lm to the relevant compile commands in the Mamfiles.
This is not needed on every system but never does any harm.

(This adds more custom edits to the Mamfiles, which were originally
generated from the nmake Makefiles. This takes us further from
restoring nmake, but that already wasn't going to happen anyway,
due to its many problems... the path forward will be to translate
the Mamfiles to some other, current make system such as GNU make.)

bin/package, src/cmd/INIT/package.sh:
- Remove LDFLAGS=-lm hack for DragonFly BSD, NetBSD and Solaris.

src/cmd/builtin/Mamfile,
src/cmd/ksh93/Mamfile,
src/lib/libdll/Mamfile:
- Add -lm where linking failed on any of the three mentioned OSs.

src/lib/libdll/features/dll:
- In the output test program, add missing #include <math.h>, fixing
  unknown identifier errors on NetBSD (ldexp, ldexpl).

src/cmd/builtin/features/pty:
- Add missing #include <stdio.h> to make printf work on all systems
  (this is just a feature test, no need to bother with sfio here).

src/lib/libast/features/stdio:
- Undef __FILE_T to avoid interference from system headers on QNX.
  (There are still other problems preventing a build on QNX 6.5.0.
  The shipped version of gcc seems to be broken.)
2021-01-18 19:16:17 +00:00

61 lines
1.2 KiB
Text
Executable file

set prototyped
header sys/types.h
header pty.h
header libutil.h
header sys/pty.h
header sys/ptyio.h
header sys/vty.h
header sys/ioctl.h
header stropts.h
lib openpty,_getpty,ptsname -lutil
lib grantpt,unlockpt,posix_openpt stdlib.h
tst - output{
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#if _lib_ptsname && _npt_ptsname
_BEGIN_EXTERNS_
#if _STD_
extern char* ptsname(int);
#else
extern char* ptsname();
#endif
#endif
_END_EXTERNS_
int main()
{
int i;
struct stat statb;
static char* pty[] = { "/dev/ptyp0000", "/dev/ptym/ptyp0", "/dev/ptyp0" };
#if _lib_ptsname
int fd;
static char* ptc[] = { "/dev/ptmx", "/dev/ptc", "/dev/ptmx_bsd" };
for (i = 0; i < sizeof(ptc) / sizeof(ptc[0]); i++)
if((fd = open(ptc[i], 2))>=0)
{
if (ptsname(fd))
{
printf("#define _pty_clone\t\"%s\"\n", ptc[i]);
close(fd);
break;
}
close(fd);
}
#endif
for (i = 0;; i++)
if(i >= (sizeof(pty) / sizeof(pty[0]) - 1) || stat(pty[i], &statb)>=0)
{
printf("#define _pty_first\t\"%s\"\n", pty[i]);
break;
}
return 0;
}
}end
extern _getpty char* (int*, int, mode_t, int)
extern openpty int (int*, int*, char*, struct termios*, struct winsize*)
extern ptsname char* (int)