Use the options.awk script to generate options_def.h (as in nvi distribution).

Modify options.awk to detect an incorrectly sorted options array.
NB: if GTAGS is undefined theses sources will still generate invalid programs.
This commit is contained in:
dsl 2003-08-28 16:23:40 +00:00
parent eb24d00445
commit 43d69358c2
3 changed files with 20 additions and 84 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.19 2001/05/01 16:48:43 aymeric Exp $
# $NetBSD: Makefile,v 1.20 2003/08/28 16:23:40 dsl Exp $
#
# @(#)Makefile.in 8.75 (Berkeley) 10/23/96
@ -35,5 +35,10 @@ MLINKS= vi.1 ex.1 vi.1 view.1
.PATH: ${.CURDIR}/../vi ${.CURDIR}/../ex ${.CURDIR}/../cl
.PATH: ${.CURDIR}/../common ${.CURDIR}/../docs/USD.doc/vi.man
CFLAGS+= -I.
options_def.h: options.awk options.c
awk -f ${.ALLSRC} >${.TARGET}
.include "../../Makefile.inc"
.include <bsd.prog.mk>

View File

@ -1,9 +1,21 @@
# $NetBSD: options.awk,v 1.3 2001/03/31 11:37:46 aymeric Exp $
# $NetBSD: options.awk,v 1.4 2003/08/28 16:23:41 dsl Exp $
#
# @(#)options.awk 10.1 (Berkeley) 6/8/95
/^\/\* O_[0-9A-Z_]*/ {
printf("#define %s %d\n", $2, cnt++);
opt = $2
printf("#define %s %d\n", opt, cnt++);
ofs = FS
FS = "\""
do getline
while ($1 != " {")
FS = ofs
opt_name = $2
if (opt_name < prev_name) {
printf "missorted %s: \"%s\" < \"%s\"\n", opt, opt_name, prev_name >"/dev/stderr"
exit 1
}
prev_name = opt_name
next;
}
END {

View File

@ -1,81 +0,0 @@
#define O_ALTWERASE 0
#define O_AUTOINDENT 1
#define O_AUTOPRINT 2
#define O_AUTOWRITE 3
#define O_BACKUP 4
#define O_BEAUTIFY 5
#define O_CDPATH 6
#define O_CEDIT 7
#define O_COLUMNS 8
#define O_COMMENT 9
#define O_DIRECTORY 10
#define O_EDCOMPATIBLE 11
#define O_ERRORBELLS 12
#define O_ESCAPETIME 13
#define O_EXRC 14
#define O_EXTENDED 15
#define O_FILEC 16
#define O_FLASH 17
#define O_GTAGSMODE 18
#define O_HARDTABS 19
#define O_ICLOWER 20
#define O_IGNORECASE 21
#define O_KEYTIME 22
#define O_LEFTRIGHT 23
#define O_LINES 24
#define O_LISP 25
#define O_LIST 26
#define O_LOCKFILES 27
#define O_MAGIC 28
#define O_MATCHCHARS 29
#define O_MATCHTIME 30
#define O_MESG 31
#define O_MODELINE 32
#define O_MSGCAT 33
#define O_NOPRINT 34
#define O_NUMBER 35
#define O_OCTAL 36
#define O_OPEN 37
#define O_OPTIMIZE 38
#define O_PARAGRAPHS 39
#define O_PATH 40
#define O_PRINT 41
#define O_PROMPT 42
#define O_READONLY 43
#define O_RECDIR 44
#define O_REDRAW 45
#define O_REMAP 46
#define O_REPORT 47
#define O_RULER 48
#define O_SCROLL 49
#define O_SEARCHINCR 50
#define O_SECTIONS 51
#define O_SECURE 52
#define O_SHELL 53
#define O_SHELLMETA 54
#define O_SHIFTWIDTH 55
#define O_SHOWMATCH 56
#define O_SHOWMODE 57
#define O_SIDESCROLL 58
#define O_SLOWOPEN 59
#define O_SOURCEANY 60
#define O_TABSTOP 61
#define O_TAGLENGTH 62
#define O_TAGS 63
#define O_TERM 64
#define O_TERSE 65
#define O_TILDEOP 66
#define O_TIMEOUT 67
#define O_TTYWERASE 68
#define O_VERBOSE 69
#define O_W1200 70
#define O_W300 71
#define O_W9600 72
#define O_WARN 73
#define O_WINDOW 74
#define O_WINDOWNAME 75
#define O_WRAPLEN 76
#define O_WRAPMARGIN 77
#define O_WRAPSCAN 78
#define O_WRITEANY 79
#define O_OPTIONCOUNT 80