Commit Graph

110 Commits

Author SHA1 Message Date
blymn 8426a88bc7 Fix resource leak if malloc of tb->data failed.
Whitespace cleanup.
2006-03-18 12:18:15 +00:00
christos cf3e6ebd2b add t_putws 2005-05-15 21:10:52 +00:00
perry e738b65d24 de-__P, ANSIfy function declarations 2005-02-04 15:52:08 +00:00
christos 36d9d2a4de adjust to constification of cgetent() 2004-04-23 14:49:18 +00:00
simonb 9bc855a931 s/the the/the/ (only in sources that aren't regularly imported from
elsewhere).
2004-04-23 02:58:27 +00:00
agc eb7c1594f1 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22280, verified by myself.
2003-08-07 16:42:00 +00:00
wiz 472351e13d Use
.In header.h
instead of
.Fd #include \*[Lt]header.h\*[Gt]
Much easier to read and write, and supported by groff for ages.
Okayed by ross.
2003-04-16 13:34:34 +00:00
thorpej 3d397e0087 Fix signed/unsigned comparison warnings. 2002-11-11 23:56:46 +00:00
thorpej 09a0767aa9 Only use the MKDYNAMICROOT semantics (i.e. -rpath=/lib,/usr/lib and
-dynamic-linker=/libexec/ld.elf_so) if the BINDIR of the program being
built is /bin or /sbin.

The reason we do this is because now all programs *except* those in
/bin and /sbin (i.e. the "special cases") match the default the compiler
uses, which is what is used for things in e.g. xsrc, pkgsrc, and other
random 3rd party programs.

This is done by decoupling where a shlib is installed from how it
is located.  Two new variables, SHLIBINSTALLDIR and SHLINKINSTALLDIR,
contain the former information, and key off MKDYNAMICROOT only.  SHLIBDIR
and SHLINKDIR contain the latter, and key off MKDYNAMICROOT and BINDIR.

The SHLIBINSTALLDIR, SHLIBDIR, _LIBSODIR, SHLINKINSTALLDIR, and
SHLINKDIR parameters are moved to a new <bsd.shlib.mk>; see bsd.README
for usage details.
2002-09-27 21:37:50 +00:00
wiz 9b1e07f4f6 Add some markup, fix some markup, begin sentences on new lines. 2002-09-26 01:03:02 +00:00
lukem ec5dbc56b8 Explicitly move setting of NOxxx and USE_SHLIBDIR to the top of the
Makefile (before including <bsd.own.mk>)
2002-08-19 14:55:14 +00:00
pooka 337a91ae52 fix prototype for t_freent, and sprinkle const where necessary 2002-08-19 10:11:42 +00:00
christos 5438b79c88 restore 0 padding for %2 and %3. From David Laight. 2002-07-04 18:47:28 +00:00
christos 750c3adcea PR/17352: David Laight: handle numbers greater than 999.
In addition: eliminate uses of str*() functions that added complexity to the
code, and KNF.
2002-06-26 18:08:49 +00:00
christos abe6b5bef1 Make sure that we free memory and return null if we failed to initialize.
This should be pulled up to 1.6, but someone needs to make sure that it
does not affect broken programs.
2002-06-19 15:56:27 +00:00
lukem 26f515c492 Don't hard link to symlinks, as it's not portable.
Based on [toolchain/14119] from Chris G. Demetriou.
2002-02-26 00:24:59 +00:00
wiz 67aecfc942 Punctuation nit. 2002-02-20 11:35:21 +00:00
ross 814f296b77 Generate <>& symbolically. 2002-02-07 07:00:09 +00:00
wiz bed5b7e260 Whitespace nit. 2002-01-15 02:53:28 +00:00
lukem efcc9a4c9d * Add user-controlled mk.conf variables
- SHLIBDIR	Location to install shared libraries if ${USE_SHLIBDIR}
			is "yes".  Defaults to "/usr/lib".

	- USE_SHLIBDIR	If "yes", install shared libraries in ${SHLIBDIR}
			instead of ${LIBDIR}.  Defaults to "no".
			Sets ${_LIBSODIR} to the appropriate value.
			This may be set by individual Makefiles as well.

	- SHLINKDIR	Location of shared linker.  Defaults to "/usr/libexec".
			If != "/usr/libexec", change the dynamic-linker
			encoded in shared programs

* Set USE_SHLIBDIR for libraries used by /bin and /sbin:
	libc libcrypt libcrypto libedit libipsec libkvm libm libmi387
	libtermcap libutil libz

* If ${_LIBSODIR} != ${LIBDIR}, add symlinks from ${LIBDIR}/${LIB}.so*
  to ${_LIBSODIR}/${LIB}.so* for compatibility.

* Always install /sbin/init statically (for now)


The net effect of these changes depends on how the variables are set:

  1.)	If nothing is set or changed, there is no change from the
	current behaviour:
		- Static /bin, /sbin, and bits of /usr/*
		- Dynamic rest
		- Shared linker is /usr/libexec/ld*so

  2.)	If the following make variables are set:
		LDSTATIC=
		SHLINKDIR=/lib
		SHLIBDIR=/lib
	Then the behaviour becomes:
		- Dynamic tools
		- .so libraries used by /bin and /sbin are installed to /lib,
		  with symlinks from /usr/lib/lib*so to -> /lib/lib*so
		  where appropriate
		- Shared linker is /lib/ld*so

  3.)	As per 2.), but add the following variable:
		USE_SHLIBDIR=yes
	This forces all .so's to be instaleld in /lib (with compat
	symlinks), not just those tagged by their Makefiles to be.
	Again, compat symlinks are installed
2001-12-28 01:32:37 +00:00
blymn 574a09c0eb Fix off by one bug in t_agetstr - the pointer is moved to one past the
end of the termcap capability string.
2001-12-10 12:11:05 +00:00
blymn b49b6e823b stop t_freent freeing the same memory all the time. 2001-12-02 06:38:51 +00:00
christos 29c9bc3e1a make comment reflect reality (no functional changes) 2001-11-05 23:31:02 +00:00
christos d3b20c505a t_agetstr() changes. 2001-11-02 18:24:38 +00:00
christos a6265aca19 PR/10266: Jason R. Thorpe: curses programs totally broken.
Re-write t_agetstr() so that it does not use realloc so userland
programs don't break. We now use an internal buffer to keep track
of the memory we allocate. This changes the api of t_agetstr() to
take 2 fewer arguments, but there are not many programs that use it.
Please note that this does not change binary compatibility with the
previous t_agetstr() since the usage was:

	char *area, *p;

	*area = NULL;
	t_agetstr(ti, "ic", &area, &p);
	...
	free(area);

Since we don't touch the arguments and free(NULL) is a no-op, nothing
breaks.

Since we don't break binary compatibility there is no reason to bump
the library's major number, but since we change t_agetstr() I'll bump
the minor number for good measure.
2001-11-02 18:24:20 +00:00
christos 961acd7fc2 PR/10266: t_getstr() leaks memory. This PR will stay in feedback
until the problem gets addressed properly. The following fix
is a stopgap measure to stop the leaking :-(

I fixed the t_getstr() memory leak problem, but that instantly
revealed a problem in t_agetstr() which is an extremely broken
interface. It realloc's memory, potentially moving the area where
it returned pointers into in previous calls. This function needs
to be removed and or changed. I added a horrible work-around for
now, but I will revisit the problem shortly. In the meantime nobody
should be using the t_agetstr() API, and I'll be fixing the rest
of the programs and or the API when I figure out the best solution...
This is t_agetstr() is used by:

	games/hack/hack.termcap.c
	games/larn/io.c
	games/tetris/screen.c
	lib/libterm/termcap.c
	lib/libterm/termcap.h
	libexec/getty/main.c
	usr.bin/top/screen.c
	usr.bin/ul/ul.c
2001-10-31 21:52:17 +00:00
wiz c03a48d64f withough -> without 2001-06-13 10:45:57 +00:00
christos 566893d359 - use MAXPATHLEN to get the array size for the path we store.
- use strlcpy() instead of strncpy() to avoid the off-by-one error
  and the three missing '\0' terminations.
- perform bounds checks to make sure we don't turn this into a random
  memory writing tool using setenv HOME `perl -e 'print "a"x5000'`
2001-01-29 01:22:31 +00:00
jdolecek f1f01145ee make tmspc10[] const 2001-01-23 15:56:46 +00:00
lukem c9578df033 sprinkle some _DIAGASSERT()s in 2001-01-09 07:18:49 +00:00
christos 69a55bf430 fix spelling mistake and mention when the t_* functions appeared. 2001-01-05 23:05:08 +00:00
christos ca976de449 const castaways. 2001-01-05 23:02:00 +00:00
scw 71ce3fbb0f No need to initialise globals BC and UP to NULL; this happens anyway
for BSS variables.
(Quells a linker warning on m68k because BC and UP are also declared
but not initialised in libcurses/curses.c)
2000-12-13 22:14:40 +00:00
itohy 9bdf22f648 Correct ctype(3) usage, just in case.... 2000-07-14 05:26:04 +00:00
christos ae6f838f9e use ${SHLIB_FULLVERSION} instead of ${SHLIB_MAJOR}.${SHLIB_MINOR} 2000-07-03 21:10:57 +00:00
blymn 63b8f446f6 * Improve the handling of BC and UP in t_goto, t_getent now queries
these capabilities and stashes them in "struct tinfo" for t_goto to
  use.  This makes the t_goto call more efficient and plugs a memory
  leak that was present in the original t_goto implementation.
  Thanks to Itojun for spotting this one too!
2000-06-03 07:14:55 +00:00
thorpej 2d11440f4d Back out previous change. It causes all sorts of problems. The
memory leakage stuff should be addressed, but this change was
obviously wrong.
2000-06-02 22:09:01 +00:00
christos b619ddeed7 Don't leak memory. 2000-06-02 18:00:42 +00:00
itojun 74d0ceb979 correct memory leak due to t_getstr() and realloc(). the commit will
prevent "top -s 0" from chewing up memory.

TODO: realloc() audit, revisit recent termcap/curses changes
2000-06-02 13:13:07 +00:00
lukem 86d8882273 size arg doesn't exist anymore, so don't DIAGASSERT it 2000-06-01 07:54:00 +00:00
blymn 04a0fa29b3 * Fixed Makefile to proper set includes path
* Added new function t_setinfo to allow setting the termcap info when
  termcap entry found.
2000-05-28 09:58:15 +00:00
blymn 22a94f7041 * Removed variable names from ansi style prototype
* Add -I. to CPPFLAGS
* Added new function t_agetstr which dynamically allocates area buffer.
2000-05-20 13:55:10 +00:00
lukem 84f71cf03e area is allowed to be NULL, so don't _DIAGASSERT it. 2000-05-14 01:14:29 +00:00
christos 0a73d7c493 - use strchr instead of index
- whitespace fixes
- tgetstr only looks at the first two characters; t_getstr looks at the whole
  string.
- fix DIAGASSERT brokenness.
2000-05-12 15:25:25 +00:00
blymn fac11bb07f Update man page to document new tgetent behaviour. 2000-05-10 11:13:35 +00:00
blymn 0c575d5c64 * Modified t_getent to ignore the TERMCAP env variable if it contains the
ZZ attribute which indicates the TERMCAP was exported from another
  programme and has been truncated.  Iff a real termcap entry cannot be
  found then TERMCAP with a ZZ in it will be used as a last resort.
2000-05-08 13:17:14 +00:00
blymn adf14e0d21 Fixed t_getstr so that limit is only set to 0 iff area is NULL when an
unknown capability is requested.
2000-04-20 13:22:36 +00:00
blymn e584b4762e Ensure limit is sane on return from t_getstr if requested entry does
not exist.
2000-04-19 15:32:28 +00:00
blymn c833debc98 Added new function t_getterm to return the name string of a termcap
entry since the "new" interface hid this information away.
2000-04-19 13:41:28 +00:00
blymn 29912c2724 Split private data structure into separate file. 2000-04-18 14:42:42 +00:00