diff --git a/STRINGS.CHANGES b/STRINGS.CHANGES index 39a3c32..9649ce3 100644 --- a/STRINGS.CHANGES +++ b/STRINGS.CHANGES @@ -23,6 +23,10 @@ LINE: 277 NEW OLDSTRING: (NONE) NEWSTRING: "\r\nScan for new personal mail? (Y/N/S): " +LINE: 88 MODIFIED +OLDSTRING: "\r\n\e[1;30m[\e[1;34m%3d\e[1;30m]: \e[0m%s" +NEWSTRING: "\r\n\e[1;30m[\e[1;34m%3d\e[1;30m]: \e[0m" + Changes from v0.8-alpha -> v0.9-alpha -------------------------------------------------------------- LINE: 255 NEW diff --git a/dist/magicka.strings b/dist/magicka.strings index 9f8593d..aec7f4c 100644 --- a/dist/magicka.strings +++ b/dist/magicka.strings @@ -86,7 +86,7 @@ Sorry, you don't have permission to upload in this Sub\r\n \r\nUse external editor? (Y/N) \r\n\e[1;32mMagicka Internal Editor, Type \e[1;37m/S \e[1;32mto save, \e[1;37m/A \e[1;32mto abort and \e[1;37m/? \e[1;32mfor help\r\n \e[1;30m-------------------------------------------------------------------------------\e[0m -\r\n\e[1;30m[\e[1;34m%3d\e[1;30m]: \e[0m%s +\r\n\e[1;30m[\e[1;34m%3d\e[1;30m]: \e[0m \r\nNo message to quote!\r\n \r\nQuote from Line: \r\nQuote to Line: diff --git a/src/bbs.c b/src/bbs.c index 40cfd11..95d5d95 100644 --- a/src/bbs.c +++ b/src/bbs.c @@ -537,6 +537,49 @@ char s_getc() { return (char)c; } +void s_readstring_inject(char *buffer, int max, char *inject) { + int i; + char c; + + memset(buffer, 0, max); + + if (strlen(inject) > max) { + return; + } + + strcpy(buffer, inject); + + s_printf("%s", inject); + + for (i=strlen(buffer);i 0) { + buffer[i-1] = '\0'; + i -= 2; + s_printf("\e[D \e[D"); + continue; + } else if (c == '\b' || c == 127) { + i -= 1; + continue; + } else if (c == 27) { + c = s_getchar(); + if (c == 91) { + c = s_getchar(); + } + i -= 1; + continue; + } + + if (c == '\n' || c == '\r') { + return; + } + s_putchar(c); + buffer[i] = c; + buffer[i+1] = '\0'; + } +} + void s_readstring(char *buffer, int max) { int i; char c; diff --git a/src/bbs.h b/src/bbs.h index 84d96d0..85030e6 100644 --- a/src/bbs.h +++ b/src/bbs.h @@ -262,6 +262,7 @@ extern void s_displayansi(char *file); extern char s_getchar(); extern void s_readpass(char *buffer, int max); extern void s_readstring(char *buffer, int max); +extern void s_readstring_inject(char *buffer, int max, char *inject); extern char s_getc(); extern void disconnect(char *calledby); extern void display_info(); diff --git a/src/mail_menu.c b/src/mail_menu.c index 397c5a0..9cc48f3 100644 --- a/src/mail_menu.c +++ b/src/mail_menu.c @@ -621,9 +621,9 @@ char *editor(struct user_record *user, char *quote, int quotelen, char *from, in s_printf(get_string(87)); while(!doquit) { - s_printf(get_string(88), lines, next_line_buffer); + s_printf(get_string(88), lines); strcpy(linebuffer, next_line_buffer); - s_readstring(&linebuffer[strlen(next_line_buffer)], 70 - strlen(next_line_buffer)); + s_readstring_inject(linebuffer, 70, next_line_buffer); memset(next_line_buffer, 0, 70); if (strlen(linebuffer) == 70 && linebuffer[69] != ' ') { diff --git a/src/www.c b/src/www.c index db36156..8e5dd4d 100644 --- a/src/www.c +++ b/src/www.c @@ -859,7 +859,6 @@ int www_handler(void * cls, struct MHD_Connection * connection, const char * url } else if (strcasecmp(url, "/files/areas/") == 0 || strcasecmp(url, "/files/areas") == 0) { page = www_files_areas(); whole_page = (char *)malloc(strlen(header) + strlen(page) + strlen(footer) + 1); - sprintf(whole_page, "%s%s%s", header, page, footer); } else if (strncasecmp(url, "/files/areas/", 13) == 0) { file_dir = -1;