cdesktopenv/src/lib/libast
Johnothan King 22e044c339
Fix compile when using tcc >0.9.27 (#238)
This allows ksh to be compiled with versions of tcc that define
__dso_handle in libtcc1.a, i.e., versions as of this commit:
https://repo.or.cz/tinycc.git/commit/dd60b20c

Older versions of tcc still fail to compile ksh, although now they
fail after reaching the libdll feature test. I'm not sure if fixing
that is feasible since even if I hack out the failing libdll
feature test, ksh fails to link with a '__dso_handle' error.

src/lib/libast/comp/atexit.c,
src/lib/libast/features/lib,
src/lib/libast/vmalloc/vmexit.c:
- From what I've been able to gather the only OSes with support
  for on_exit are Linux and SunOS 4. However, on_exit takes two
  arguments, so the macro that defines it as taking one argument
  is incorrect. Since Solaris (SunOS 5) no longer has this call
  and the macro breaks on Linux, the clean fix is to remove it
  (atexit(3) is used instead).

src/lib/libast/include/ast.h:
- When compiling with tcc on FreeBSD, pretend to be gcc 2.95.3
  instead of gcc 9.3.0. This stops /usr/include/math.h from
  activating gcc 3.0+ math compiler builtins that don't exist on
  tcc, while still identifying as gcc which is needed to avoid
  other FreeBSD system header breakage.

src/cmd/builtin/Mamfile,
src/cmd/builtin/features/pty,
src/lib/libdll/Mamfile,
src/lib/libdll/features/dll:
- tcc forbids combining the -c compiler flag with -l* linker flags.
  Use the -lm flag in the iffe feature tests instead of the
  Mamfiles. This avoids iffe combining -lm with the -c flag.

src/lib/libast/vmalloc/malloc.c:
- Fix failure to compile with -D_std_malloc.
  This patch is from OpenSUSE:
  https://build.opensuse.org/package/view_file/shells/ksh/ksh93-malloc-hook.dif
  As it turns out tcc needs this change to build ksh with
  -D_std_malloc, so it has been applied.

Co-authored-by: Martijn Dekker <martijn@inlv.org>
Resolves: https://github.com/ksh93/ksh/issues/232
2021-03-23 14:46:58 +00:00
..
aso Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
astsa Some more build fixes from OpenSUSE 2021-02-02 21:03:01 +00:00
cdt Fix various minor problems and update the documentation (#237) 2021-03-21 14:39:03 +00:00
comp Fix compile when using tcc >0.9.27 (#238) 2021-03-23 14:46:58 +00:00
dir Remove vestigial 3DFS support code (re: f88f302c) 2020-07-17 05:04:03 +01:00
disc Fix various minor problems and update the documentation (#237) 2021-03-21 14:39:03 +00:00
features Fix compile when using tcc >0.9.27 (#238) 2021-03-23 14:46:58 +00:00
hash Fix various minor problems and update the documentation (#237) 2021-03-21 14:39:03 +00:00
include Fix compile when using tcc >0.9.27 (#238) 2021-03-23 14:46:58 +00:00
man Add --globcasedetect shell option for globbing and completion 2021-03-22 18:45:19 +00:00
misc Add --globcasedetect shell option for globbing and completion 2021-03-22 18:45:19 +00:00
path Linux bugfixes for globcasedetect (re: 71934570) (#240) 2021-03-23 13:59:02 +00:00
port Add --globcasedetect shell option for globbing and completion 2021-03-22 18:45:19 +00:00
preroot libast: consolidate errno ID fallbacks into error.h 2021-03-22 14:55:16 +00:00
regex Fix various minor problems and update the documentation (#237) 2021-03-21 14:39:03 +00:00
sfio libast: consolidate errno ID fallbacks into error.h 2021-03-22 14:55:16 +00:00
std Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
stdio Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
string libast: consolidate errno ID fallbacks into error.h 2021-03-22 14:55:16 +00:00
tm Fix many compiler warnings and remove unused variables (#191) 2021-02-22 22:16:32 +00:00
uwin Fix various minor problems and update the documentation (#237) 2021-03-21 14:39:03 +00:00
vec Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
vmalloc Fix compile when using tcc >0.9.27 (#238) 2021-03-23 14:46:58 +00:00
Mamfile Add --globcasedetect shell option for globbing and completion 2021-03-22 18:45:19 +00:00
README Fix various minor problems and update the documentation (#237) 2021-03-21 14:39:03 +00:00
RELEASE Fix various minor problems and update the documentation (#237) 2021-03-21 14:39:03 +00:00

README

The advanced software technology department has been collecting useful C
routines in a single library called libast.  libast is used by nmake, the
nmake cpp (which is mainly based on another library (libpp)), CIA
(C information abstractor from Robin Chen), and a collection of other
/bin and /usr/bin commands that benefit from concentrating functionality
in libast.

More detail is available in the man pages.  libast contains:

  (1)	routines to support a generic environment for
	a variety of UNIX operating system variants

  (2)	routines that update standard libc routines

  (3)	routines shared between several commands

If you already have nmake 2.0 or newer installed then use
`nmake install' from this directory, otherwise use
ship/shipin from the root of the distribution directory tree.

Some of the routines not found in section 3:

hash:			generic, scoped hash table support

	hashalloc	create a hash table or push new scope
	hashdump	debug dump of one or all hash tables
	hashfree	free a hashalloc()'d table
	hashlook	low level name lookup
	hashscan	entry generator for scoped table scan
	hashsize	explicitly change table size (usually automatic)
	hashwalk	apply function to each table entry
	memhash		return hash code for n-char chunk of memory
	strhash		return hash code for null-terminated string

include/ast:		libast support headers

	align.h		compile time type alignment support
	dirent.h	POSIX directory(3) interface definitions
	error.h		error() interface definitions
	ftw.h		ftwalk() interface definitions
	hash.h		hash*() interface definitions
	ls.h		strls() interface definitions
	re.h		re*() interface definitions
	tar.h		POSIX ustar format interface definitions
	tm.h		tm*() interface definitions

misc:

	cmdargs		apply a sequence of cmd line option parsers
	cmdopen		like popen() but stdin and stdout are specified
	cvtatoe		convert ASCII to EBCDIC
	cvtetoa		convert EBCDIC to ASCII
	error		output generic error and trace messages
	ftwalk		an ftw(3) that works -- used in new tw(1)
	getcwd		uses $PWD if ok, doesn't use /bin/pwd
	getshell	return full path of shell for cmdopen()
	ooptget		optget() for obsolete ar(1) and tar(1) options
	optget		YA getopt(3) but no argc or error message output
	pathaccess	find file with specific access on list of dirs
	pathcanon	canonicalize path name in place
	pathcmd		return full path name of executable using $PATH
	pathroot	determine `related root' directory for command
	perror		uses strerror()
	readargs	append each line of file to argv[0]

re:			egrep(1) and ed(1) style re's from V9
			(not the good awk(1) algorithm)

	recomp		compile re pattern
	reerror		report re*() errors
	reexec		match string using compiled re
	resub		ed(1) style substitute using last reexec()

string:

	chresc		return next char in string converting \ sequences
	ctoi		convert char constant string to int
	strcopy		like strcpy(3) but returns end of destination
	strdup		malloc(3) and strcpy(3) smashed together
	strerror	return error message string given errno
	stresc		convert \ sequences in string in place
	streval		evaluate C expression in string
	strls		ls -l format support
	strmatch	Korn shell file pattern match
	strmode		return ls -l style output given st.st_mode
	strsignal	return signal id string given SIG* number
	strtape		convert generic tape unit to /dev/* file
	token		generate space separated tokens in string

tm:			time conversion support

	tmdate		convert date string to time_t
	tmform		format time_t to date string
	tmmake		return current time_t
	tmtime		convert struct tm to time_t