History log of /freebsd-9.3-release/bin/sh/mksyntax.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 267654 19-Jun-2014 gjb

Copy stable/9 to releng/9.3 as part of the 9.3-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 247163 22-Feb-2013 jilles

MFC r246522: 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.

Submitted by: Christoph Mallon


# 247058 20-Feb-2013 jilles

MFC r246371: 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


# 225736 22-Sep-2011 kensmith

Copy head to stable/9 as part of 9.0-RELEASE release cycle.

Approved by: re (implicit)


# 221513 05-May-2011 jilles

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)


# 215568 20-Nov-2010 jilles

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.


# 214512 29-Oct-2010 jilles

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)


# 214305 24-Oct-2010 jilles

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)


# 212190 03-Sep-2010 jilles

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.


# 211084 08-Aug-2010 jilles

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


# 206473 11-Apr-2010 jilles

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.


# 206146 03-Apr-2010 jilles

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)


# 201053 27-Dec-2009 jilles

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"


# 193225 01-Jun-2009 rse

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


# 176392 18-Feb-2008 marcel

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...


# 149026 13-Aug-2005 stefanf

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


# 127958 06-Apr-2004 markm

Remove clause 3 from the UCB licenses.

OK'ed by: imp, core


# 114433 01-May-2003 obrien

Quiet warnings about copyright[].


# 104367 02-Oct-2002 tjr

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.


# 104275 01-Oct-2002 mux

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


# 99110 30-Jun-2002 obrien

Consistently use FBSDID


# 90111 02-Feb-2002 imp

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)
{
...


# 84936 14-Oct-2001 tegge

Repair normally unused is_digit() macro.


# 83674 19-Sep-2001 tegge

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


# 78469 19-Jun-2001 des

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


# 54631 15-Dec-1999 cracauer

First round of 8-bit fixes.


# 50471 27-Aug-1999 peter

$Id$ -> $FreeBSD$


# 38887 06-Sep-1998 tegge

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.


# 36150 18-May-1998 charnier

Add rcsid. Spelling.


# 25905 18-May-1997 steve

Use the __unused attribute where warranted.


# 22988 22-Feb-1997 peter

Revert $FreeBSD$ to $Id$


# 21673 14-Jan-1997 jkh

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.


# 20425 14-Dec-1996 steve

Merge in NetBSD mods and -Wall cleaning.

Obtained from: NetBSD, me


# 17987 01-Sep-1996 peter

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


# 17562 12-Aug-1996 ache

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


# 17538 12-Aug-1996 ache

Simplify expression


# 17525 11-Aug-1996 ache

Localize it


# 3044 24-Sep-1994 dg

Added $Id$


# 1557 26-May-1994 rgrimes

This commit was generated by cvs2svn to compensate for changes in r1556,
which included commits to RCS files with non-trunk default branches.


# 1556 26-May-1994 rgrimes

BSD 4.4 Lite bin Sources