Commit Graph

37 Commits

Author SHA1 Message Date
Tony Finch
7dded4a50e Sync with upstream:
Allow the user to run unifdef without defining any symbols. This is
useful in conjunction with the -k flag.
Fix a bug in the -s handling code that would have caused out-of-bounds
array accesses.
Add a -n option to insert #line directives in the output.
Ignore comment markers inside string and character literals
(bug reported by Amos Shapira <amos.shapira@netregistry.com.au>).
More accurate copyright notices.
2005-03-08 12:52:00 +00:00
Ruslan Ermilov
6c7216df78 Sort sections. 2005-01-18 13:43:56 +00:00
Ruslan Ermilov
a866e17077 Added the EXIT STATUS section where appropriate. 2005-01-17 07:44:44 +00:00
Tony Finch
2fd339446d Improve expression evaluation debugging output, tidy up the handling of
EOF, and improve the commentary about backslash-newline handling.
2003-07-01 15:30:43 +00:00
Tony Finch
eb801906b8 Various fixes from upstream, including a bug...
Fix the usage synopsis.

Amend the copyright notice to reflect the fact that there's no Berkeley
code left.

Fix a typo in a comment, improve the descriptions of the way we use
some global variables (relevant to the bug below), and note that
division-by-zero has side effects so the current expression evaluator
can't be trivially extended to arithmetic in its current design.

Avoid hitting an abort(); /* bug */ when in "text mode" (i.e.
ignoring comment state) by updating the line parser state properly.

PR:	53907
2003-06-30 14:46:25 +00:00
Tony Finch
2611a92c3a MAINTAINER line moved to MAINTAINERS file. 2003-06-04 10:01:10 +00:00
David E. O'Brien
ebe901b4de Make GCC 3.3 happy with rcsid[], sccs[], and copyright[]. 2003-05-03 19:44:46 +00:00
Ruslan Ermilov
ace5be682d mdoc(7) police: Scheduled sweep. 2003-02-24 22:53:26 +00:00
Tony Finch
0723ff0c6a Sync with upstream again:
* Be less strict about multi-line preprocessor directives (e.g. those
    with comments hanging off the right-hand end) since they're more
    of a problem in practise than I expected. Prompted by phk.

* Fix the handling of "ignore" symbols.

* Style pedantry from OpenBSD and Ted Unangst <tedu@stanford.edu>,
    including some whitespace fixes and removal of strcpy()
    (and not including excessively strict KNF enforcement).

* Fix some typos and terminological inconsistencies.
2003-01-20 12:41:41 +00:00
Tony Finch
00c9c61ae5 Style fixes: brackets around the argument of return, and removal of
excess space.

Obtained from: OpenBSD
2003-01-17 19:12:02 +00:00
Tony Finch
07fd5f6a98 Add a necessary cast, because ptrdiff_t isn't necessarily the same as int.
Obtained from: OpenBSD
2003-01-17 19:10:18 +00:00
Ruslan Ermilov
811410d04a mdoc(7) police: markup nits. 2002-12-23 15:14:12 +00:00
Tony Finch
c284e87d6b Sync with up-stream version, including a number of bug-fixes:
* The partial-evaluation of #elif sequences was broken and the
spaghetti logic of its implementation was too hard to understand.
I've re-done it using a straight-forward table-driven push-down
automaton.

* The pre-processor line parser did not allow for all of the weird
places that people might put comments, which could have caused it
to add syntax-errors to the output by removing a #if line containing
the start- or end-marker of a comment.

* The lexer didn't need to special-case the handling of string-literals
or character-constants, but it did need to learn about line-continuations
(backslash-newline).

* The input routine was buggy and bit-rotten and trivially replacable
with fgets(). I've also made the program static- and const-safe and
improved the presentation-order. The formatting of the state-transition
tables remains non-stylish.

This commit-messsage was brought to you by code-point 45.

MFC-after: one-week
2002-12-18 20:50:44 +00:00
Ruslan Ermilov
d577099120 mdoc(7) police: s/nul character/null character/.
Approved by:	re
2002-12-04 14:42:49 +00:00
Tony Finch
36076c1e7b The spec says that unifdefall removes all #ifs, and this now requires
the -k flag to unifdef.
2002-09-24 19:50:03 +00:00
Tony Finch
981dbf5bac The readability is improved by reducing the use of the passive voice.
No changes to the meaning are made.
2002-09-24 19:48:39 +00:00
Tony Finch
352d0a6932 It is probably a bad idea to unconditionally process directives with
constant controlling expressions: in particular, removing #if 0 sections
is considered "rude". This commit changes the default so that such
things are passed through unchanged, and the old behaviour can be had
with the -k "kill konsts" flag.

Suggested by:	markm
MFC after:	3 weeks
2002-09-24 19:27:44 +00:00
Juli Mallett
3a7fc8ce59 Remove local prototypes for main(). 2002-08-19 03:07:56 +00:00
Ruslan Ermilov
2e9968fa36 Fixed improper SCRIPTS assignment that broke `clean'. 2002-07-21 21:03:47 +00:00
Tony Finch
5b6c090658 Character 0 is nul not null. 2002-05-30 11:42:44 +00:00
Ruslan Ermilov
24ef71e9f0 mdoc(7) police: tidy up. 2002-05-30 11:29:25 +00:00
Tony Finch
5ac21f6976 Sync with upstream version:
* Ensure we work within the array bounds when parsing command-line options;
  * Replace h0h0getopt with getopt(3);
  * Use consistent whitespace style in the function declarations.

Revieweded by:	dwmalone (mentor)
2002-05-23 16:50:41 +00:00
Tony Finch
3f220dd51a Upgrade unifdef:
* It now knows about the existence of #elif which would have
    caused it to produce incorrect results in some situations.

  * It can now process #if and #elif lines according to the
    values of symbols that are specified on the command line.
    The expression parser is only a simple subset of what C
    allows but it should be sufficient for most real-world
    code (it can cope with everything it finds in xterm).

  * It has an option for printing all of the symbols that might
    control #if processing. The unifdefall script uses this
    option along with cpp -dM to strip all #ifs from a file.

  * It has much larger static limits.

  * It handles nested #ifs much more completely.

There have also been many style improvements: KNF; ANSI function
definitions; all global stuff moved to the top of the file; use
stdbool instead of h0h0bool; const-correctness; err(3) instead
of fprintf(stderr, ...); enum instead of #define; commentary.

I used NetBSD's unifdef as the basis of this since it has received
the most attention over the years.

PR:		37454
Reviewed by:	markm, dwmalone
Approved by:	dwmalone (mentor)
MFC after:	3 weeks
2002-05-15 16:30:28 +00:00
Philippe Charnier
e8937ba009 Use `The .Nm utility' 2002-04-20 12:18:28 +00:00
Warner Losh
3f330d7d1a remove __P 2002-03-22 01:42:45 +00:00
Mark Murray
54750e1d8a WARNS=2 fixes, use __FBSDID(), kill register keyword. 2001-12-11 23:20:23 +00:00
Ruslan Ermilov
625003720a mdoc(7) police: removed HISTORY info from the .Os call. 2001-07-10 14:16:33 +00:00
Dima Dorfman
7a19d1bbb9 Include missing header files which define functions for which gcc has
builtins (e.g., exit, strcmp).
2001-06-24 19:50:42 +00:00
Jens Schweikhardt
7357c5cf15 Fix a grammar bogon. 2001-04-26 17:16:59 +00:00
Ruslan Ermilov
8fe908ef0c mdoc(7) police: use the new features of the Nm macro. 2000-11-20 19:21:22 +00:00
Ruslan Ermilov
726b61ab5f Avoid use of direct troff requests in mdoc(7) manual pages. 2000-11-10 17:46:15 +00:00
David E. O'Brien
bcfa1e3a90 The last "-iDsym" makes more sense as "-iUsym". 2000-10-22 23:49:29 +00:00
Peter Wemm
c3aac50f28 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
Nik Clayton
3be5f1f5ce Add $Id$, to make it simpler for members of the translation teams to
track.

The $Id$ line is normally at the bottom of the main comment block in the
man page, separated from the rest of the manpage by an empty comment,
like so;

     .\"    $Id$
     .\"

If the immediately preceding comment is a @(#) format ID marker than the
the $Id$ will line up underneath it with no intervening blank lines.
Otherwise, an additional blank line is inserted.

Approved by:            bde
1999-07-12 20:24:20 +00:00
Philippe Charnier
014927909d Main() returns int. 1997-08-26 11:08:24 +00:00
Philippe Charnier
cccb40360b Use err(3). Add usage(). Remove progname. 1997-08-20 11:07:53 +00:00
Rodney W. Grimes
9b50d90275 BSD 4.4 Lite Usr.bin Sources 1994-05-27 12:33:43 +00:00