X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=curs_lib.c;h=e5f9480a8596a035678325aca8322e2480573e93;hp=afd34b639e9e103718f205bd877360fba39c4eb1;hb=59926571aaec3e38cec09d0d9fa34f4a4b887309;hpb=bbc4fd52516a8afefbd14c77e34f8389d6f0a6ed diff --git a/curs_lib.c b/curs_lib.c index afd34b6..e5f9480 100644 --- a/curs_lib.c +++ b/curs_lib.c @@ -114,7 +114,7 @@ event_t mutt_getch (void) return (ch == ctrl ('G') ? err : ret); } -int _mutt_get_field ( /* const */ char *field, char *buf, size_t buflen, +int _mutt_get_field ( const char *field, char *buf, size_t buflen, int complete, int multiple, char ***files, int *numfiles) { int ret; @@ -156,19 +156,6 @@ void mutt_clear_error (void) CLEARLINE (LINES - 1); } -static void fix_end_of_file (const char *data) -{ - FILE *fp; - int c; - - if ((fp = safe_fopen (data, "a+")) == NULL) - return; - fseek (fp, -1, SEEK_END); - if ((c = fgetc (fp)) != '\n') - fputc ('\n', fp); - safe_fclose (&fp); -} - void mutt_edit_file (const char *editor, const char *data) { char cmd[LONG_STRING]; @@ -177,7 +164,6 @@ void mutt_edit_file (const char *editor, const char *data) mutt_expand_file_fmt (cmd, sizeof (cmd), editor, data); if (mutt_system (cmd) == -1) mutt_error (_("Error running \"%s\"!"), cmd); - fix_end_of_file (data); keypad (stdscr, TRUE); clearok (stdscr, TRUE); } @@ -276,7 +262,7 @@ void mutt_query_exit (void) if (Timeout) timeout (-1); /* restore blocking operation */ if (mutt_yesorno (_("Exit Mutt-ng?"), M_YES) == M_YES) { - endwin (); + mutt_endwin (NULL); exit (1); } mutt_clear_error (); @@ -310,6 +296,36 @@ void mutt_curses_error (const char *fmt, ...) set_option (OPTMSGERR); } +#ifdef USE_SOCKET +void mutt_progress_bar (progress_t* progress, long pos) { + char posstr[SHORT_STRING]; + + if (!pos) { + if (!NetInc) + mutt_message (progress->msg); + else { + if (progress->size) + mutt_pretty_size (progress->sizestr, sizeof (progress->sizestr), + progress->size); + progress->pos = 0; + } + } + + if (!NetInc) + return; + + if (pos >= progress->pos + (NetInc << 10)) { + progress->pos = pos; + pos = pos / (NetInc << 10) * (NetInc << 10); + mutt_pretty_size (posstr, sizeof (posstr), pos); + if (progress->size) + mutt_message ("%s %s/%s", progress->msg, posstr, progress->sizestr); + else + mutt_message ("%s %s", progress->msg, posstr); + } +} +#endif + void mutt_curses_message (const char *fmt, ...) { char TmpErrorbuf[STRING];