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/lib/libast
Martijn Dekker 289dd46c05 build: include standards macros for all AST code (re: 7fb814e1)
Turns out that the standards macros set by features/standards (such
as _GNU_SOURCE for Linux or _DARWIN_SOURCE for macOS) were still
*not* included for most C source files! Instead, they were
selectively included for some files only, sometimes via
FEATURE/standards (the output of features/standards), sometimes
via ast_standards.h which is copied from FEATURE/standards.

Consequently, there were still inconsistencies in the system header
interfaces exposed on Linux, macOS, Solaris, et al. It's no wonder
it sometimes took so much hackery to keep everything building.

Of course, making this consistent had to break things somewhere.
Breakage occurred on 32-bit Linux due to a lot of ugly hackery
involving direct use of internal GNU types like off64_t and
functions like fseek64(). This is now all removed and they are
activated by setting the appropriate feature macro instead, so
these types and functions can be used with their standard names
(off_t, fseek, etc.)

Before committing I've tested these changes on the following
i386/x86_64 systems: Linux (glibc 32 and 64 bit, musl libc 64 bit),
Solaris (32 and 64 bit), illumos (32 and 64 bit), FreeBSD (64 bit),
macOS (64 bit), Cygwin (32 bit), and Haiku (64 bit).

(Note: ast_standards.h is copied from FEATURE/standards, whereas
ast_common.h is copied from FEATURE/common.)

src/lib/libast/include/ast_std.h,
src/lib/libast/stdio/stdhdr.h:
- Include <ast_standards.h> first. This should cause all the AST
  and dependent code (such as ksh) to get the standards macros.

src/lib/libast/features/standards:
- For GNU (glibc), #define _FILE_OFFSET_BITS 64 to get large file
  support with 64-bit offsets.
- Stop GNU and Cygwin <string.h> form defining the GNU version of
  basename(3); on Cygwin, that declaration conflicts with the AST
  version (and with POSIX) by using a const char* argument instead
  of char*. It is deactivated by defining the macro 'basename' (as
  'basename'); this causes GNU string.h to consider it to be
  already defined by the standard libgen.h header.

All other changed files:
- Remove direct use of *64* types and functions and a lot of
  related hackery.
2022-01-20 00:53:22 +00:00
..
aso Fix various typos, man page issues and improve the documentation (#415) 2022-01-07 16:17:55 +00:00
astsa build: include standards macros for all AST code (re: 7fb814e1) 2022-01-20 00:53:22 +00:00
cdt Remove leftover pre-C89 code (re: a1f5c992) 2021-12-27 05:46:23 +00:00
comp build: include standards macros for all AST code (re: 7fb814e1) 2022-01-20 00:53:22 +00:00
dir build: include standards macros for all AST code (re: 7fb814e1) 2022-01-20 00:53:22 +00:00
disc In the original ast code base, src/{cmd/nmake,lib/libast}/Makefile 2022-01-07 15:57:46 +00:00
features build: include standards macros for all AST code (re: 7fb814e1) 2022-01-20 00:53:22 +00:00
hash INIT: remove proto, ratz (re: 46593a89, 6137b99a); major cleanup 2021-12-24 07:05:22 +00:00
include build: include standards macros for all AST code (re: 7fb814e1) 2022-01-20 00:53:22 +00:00
man bump internal libast version; various minor cleanups 2022-01-14 19:55:35 +00:00
misc build: include standards macros for all AST code (re: 7fb814e1) 2022-01-20 00:53:22 +00:00
path Fix various typos, man page issues and improve the documentation (#415) 2022-01-07 16:17:55 +00:00
port In the original ast code base, src/{cmd/nmake,lib/libast}/Makefile 2022-01-07 15:57:46 +00:00
preroot Fix various typos, man page issues and improve the documentation (#415) 2022-01-07 16:17:55 +00:00
regex libast: regex: re-backport robustness improvements from 93v- beta 2021-12-28 22:24:41 +00:00
sfio build: include standards macros for all AST code (re: 7fb814e1) 2022-01-20 00:53:22 +00:00
std Various minor capitalization and typo fixes (#371) 2021-12-13 01:49:42 +01:00
stdio build: include standards macros for all AST code (re: 7fb814e1) 2022-01-20 00:53:22 +00:00
string Fix various typos, man page issues and improve the documentation (#415) 2022-01-07 16:17:55 +00:00
tm INIT: remove proto, ratz (re: 46593a89, 6137b99a); major cleanup 2021-12-24 07:05:22 +00:00
uwin INIT: remove proto, ratz (re: 46593a89, 6137b99a); major cleanup 2021-12-24 07:05:22 +00:00
vec INIT: remove proto, ratz (re: 46593a89, 6137b99a); major cleanup 2021-12-24 07:05:22 +00:00
vmalloc build: include standards macros for all AST code (re: 7fb814e1) 2022-01-20 00:53:22 +00:00
Mamfile build: include standards macros for all AST code (re: 7fb814e1) 2022-01-20 00:53:22 +00:00
README Fix various typos, man page issues and improve the documentation (#415) 2022-01-07 16:17:55 +00:00
RELEASE Fix various typos, man page issues and improve the documentation (#415) 2022-01-07 16:17:55 +00:00

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