"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "mt.c" between
multitail-6.4.2.tgz and multitail-6.5.0.tgz

About: multitail lets you view one or multiple files like the original tail program.

mt.c  (multitail-6.4.2.tgz):mt.c  (multitail-6.5.0.tgz)
skipping to change at line 37 skipping to change at line 37
#endif #endif
#include <sys/time.h> #include <sys/time.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <unistd.h> #include <unistd.h>
#if defined(__GLIBC__) && ( __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 2)) #if defined(__GLIBC__) && ( __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 2))
#include <sys/sysinfo.h> #include <sys/sysinfo.h>
#endif #endif
/* syslog receive */ /* syslog receive */
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <netdb.h>
#ifdef UTF8_SUPPORT #ifdef UTF8_SUPPORT
#include <wchar.h> #include <wchar.h>
#include <wctype.h> #include <wctype.h>
#endif #endif
#include "mt.h" #include "mt.h"
#include "globals.h" #include "globals.h"
#include "error.h" #include "error.h"
#include "mem.h" #include "mem.h"
#include "utils.h" #include "utils.h"
skipping to change at line 459 skipping to change at line 459
waddch(win -> win, ' '); waddch(win -> win, ' ');
} }
return 1; return 1;
} }
char find_highlight_matches(regmatch_t *matches, char use_regex, int offset) char find_highlight_matches(regmatch_t *matches, char use_regex, int offset)
{ {
int match_offset; int match_offset;
if (!matches)
return 0;
for(match_offset=0; match_offset<MAX_N_RE_MATCHES; match_offset++) for(match_offset=0; match_offset<MAX_N_RE_MATCHES; match_offset++)
{ {
char matching; char matching;
if (matches[match_offset].rm_so == -1) if (matches[match_offset].rm_so == -1)
{ {
return 0; return 0;
} }
matching = offset >= matches[match_offset].rm_so && offset < matc hes[match_offset].rm_eo; matching = offset >= matches[match_offset].rm_so && offset < matc hes[match_offset].rm_eo;
skipping to change at line 619 skipping to change at line 622
/* print text */ /* print text */
for(offset=prt_start; offset<prt_end;) for(offset=prt_start; offset<prt_end;)
{ {
char re_inv = default_reverse_state; char re_inv = default_reverse_state;
char is_control_or_extended_ascii = 0; char is_control_or_extended_ascii = 0;
myattr_t new_cdev = { -1, -1 }; myattr_t new_cdev = { -1, -1 };
#ifdef UTF8_SUPPORT #ifdef UTF8_SUPPORT
const char *dummy = &use_string[offset]; const char *dummy = &use_string[offset];
wchar_t wcur = 0;
mbsrtowcs(&wcur, &dummy, 1, NULL); wchar_t wcur = '?';
static mbstate_t state;
if (mbsrtowcs(&wcur, &dummy, 1, &state) == -1) {
wcur = '?';
memset(&state, 0x00, sizeof(mbstate_t));
}
#else #else
char wcur = use_string[offset]; char wcur = use_string[offset];
#endif #endif
if (ww != NULL && offset == ww[ww_offset]) if (ww != NULL && offset == ww[ww_offset])
{ {
wprintw(win -> win, "\n"); wprintw(win -> win, "\n");
ww_offset++; ww_offset++;
#ifdef UTF8_SUPPORT #ifdef UTF8_SUPPORT
skipping to change at line 694 skipping to change at line 703
{ {
myattr_off(win, cdev); myattr_off(win, cdev);
myattr_on(win, new_cdev); myattr_on(win, new_cdev);
cdev = new_cdev; cdev = new_cdev;
} }
if (!is_control_or_extended_ascii) if (!is_control_or_extended_ascii)
{ {
#ifdef UTF8_SUPPORT #if defined(UTF8_SUPPORT) && defined(NCURSES_WIDECHAR)
// FIXME warning: implicit declaration of function ‘waddnwstr’ is invalid in C99
[-Wimplicit-function-declaration]
// see /usr/include/ncurses.h
waddnwstr(win -> win, &wcur, 1); waddnwstr(win -> win, &wcur, 1);
#else #else
wprintw(win -> win, "%c", wcur); wprintw(win -> win, "%c", wcur);
#endif #endif
disp_offset++; disp_offset++;
} }
else else
{ {
/* error_exit("> 126 %d: %02x %02x %02x", wcur, use_strin g[offset+0], use_string[offset+1], use_string[offset+2]); */ /* error_exit("> 126 %d: %02x %02x %02x", wcur, use_strin g[offset+0], use_string[offset+1], use_string[offset+2]); */
skipping to change at line 1344 skipping to change at line 1355
if (pmatch) myfree(pmatch); if (pmatch) myfree(pmatch);
if (new_line != line) myfree(new_line); if (new_line != line) myfree(new_line);
return something_got_displayed; return something_got_displayed;
} }
void update_statusline(NEWWIN *status, int win_nr, proginfo *cur) void update_statusline(NEWWIN *status, int win_nr, proginfo *cur)
{ {
if (mode_statusline > 0 && status != NULL && cur != NULL) if (mode_statusline > 0 && status != NULL && cur != NULL)
{ {
int dx;
myattr_t attrs = statusline_attrs; myattr_t attrs = statusline_attrs;
int statusline_len = 0; int statusline_len = 0;
off64_t fsize = (off64_t)-1; off64_t fsize = (off64_t)-1;
time_t ts = time(NULL); time_t ts = time(NULL);
char show_f1 = 0; char show_f1 = 0;
int help_str_offset = 0; int help_str_offset = 0;
int total_info_len = 0; int total_info_len = 0;
int win_width; int win_width;
char *fname = cur -> filename; char *fname = cur -> filename;
char timestamp[TIMESTAMP_EXTEND_BUFFER]; char timestamp[TIMESTAMP_EXTEND_BUFFER];
skipping to change at line 3091 skipping to change at line 3101
error_exit(FALSE, FALSE, "Failed to start tail process for %s.\n", cur -> filename); error_exit(FALSE, FALSE, "Failed to start tail process for %s.\n", cur -> filename);
if (cur -> pid < 2) if (cur -> pid < 2)
error_exit(FALSE, FALSE, "pid is %d, %d\n", cur -> pid, cur -> wt); error_exit(FALSE, FALSE, "pid is %d, %d\n", cur -> pid, cur -> wt);
new_wins = 1; new_wins = 1;
} }
} /* check all matched files */ } /* check all matched files */
cdg[loop].last_check = now; cdg[loop].last_check = now;
globfree(&files);
} /* time for a check? */ } /* time for a check? */
} /* check all search patterns */ } /* check all search patterns */
return new_wins; return new_wins;
} }
void resize_terminal_do(NEWWIN *popup) void resize_terminal_do(NEWWIN *popup)
{ {
determine_terminal_size(&max_y, &max_x); determine_terminal_size(&max_y, &max_x);
skipping to change at line 3206 skipping to change at line 3218
char *pnt = data_in; char *pnt = data_in;
char statusline_update_needed = 0; char statusline_update_needed = 0;
/* statistics */ /* statistics */
cur -> statistics.bytes_processed += n_bytes_added; cur -> statistics.bytes_processed += n_bytes_added;
data_in[new_data_offset + n_bytes_added] = 0x00; data_in[new_data_offset + n_bytes_added] = 0x00;
if (strchr(&data_in[new_data_offset], '\n')) if (strchr(&data_in[new_data_offset], '\n'))
{ {
char emitted = 0;
if (cur -> cont) /* reconnect lines with '\' */ if (cur -> cont) /* reconnect lines with '\' */
{ {
char *contsearch = pnt; char *contsearch = pnt;
while((contsearch = strstr(contsearch, "\\\n"))) while((contsearch = strstr(contsearch, "\\\n")))
{ {
memmove(contsearch, contsearch + 2, strlen(contse arch + 2) + 1); memmove(contsearch, contsearch + 2, strlen(contse arch + 2) + 1);
} }
} }
if (cur -> restart.is_restarted && cur -> restart.restart_clear)
{
delete_be_in_buffer(&lb[win_nr]);
cur -> restart.is_restarted = 0;
werase(pi[win_nr].data -> win);
}
update_panels();
/* display lines */ /* display lines */
for(;*pnt;) for(;*pnt;)
{ {
char *end = strchr(pnt, '\n'); char *end = strchr(pnt, '\n');
if (!end) if (!end)
break; break;
*end = 0x00; *end = 0x00;
/* redirect to some other file/pipe? */ /* redirect to some other file/pipe? */
skipping to change at line 3267 skipping to change at line 3286
{ {
store_for_diff(&cur -> restart.diff, pnt); store_for_diff(&cur -> restart.diff, pnt);
} }
else /* no, just output */ else /* no, just output */
{ {
if (get_do_refresh() == 0) if (get_do_refresh() == 0)
set_do_refresh(1); /* after update interv al, update screen */ set_do_refresh(1); /* after update interv al, update screen */
statusline_update_needed |= emit_to_buffer_and_te rm(win_nr, cur, pnt); statusline_update_needed |= emit_to_buffer_and_te rm(win_nr, cur, pnt);
} }
if (!emitted)
{
emitted = 1;
if (cur -> restart.is_restarted && cur -> restart
.restart_clear)
{
cur -> restart.is_restarted = 0;
werase(pi[win_nr].data -> win);
}
update_panels();
}
pnt = end + 1; pnt = end + 1;
} }
} }
if (*pnt != 0x00) if (*pnt != 0x00)
{ {
int line_len = strlen(pnt) + 1; int line_len = strlen(pnt) + 1;
cur -> incomplete_line = mymalloc(line_len); cur -> incomplete_line = mymalloc(line_len);
memcpy(cur -> incomplete_line, pnt, line_len); memcpy(cur -> incomplete_line, pnt, line_len);
} }
 End of changes. 10 change blocks. 
22 lines changed or deleted 27 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)