ping

On 11/11/17 10:59, Martijn van Duren wrote:
> Hello tech@,
> 
> I've gotten confused by the awk scripts a few times now.
> They seem to unused and I had to really look where they were originally
> intended. For the curious:
> awk -f common/options.awk common/options.c > include/options_def.h
> awk -f ex/ex.awk ex/ex_cmd.c > include/ex_def.h
> 
> The options_def.h file has moved from define to enum by bentley earlier
> this year, so there seems to be no motivation to move back to the awk
> scripts.
> 
> This does however mean that we have to keep a close eye on the options
> and commands we expose and keep them in sync manually.
> 
> Another option would be to keep the scripts and hook them into the
> makefile and cvs rm include/{options,ex}_def.h, but that would require
> some black magic I haven't mastered yet.
> 
> OK to remove the scripts and to make {options,ex}_def.h consistent?
> 
> martijn@
> 
> Index: common/options.awk
> ===================================================================
> RCS file: common/options.awk
> diff -N common/options.awk
> --- common/options.awk        29 Jan 2001 01:58:31 -0000      1.3
> +++ /dev/null 1 Jan 1970 00:00:00 -0000
> @@ -1,11 +0,0 @@
> -#    $OpenBSD: options.awk,v 1.3 2001/01/29 01:58:31 niklas Exp $
> -
> -#    @(#)options.awk 10.1 (Berkeley) 6/8/95
> - 
> -/^\/\* O_[0-9A-Z_]*/ {
> -     printf("#define %s %d\n", $2, cnt++);
> -     next;
> -}
> -END {
> -     printf("#define O_OPTIONCOUNT %d\n", cnt);
> -}
> Index: ex/ex.awk
> ===================================================================
> RCS file: ex/ex.awk
> diff -N ex/ex.awk
> --- ex/ex.awk 29 Jan 2001 01:58:40 -0000      1.2
> +++ /dev/null 1 Jan 1970 00:00:00 -0000
> @@ -1,8 +0,0 @@
> -#    $OpenBSD: ex.awk,v 1.2 2001/01/29 01:58:40 niklas Exp $
> -
> -#    @(#)ex.awk      10.1 (Berkeley) 6/8/95
> - 
> -/^\/\* C_[0-9A-Z_]* \*\/$/ {
> -     printf("#define %s %d\n", $2, cnt++);
> -     next;
> -}
> Index: include/ex_def.h
> ===================================================================
> RCS file: /cvs/src/usr.bin/vi/include/ex_def.h,v
> retrieving revision 1.5
> diff -u -p -a -u -r1.5 ex_def.h
> --- include/ex_def.h  19 Nov 2015 07:53:31 -0000      1.5
> +++ include/ex_def.h  11 Nov 2017 09:27:46 -0000
> @@ -1,76 +1,78 @@
>  /*   $OpenBSD: ex_def.h,v 1.5 2015/11/19 07:53:31 bentley Exp $      */
>  
> -#define C_SCROLL 0
> -#define C_BANG 1
> -#define C_HASH 2
> -#define C_SUBAGAIN 3
> -#define C_STAR 4
> -#define C_SHIFTL 5
> -#define C_EQUAL 6
> -#define C_SHIFTR 7
> -#define C_AT 8
> -#define C_APPEND 9
> -#define C_ABBR 10
> -#define C_ARGS 11
> -#define C_BG 12
> -#define C_CHANGE 13
> -#define C_CD 14
> -#define C_CHDIR 15
> -#define C_COPY 16
> -#define C_DELETE 17
> -#define C_DISPLAY 18
> -#define C_EDIT 19
> -#define C_EX 20
> -#define C_EXUSAGE 21
> -#define C_FILE 22
> -#define C_FG 23
> -#define C_GLOBAL 24
> -#define C_HELP 25
> -#define C_INSERT 26
> -#define C_JOIN 27
> -#define C_K 28
> -#define C_LIST 29
> -#define C_MOVE 30
> -#define C_MARK 31
> -#define C_MAP 32
> -#define C_MKEXRC 33
> -#define C_NEXT 34
> -#define C_NUMBER 35
> -#define C_OPEN 36
> -#define C_PRINT 37
> -#define C_PRESERVE 38
> -#define C_PREVIOUS 39
> -#define C_PUT 40
> -#define C_QUIT 41
> -#define C_READ 42
> -#define C_RECOVER 43
> -#define C_RESIZE 44
> -#define C_REWIND 45
> -#define C_SUBSTITUTE 46
> -#define C_SCRIPT 47
> -#define C_SET 48
> -#define C_SHELL 49
> -#define C_SOURCE 50
> -#define C_STOP 51
> -#define C_SUSPEND 52
> -#define C_T 53
> -#define C_TAG 54
> -#define C_TAGNEXT 55
> -#define C_TAGPOP 56
> -#define C_TAGPREV 57
> -#define C_TAGTOP 58
> -#define C_UNDO 59
> -#define C_UNABBREVIATE 60
> -#define C_UNMAP 61
> -#define C_V 62
> -#define C_VERSION 63
> -#define C_VISUAL_EX 64
> -#define C_VISUAL_VI 65
> -#define C_VIUSAGE 66
> -#define C_WRITE 67
> -#define C_WN 68
> -#define C_WQ 69
> -#define C_XIT 70
> -#define C_YANK 71
> -#define C_Z 72
> -#define C_SUBTILDE 73
> +enum {
> +     C_SCROLL = 0,
> +     C_BANG,
> +     C_HASH,
> +     C_SUBAGAIN,
> +     C_STAR,
> +     C_SHIFTL,
> +     C_EQUAL,
> +     C_SHIFTR,
> +     C_AT,
> +     C_APPEND,
> +     C_ABBR,
> +     C_ARGS,
> +     C_BG,
> +     C_CHANGE,
> +     C_CD,
> +     C_CHDIR,
> +     C_COPY,
> +     C_DELETE,
> +     C_DISPLAY,
> +     C_EDIT,
> +     C_EX,
> +     C_EXUSAGE,
> +     C_FILE,
> +     C_FG,
> +     C_GLOBAL,
> +     C_HELP,
> +     C_INSERT,
> +     C_JOIN,
> +     C_K,
> +     C_LIST,
> +     C_MOVE,
> +     C_MARK,
> +     C_MAP,
> +     C_MKEXRC,
> +     C_NEXT,
> +     C_NUMBER,
> +     C_OPEN,
> +     C_PRINT,
> +     C_PRESERVE,
> +     C_PREVIOUS,
> +     C_PUT,
> +     C_QUIT,
> +     C_READ,
> +     C_RECOVER,
> +     C_RESIZE,
> +     C_REWIND,
> +     C_SUBSTITUTE,
> +     C_SCRIPT,
> +     C_SET,
> +     C_SHELL,
> +     C_SOURCE,
> +     C_STOP,
> +     C_SUSPEND,
> +     C_T,
> +     C_TAG,
> +     C_TAGNEXT,
> +     C_TAGPOP,
> +     C_TAGPREV,
> +     C_TAGTOP,
> +     C_UNDO,
> +     C_UNABBREVIATE,
> +     C_UNMAP,
> +     C_V,
> +     C_VERSION,
> +     C_VISUAL_EX,
> +     C_VISUAL_VI,
> +     C_VIUSAGE,
> +     C_WRITE,
> +     C_WN,
> +     C_WQ,
> +     C_XIT,
> +     C_YANK,
> +     C_Z,
> +     C_SUBTILDE
> +};
> Index: include/options_def.h
> ===================================================================
> RCS file: /cvs/src/usr.bin/vi/include/options_def.h,v
> retrieving revision 1.8
> diff -u -p -a -u -r1.8 options_def.h
> --- include/options_def.h     3 Jul 2017 07:01:14 -0000       1.8
> +++ include/options_def.h     11 Nov 2017 09:27:46 -0000
> @@ -71,5 +71,5 @@ enum {
>       O_WRAPMARGIN,
>       O_WRAPSCAN,
>       O_WRITEANY,
> -     O_OPTIONCOUNT,
> +     O_OPTIONCOUNT
>  };
> 

Reply via email to