summaryrefslogtreecommitdiff
path: root/usr.bin/osh/osh.c
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-06-29 20:55:23 -0400
committerIan Moffett <ian@osmora.org>2025-06-29 20:55:23 -0400
commit0e3b384a2e97c41e14a7692472ac7c4454b3b227 (patch)
tree5a3bf06a609452cff5f4a6403d51c822bc74a975 /usr.bin/osh/osh.c
parent78fe4f99b6cb6c85be3d28fdb7ee8ac6de55575e (diff)
usr.bin: osh: Rename 'i' to 'buf_i'
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'usr.bin/osh/osh.c')
-rw-r--r--usr.bin/osh/osh.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/usr.bin/osh/osh.c b/usr.bin/osh/osh.c
index f36ba1e..4f90d47 100644
--- a/usr.bin/osh/osh.c
+++ b/usr.bin/osh/osh.c
@@ -63,7 +63,7 @@
#define PROMPT "[root::osmora]~ "
static char buf[64];
-static uint8_t i;
+static uint8_t buf_i;
static int running;
static int bell_fd;
static bool bs_bell = true; /* Beep on backspace */
@@ -209,7 +209,7 @@ getstr(void)
int input;
uint32_t beep_payload;
- i = 0;
+ buf_i = 0;
/*
* Prepare the beep payload @ 500 Hz
@@ -230,22 +230,22 @@ getstr(void)
/* return on newline */
if (c == '\n') {
- buf[i] = '\0';
+ buf[buf_i] = '\0';
putchar('\n');
return buf;
}
/* handle backspaces and DEL */
if (c == '\b' || c == 127) {
- if (i > 0) {
- i--;
+ if (buf_i > 0) {
+ buf_i--;
fputs("\b \b", stdout);
} else if (bell_fd > 0 && bs_bell) {
write(bell_fd, &beep_payload, sizeof(beep_payload));
}
- } else if (is_ascii(c) && i < sizeof(buf) - 1) {
+ } else if (is_ascii(c) && buf_i < sizeof(buf) - 1) {
/* write to fd and add to buffer */
- buf[i++] = c;
+ buf[buf_i++] = c;
putchar(c);
}
}
@@ -383,7 +383,7 @@ main(int argc, char **argv)
return open_script(argv[1]);
}
- i = 0;
+ buf_i = 0;
running = 1;
found = 0;
bell_fd = open("/dev/beep", O_WRONLY);