mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] edit: replace ASCII codes by symbolic names
@ 2019-09-09  9:20 Ahmad Fatoum
  2019-09-09 13:15 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2019-09-09  9:20 UTC (permalink / raw)
  To: barebox

Code has some magic numbers, replace them. This has the added benefit that
at least the touched lines are now charset-agnostic.

Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 commands/edit.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/commands/edit.c b/commands/edit.c
index 290222ce152f..ba6a8c7cdd78 100644
--- a/commands/edit.c
+++ b/commands/edit.c
@@ -524,12 +524,12 @@ static int do_edit(int argc, char *argv[])
 			} else
 				delete_char(textx);
 			break;
-		case 13:
-		case 10:
+		case '\r':
+		case '\n':
 			split_line();
 			break;
 		case 127:
-		case 8:
+		case '\b':
 			if (textx > 0) {
 				textx--;
 				delete_char(textx);
@@ -542,10 +542,10 @@ static int do_edit(int argc, char *argv[])
 				merge_line(curline);
 			}
 			break;
-		case 4:
+		case CTL_CH('d'):
 			ret = save_file(argv[1]);
 			goto out;
-		case 3:
+		case CTL_CH('c'):
 			goto out;
 		default:
 			if ((signed char)c != -1)
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-09-09 13:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-09  9:20 [PATCH] edit: replace ASCII codes by symbolic names Ahmad Fatoum
2019-09-09 13:15 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox