History log of /freebsd-current/bin/sh/mksyntax.c
Revision Date Author Comments
# 0b8224d1 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

Remove copyright strings ifdef'd out

We've ifdef'd out the copyright strings for some time now. Go ahead and
remove the ifdefs. Plus whatever other detritis was left over from other
recent removals. These copyright strings are present in the comments and
are largely from CSRG's attempt at adding their copyright to every
binary file (which modern interpretations of the license doesn't
require).

Sponsored by: Netflix


# 90aea514 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

bin: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix


# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# dc0dbd74 21-May-2018 Jilles Tjoelker <jilles@FreeBSD.org>

sh: Split CNL syntax category to avoid a check on state[level].syntax

No functional change is intended.


# 8a16b7a1 20-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

General further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.


# fbbd9655 28-Feb-2017 Warner Losh <imp@FreeBSD.org>

Renumber copyright clause 4

Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by: Jan Schaumann <jschauma@stevens.edu>
Pull Request: https://github.com/freebsd/freebsd/pull/96


# 58bdb076 03-Mar-2015 Jilles Tjoelker <jilles@FreeBSD.org>

sh: Fix more compiler warnings related to variable declarations.


# 1767d529 07-Feb-2013 Jilles Tjoelker <jilles@FreeBSD.org>

sh: Simplify mksyntax and make it fit for cross-compiling.

Now it outputs fixed files, which use constants provided by the C standard
library to determine appropriate values for the target machine.

Before, mksyntax inspected the host machine which resulted in subtle
breakage if e.g. char is signed on the host and unsigned on the target such
as when cross-compiling on x86 for ARM.

Tested using -funsigned-char on amd64. Compiling build-tools without it and
sh itself with it causes various tests to fail without this change but not
with this change. With consistent -funsigned-char, tests pass with or
without this change.

The mksyntax program could be removed and syntax.c and syntax.h committed to
the repository.

Submitted by: Christoph Mallon
MFC after: 2 weeks


# eaf77199 05-Feb-2013 Jilles Tjoelker <jilles@FreeBSD.org>

sh: Do not test for digit_contig in mksyntax.

ISO/IEC 9899:1999 (E) 5.2.1p3 guarantees that the values of the characters
0123456789 are contiguous.

The generated syntax.c and syntax.h remain the same.

Submitted by: Christoph Mallon


# 58570ac4 31-Jan-2013 Jilles Tjoelker <jilles@FreeBSD.org>

sh: Prefer our character classification functions to <ctype.h>.


# 3a1b9c9e 28-Dec-2011 Jilles Tjoelker <jilles@FreeBSD.org>

sh: Allow quoting ^ and ] in bracket expressions.


# a62ab027 05-May-2011 Jilles Tjoelker <jilles@FreeBSD.org>

sh: Add $'quoting' (C-style escape sequences).

A string between $' and ' may contain backslash escape sequences similar to
the ones in a C string constant (except that a single-quote must be escaped
and a double-quote need not be). Details are in the sh(1) man page.

This construct is useful to include unprintable characters, tabs and
newlines in strings; while this can be done with a command substitution
containing a printf command, that needs ugly workarounds if the result is to
end with a newline as command substitution removes all trailing newlines.

The construct may also be useful in future to describe unprintable
characters without needing to write those characters themselves in 'set -x',
'export -p' and the like.

The implementation attempts to comply to the proposal for the next issue of
the POSIX specification. Because this construct is not in POSIX.1-2008,
using it in scripts intended to be portable is unwise.

Matching the minimal locale support in the rest of sh, the \u and \U
sequences are currently not useful.

Exp-run done by: pav (with some other sh(1) changes)


# 467fdf32 20-Nov-2010 Jilles Tjoelker <jilles@FreeBSD.org>

sh: Remove the check that alpha/name/in_name chars are not CTL* bytes.

Since is_alpha/is_name/is_in_name were made ASCII-only, this can no longer
happen.

Additionally, the check was wrong because it did not include the new
CTLQUOTEEND.


# 048f2667 29-Oct-2010 Jilles Tjoelker <jilles@FreeBSD.org>

sh: Do IFS splitting on word in ${v+word} and ${v-word}.

The code is inspired by NetBSD sh somewhat, but different because we
preserve the old Almquist/Bourne/Korn ability to have an unquoted part in a
quoted ${v+word}. For example, "${v-"*"}" expands to $v as a single field if
v is set, but generates filenames otherwise.

Note that this is the only place where we split text literally from the
script (the similar ${v=word} assigns to v and then expands $v). The parser
must now add additional markers to allow the expansion code to know whether
arbitrary characters in substitutions are quoted.

Example:
for i in ${$+a b c}; do echo $i; done

Exp-run done by: pav (with some other sh(1) changes)


# d94c8673 24-Oct-2010 Jilles Tjoelker <jilles@FreeBSD.org>

sh: Ignore double-quotes in arithmetic rather than treating them as quotes.

This provides similar behaviour, but allows a simpler parser.

This changes r206473.

Exp-run done by: pav (with some other sh(1) changes)


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# fe5d61a4 03-Sep-2010 Jilles Tjoelker <jilles@FreeBSD.org>

sh: Do not use locale for determining if something is a name.

This makes it impossible to use locale-specific characters in variable
names.

Names containing locale-specific characters make scripts only work with the
correct locale setting. Also, they did not even work in many practical cases
because multibyte character sets such as utf-8 are not supported.

This also avoids weirdness if LC_CTYPE is changed in the middle of a script.


# 40969e73 08-Aug-2010 Jilles Tjoelker <jilles@FreeBSD.org>

Remove unnecessary duplicate letters in mksyntax.c,
the table elements would just be overwritten twice.


# 7f728c60 10-Apr-2010 Jilles Tjoelker <jilles@FreeBSD.org>

sh: Partially revert r206146, allowing double-quotes in arithmetic.

These do pretty much nothing (except that parentheses are ignored), but
people seem to use them and allowing them does not hurt much.

Single-quotes seem not to be used and cause silently different behaviour
with ksh93 character constants.


# e79985ff 03-Apr-2010 Jilles Tjoelker <jilles@FreeBSD.org>

sh: Remove special handling for ' and " in arithmetic.
They will be treated like normal characters, resulting in a runtime
arithmetic expression error.

Exp-run done by: erwin (with some other sh(1) changes)


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# 384aedab 27-Dec-2009 Jilles Tjoelker <jilles@FreeBSD.org>

sh: Various warning fixes (from WARNS=6 NO_WERROR=1):
- const
- initializations to silence -Wuninitialized (it was safe anyway)
- remove nested extern declarations
- rename "index" locals to "idx"


# f001f896 01-Jun-2009 Ralf S. Engelschall <rse@FreeBSD.org>

use explicit 'unsigned int' instead of just the implicit-style 'unsigned' to make linting tools (e.g. FlexeLint) happy, too


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 2912059a 18-Feb-2008 Marcel Moolenaar <marcel@FreeBSD.org>

Fix "warning: comparison is always false due to limited range of data type"
on platforms with unsigned chars. The comparison in question is there to
determine whether chars are unsigned or not and is based on comparing a
char, initialized to -1, for less than 0. Change the comparison to check
for geater than 0 instead...


# 716b138b 13-Aug-2005 Stefan Farfeleder <stefanf@FreeBSD.org>

Put the comparison with PEOF into a new macro is_eof(). Don't use it if the
character comes from a string.


# 6195fb41 06-Apr-2004 Mark Murray <markm@FreeBSD.org>

Remove clause 3 from the UCB licenses.

OK'ed by: imp, core


# 09a80d48 01-May-2003 David E. O'Brien <obrien@FreeBSD.org>

Quiet warnings about copyright[].


# 54beeb39 02-Oct-2002 Tim J. Robbins <tjr@FreeBSD.org>

Use %d in a printf() format string and cast the argument to int instead of
using %td when we know that the number is between 0 and 9; mksyntax is a
build tool and needs to work on -stable.


# ec65e997 01-Oct-2002 Maxime Henrion <mux@FreeBSD.org>

Use the %t format modifier to print differences between
pointers. This fixes two format warnings on 64 bits
archs which are fatal now that WFORMAT=0 has been removed.

It doesn't fully fix the sh(1) build on 64 bits platforms
though, there is still some quad_t issues that need to be
fixed.

Tested on: i386, sparc64


# 2749b141 29-Jun-2002 David E. O'Brien <obrien@FreeBSD.org>

Consistently use FBSDID


# 5134c3f7 01-Feb-2002 Warner Losh <imp@FreeBSD.org>

o __P has been reoved
o Old-style K&R declarations have been converted to new C89 style
o register has been removed
o prototype for main() has been removed (gcc3 makes it an error)
o int main(int argc, char *argv[]) is the preferred main definition.
o Attempt to not break style(9) conformance for declarations more than
they already are.
o Change
int
foo() {
...
to
int
foo(void)
{
...


# c4c83940 14-Oct-2001 Tor Egge <tegge@FreeBSD.org>

Repair normally unused is_digit() macro.


# 5f2359b3 19-Sep-2001 Tor Egge <tegge@FreeBSD.org>

Adjust some type checks to include CTLQUOTEMARK in the range of
shell control characters.


# 26f6b0fb 19-Jun-2001 Dag-Erling Smørgrav <des@FreeBSD.org>

Add more headers that are required with -fno-builtin (stdlib and strings)


# 73f612b5 15-Dec-1999 Martin Cracauer <cracauer@FreeBSD.org>

First round of 8-bit fixes.


# 2a456239 27-Aug-1999 Peter Wemm <peter@FreeBSD.org>

$Id$ -> $FreeBSD$


# 6f47734f 06-Sep-1998 Tor Egge <tegge@FreeBSD.org>

Better handling of word splitting. Don't record the same region
multiple times when performing nested variable expansion, and
preserve some quoting information in order to avoid removing
apparently empty expansion result.


# 3d7b5b93 18-May-1998 Philippe Charnier <charnier@FreeBSD.org>

Add rcsid. Spelling.


# e7a0b024 18-May-1997 Steve Price <steve@FreeBSD.org>

Use the __unused attribute where warranted.


# b97fa2ef 22-Feb-1997 Peter Wemm <peter@FreeBSD.org>

Revert $FreeBSD$ to $Id$


# 1130b656 14-Jan-1997 Jordan K. Hubbard <jkh@FreeBSD.org>

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


# ab0a2172 13-Dec-1996 Steve Price <steve@FreeBSD.org>

Merge in NetBSD mods and -Wall cleaning.

Obtained from: NetBSD, me


# aa9caaf6 01-Sep-1996 Peter Wemm <peter@FreeBSD.org>

Merge of 4.4-Lite2 sh source, plus some gcc -Wall cleaning. This is a
merge of parallel duplicate work by Steve Price and myself. :-]

There are some changes to the build that are my fault... mkinit.c was
trying (poorly) to duplicate some of the work that make(1) is designed to
do. The Makefile hackery is my fault too, the depend list was incomplete
because of some explicit OBJS+= entries, so mkdep wasn't picking up their
source file #includes.

This closes a pile of /bin/sh PR's, but not all of them..

Submitted by: Steve Price <steve@bonsai.hiwaay.net>, peter


# c07cbf9c 12-Aug-1996 Andrey A. Chernov <ache@FreeBSD.org>

Take out 0201-0207 range - those characters abused by sh


# 917de9be 11-Aug-1996 Andrey A. Chernov <ache@FreeBSD.org>

Simplify expression


# ba726b8a 11-Aug-1996 Andrey A. Chernov <ache@FreeBSD.org>

Localize it


# 069428af 26-May-1996 Peter Wemm <peter@FreeBSD.org>

Import the 4.4BSD-Lite2 /bin/sh sources

Requested by: joerg

(Note, this is mostly going to be conflicts, which is expected. Our entire
sh source has a mainline, so this should not change anything except for
a few new files appearing. I dont think they are a problem)


# 89730b29 23-Sep-1994 David Greenman <dg@FreeBSD.org>

Added $Id$


# 4b88c807 26-May-1994 Rodney W. Grimes <rgrimes@FreeBSD.org>

BSD 4.4 Lite bin Sources