|
|
@@ -478,7 +478,7 @@ static struct optparse options;
|
|
|
|
|
|
static void write1(const char *out)
|
|
|
{
|
|
|
- fputs(out, stdout);
|
|
|
+ rt_kprintf(out);
|
|
|
}
|
|
|
|
|
|
static int vi_main(int argc, char **argv)
|
|
|
@@ -547,8 +547,7 @@ static int vi_main(int argc, char **argv)
|
|
|
show_help();
|
|
|
// fall through
|
|
|
default:
|
|
|
- bb_show_usage();
|
|
|
- FREE_PTR_TO_GLOBALS(); // RT-Thread team added
|
|
|
+ rt_kprintf("Usage: vi [FILE]\n"); /*bb_show_usage()*/
|
|
|
return 1;
|
|
|
}
|
|
|
}
|
|
|
@@ -1056,7 +1055,7 @@ static void colon(char *buf)
|
|
|
cookmode();
|
|
|
retcode = system(orig_buf + 1); // run the cmd
|
|
|
if (retcode)
|
|
|
- printf("\nshell returned %i\n\n", retcode);
|
|
|
+ rt_kprintf("\nshell returned %i\n\n", retcode);
|
|
|
rawmode();
|
|
|
Hit_Return(); // let user see results
|
|
|
}
|
|
|
@@ -1381,14 +1380,14 @@ static void colon(char *buf)
|
|
|
size = r - q + 1;
|
|
|
//if (useforce) {
|
|
|
// if "fn" is not write-able, chmod u+w
|
|
|
- // sprintf(syscmd, "chmod u+w %s", fn);
|
|
|
+ // rt_sprintf(syscmd, "chmod u+w %s", fn);
|
|
|
// system(syscmd);
|
|
|
// forced = TRUE;
|
|
|
//}
|
|
|
l = file_write(fn, q, r);
|
|
|
//if (useforce && forced) {
|
|
|
// chmod u-w
|
|
|
- // sprintf(syscmd, "chmod u-w %s", fn);
|
|
|
+ // rt_sprintf(syscmd, "chmod u-w %s", fn);
|
|
|
// system(syscmd);
|
|
|
// forced = FALSE;
|
|
|
//}
|
|
|
@@ -2554,7 +2553,7 @@ static void start_new_cmd_q(char c)
|
|
|
// get buffer for new cmd
|
|
|
// if there is a current cmd count put it in the buffer first
|
|
|
if (cmdcnt > 0) {
|
|
|
- lmc_len = sprintf(last_modifying_cmd, "%u%c", cmdcnt, c);
|
|
|
+ lmc_len = rt_sprintf(last_modifying_cmd, "%u%c", cmdcnt, c);
|
|
|
} else { // just save char c onto queue
|
|
|
last_modifying_cmd[0] = c;
|
|
|
lmc_len = 1;
|
|
|
@@ -2758,7 +2757,7 @@ static int readit(void) // read (maybe cursor) key from stdin
|
|
|
goto again;
|
|
|
go_bottom_and_clear_to_eol();
|
|
|
cookmode(); // terminal to "cooked"
|
|
|
- bb_simple_error_msg_and_die("can't read user input");
|
|
|
+ rt_kprintf("can't read user input");
|
|
|
}
|
|
|
return c;
|
|
|
}
|
|
|
@@ -2965,7 +2964,7 @@ static void place_cursor(int row, int col)
|
|
|
if (col < 0) col = 0;
|
|
|
if (col >= columns) col = columns - 1;
|
|
|
|
|
|
- sprintf(cm1, ESC_SET_CURSOR_POS, row + 1, col + 1);
|
|
|
+ rt_sprintf(cm1, ESC_SET_CURSOR_POS, row + 1, col + 1);
|
|
|
write1(cm1);
|
|
|
}
|
|
|
|
|
|
@@ -3069,7 +3068,7 @@ static void status_line_bold(const char *format, ...)
|
|
|
|
|
|
va_start(args, format);
|
|
|
strcpy(status_buffer, ESC_BOLD_TEXT);
|
|
|
- vsnprintf(status_buffer + (sizeof(ESC_BOLD_TEXT)-1),
|
|
|
+ rt_vsnprintf(status_buffer + (sizeof(ESC_BOLD_TEXT)-1),
|
|
|
STATUS_BUFFER_LEN - sizeof(ESC_BOLD_TEXT) - sizeof(ESC_NORM_TEXT),
|
|
|
format, args
|
|
|
);
|
|
|
@@ -3090,7 +3089,7 @@ static void status_line(const char *format, ...)
|
|
|
va_list args;
|
|
|
|
|
|
va_start(args, format);
|
|
|
- vsnprintf(status_buffer, STATUS_BUFFER_LEN, format, args);
|
|
|
+ rt_vsnprintf(status_buffer, STATUS_BUFFER_LEN, format, args);
|
|
|
va_end(args);
|
|
|
|
|
|
have_status_msg = 1;
|
|
|
@@ -3186,7 +3185,7 @@ static int format_edit_status(void)
|
|
|
trunc_at = columns < STATUS_BUFFER_LEN-1 ?
|
|
|
columns : STATUS_BUFFER_LEN-1;
|
|
|
|
|
|
- ret = snprintf(status_buffer, trunc_at+1,
|
|
|
+ ret = rt_snprintf(status_buffer, trunc_at+1,
|
|
|
#if ENABLE_FEATURE_VI_READONLY
|
|
|
"%c %s%s%s %d/%d %d%%",
|
|
|
#else
|
|
|
@@ -4428,7 +4427,7 @@ static void crash_test()
|
|
|
}
|
|
|
|
|
|
if (msg[0]) {
|
|
|
- printf("\n\n%d: \'%c\' %s\n\n\n%s[Hit return to continue]%s",
|
|
|
+ rt_kprintf("\n\n%d: \'%c\' %s\n\n\n%s[Hit return to continue]%s",
|
|
|
totalcmds, last_input_char, msg, ESC_BOLD_TEXT, ESC_NORM_TEXT);
|
|
|
fflush_all();
|
|
|
while (safe_read(STDIN_FILENO, d, 1) > 0) {
|
|
|
@@ -4438,7 +4437,7 @@ static void crash_test()
|
|
|
}
|
|
|
tim = time(NULL);
|
|
|
if (tim >= (oldtim + 3)) {
|
|
|
- sprintf(status_buffer,
|
|
|
+ rt_sprintf(status_buffer,
|
|
|
"Tot=%d: M=%d N=%d I=%d D=%d Y=%d P=%d U=%d size=%d",
|
|
|
totalcmds, M, N, I, D, Y, P, U, end - text + 1);
|
|
|
oldtim = tim;
|