Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/games/cgram cgram: replace comments with code
details: https://anonhg.NetBSD.org/src/rev/0e41b7e1fd93
branches: trunk
changeset: 374714:0e41b7e1fd93
user: rillig <rillig%NetBSD.org@localhost>
date: Wed May 10 12:30:27 2023 +0000
description:
cgram: replace comments with code
No binary change.
diffstat:
games/cgram/cgram.c | 19 ++++++++++---------
1 files changed, 10 insertions(+), 9 deletions(-)
diffs (63 lines):
diff -r ff3c71796438 -r 0e41b7e1fd93 games/cgram/cgram.c
--- a/games/cgram/cgram.c Wed May 10 12:23:42 2023 +0000
+++ b/games/cgram/cgram.c Wed May 10 12:30:27 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cgram.c,v 1.29 2022/06/12 14:59:44 rillig Exp $ */
+/* $NetBSD: cgram.c,v 1.30 2023/05/10 12:30:27 rillig Exp $ */
/*-
* Copyright (c) 2013, 2021 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.c,v 1.29 2022/06/12 14:59:44 rillig Exp $");
+__RCSID("$NetBSD: cgram.c,v 1.30 2023/05/10 12:30:27 rillig Exp $");
#endif
#include <assert.h>
@@ -488,21 +488,22 @@ handle_key(void)
{
int ch = getch();
+#define CTRL(letter) (letter - 64)
switch (ch) {
- case 1: /* ^A */
+ case CTRL('A'):
case KEY_BEG:
case KEY_HOME:
cursor_x = 0;
break;
- case 2: /* ^B */
+ case CTRL('B'):
case KEY_LEFT:
go_left();
break;
- case 5: /* ^E */
+ case CTRL('E'):
case KEY_END:
cursor_x = cur_max_x();
break;
- case 6: /* ^F */
+ case CTRL('F'):
case KEY_RIGHT:
go_right();
break;
@@ -515,14 +516,14 @@ handle_key(void)
case '\n':
go_to_next_line();
break;
- case 12: /* ^L */
+ case CTRL('L'):
clear();
break;
- case 14: /* ^N */
+ case CTRL('N'):
case KEY_DOWN:
cursor_y++;
break;
- case 16: /* ^P */
+ case CTRL('P'):
case KEY_UP:
cursor_y--;
break;
Home |
Main Index |
Thread Index |
Old Index