forked from halturin/multitail
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c884bda
Showing
66 changed files
with
21,524 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
Type: | ||
make install | ||
That's it! | ||
Make sure you have the ncursesw development libraries installed. | ||
Please note: ncursesW. Also see readme.txt. | ||
|
||
* * | ||
+-------------------------------+ | ||
|Press q' to exit the program. | | ||
|For help at any time, press F1.| | ||
+-------------------------------+ | ||
* * | ||
|
||
Since version 2.8.4 you can automatically send an e-mail | ||
with information of the system you're using. That way I | ||
have some statistics on the usage of MultiTail. It | ||
basically sends the output of 'uname -a'. To invoke all | ||
of this, enter: | ||
make thanks | ||
|
||
Is your company using MultiTail and you would like to be | ||
mentioned on http://www.vanheusden.com/multitail/usedby.html ? | ||
Then please send me a logo (not too big) and a link and I'll | ||
add it to that page. | ||
|
||
|
||
IRIX users | ||
---------- | ||
Use: | ||
make -f makefile.irix install | ||
|
||
AIX users | ||
--------- | ||
Make sure you have the GNU c-compiler installed. | ||
Then run: | ||
make install | ||
|
||
HP-UX users | ||
----------- | ||
You need the ncurses library! | ||
Then: | ||
make -f makefile.hpux install | ||
|
||
Solaris users | ||
------------- | ||
One needs at least version 7 of Solaris. | ||
Use: | ||
make -f makefile.solaris_gcc install | ||
or | ||
make -f makefile.solaris_sunwspro install | ||
(depending on the compiler you use). | ||
|
||
Mac OS X users: | ||
-------------- | ||
Use: | ||
make -f makefile.macosx install | ||
|
||
IRIX users: | ||
-------------- | ||
Use: | ||
make -f makefile.irix install | ||
|
||
SCO users: | ||
--------- | ||
MultiTail has been tested to run on SCO OpenServer v6. | ||
Use: | ||
make -f makefile.sco-openserver6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
include version | ||
|
||
PLATFORM:=$(shell uname) | ||
CPPFLAGS:=$(shell pkg-config --cflags ncurses) | ||
NCURSES_LIB:=$(shell pkg-config --libs ncurses) | ||
DEBUG:=#XXX -g -D_DEBUG ###-pg -Wpedantic ## -pg #-fprofile-arcs | ||
# pkg-config --libs --cflags ncurses | ||
# -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -lncurses -ltinfo | ||
|
||
UTF8_SUPPORT:=yes | ||
DESTDIR= | ||
PREFIX=/usr/local | ||
CONFIG_FILE=$(DESTDIR)$(PREFIX)/etc/multitail.conf | ||
|
||
CC?=gcc | ||
CFLAGS+=-Wall -Wno-unused-parameter -funsigned-char -O3 | ||
CPPFLAGS+=-D$(PLATFORM) -DVERSION=\"$(VERSION)\" $(DEBUG) -DCONFIG_FILE=\"$(CONFIG_FILE)\" -D_FORTIFY_SOURCE=2 | ||
|
||
# build dependency files while compile (*.d) | ||
CPPFLAGS+= -MMD -MP | ||
|
||
|
||
ifeq ($(PLATFORM),Darwin) | ||
LDFLAGS+=-lpanel $(NCURSES_LIB) -lutil -lm | ||
else | ||
ifeq ($(UTF8_SUPPORT),yes) | ||
LDFLAGS+=-lpanelw -lncursesw -lutil -lm | ||
CPPFLAGS+=-DUTF8_SUPPORT | ||
else | ||
LDFLAGS+=-lpanel -lncurses -lutil -lm | ||
endif | ||
endif | ||
|
||
|
||
OBJS:=utils.o mt.o error.o my_pty.o term.o scrollback.o help.o mem.o cv.o selbox.o stripstring.o color.o misc.o ui.o exec.o diff.o config.o cmdline.o globals.o history.o clipboard.o | ||
DEPENDS:= $(OBJS:%.o=%.d) | ||
|
||
|
||
.PHONY: all check install uninstall coverity clean distclean package thanks | ||
all: multitail | ||
|
||
multitail: $(OBJS) | ||
$(CC) $(OBJS) $(LDFLAGS) -o multitail | ||
|
||
ccmultitail: $(OBJS) | ||
ccmalloc --no-wrapper -Wextra $(CC) $(OBJS) $(LDFLAGS) -o ccmultitail | ||
|
||
install: multitail | ||
mkdir -p $(DESTDIR)$(PREFIX)/bin | ||
cp multitail $(DESTDIR)$(PREFIX)/bin | ||
mkdir -p $(DESTDIR)$(PREFIX)/share/man/man1 | ||
cp multitail.1 $(DESTDIR)$(PREFIX)/share/man/man1/multitail.1 | ||
mkdir -p $(DESTDIR)$(PREFIX)/share/doc/multitail-$(VERSION) | ||
cp *.txt INSTALL manual*.html $(DESTDIR)$(PREFIX)/share/doc/multitail-$(VERSION) | ||
# | ||
### COPIED multitail.conf.new, YOU NEED TO REPLACE THE multitail.conf | ||
### YOURSELF WITH THE NEW FILE | ||
# | ||
mkdir -p $(DESTDIR)$(PREFIX)/etc/multitail/ | ||
cp multitail.conf $(CONFIG_FILE).new | ||
cp conversion-scripts/* $(DESTDIR)$(PREFIX)/etc/multitail/ | ||
#rm -f $(DESTDIR)$(PREFIX)/share/man/man1/multitail.1.gz | ||
#gzip -9 $(DESTDIR)$(PREFIX)/share/man/man1/multitail.1 | ||
# | ||
# There's a mailinglist! | ||
# Send an e-mail to [email protected] with in the subject | ||
# 'subscribe multitail' to subscribe. | ||
# | ||
# you might want to run 'make thanks' now :-) | ||
# http://www.vanheusden.com/wishlist.php | ||
# | ||
# How do YOU use multitail? Please send me an e-mail so that I can | ||
# update the examples page. | ||
|
||
uninstall: clean | ||
rm -f $(DESTDIR)$(PREFIX)/bin/multitail | ||
rm -f $(DESTDIR)$(PREFIX)/share/man/man1/multitail.1.gz | ||
# rm -f $(CONFIG_FILE) | ||
rm -rf $(DESTDIR)$(PREFIX)/share/doc/multitail-$(VERSION) | ||
|
||
clean: | ||
rm -f $(OBJS) multitail core gmon.out *.da ccmultitail | ||
|
||
package: clean | ||
# source package | ||
rm -rf multitail-$(VERSION)* | ||
mkdir multitail-$(VERSION) | ||
cp -a conversion-scripts *.conf *.c *.h multitail.1 manual*.html Makefile makefile.* INSTALL license.txt readme.txt thanks.txt version multitail-$(VERSION) | ||
tar czf multitail-$(VERSION).tgz multitail-$(VERSION) | ||
rm -rf multitail-$(VERSION) | ||
|
||
thanks: | ||
echo Automatic thank you e-mail for multitail $(VERSION) on a `uname -a` | mail -s "multitail $(VERSION)" [email protected] | ||
echo Is your company using MultiTail and you would like to be | ||
echo mentioned on http://www.vanheusden.com/multitail/usedby.html ? | ||
echo Then please send me a logo -not too big- and a link and I will | ||
echo add it to that page. | ||
echo | ||
echo Oh, blatant plug: http://keetweej.vanheusden.com/wishlist.html | ||
|
||
### cppcheck: unusedFunction check can't be used with '-j' option. Disabling unusedFunction check. | ||
check: | ||
#XXX TBD to use cppechk --check-config $(CPPFLAGS) -I/usr/include | ||
cppcheck --std=c99 --verbose --force --enable=all --inconclusive --template=gcc \ | ||
'--suppress=variableScope' --xml --xml-version=2 . 2> cppcheck.xml | ||
cppcheck-htmlreport --file=cppcheck.xml --report-dir=cppcheck | ||
make clean | ||
-scan-build make | ||
|
||
coverity: | ||
make clean | ||
rm -rf cov-int | ||
CC=gcc cov-build --dir cov-int make all | ||
tar vczf ~/site/coverity/multitail.tgz README cov-int/ | ||
putsite -q | ||
/home/folkert/.coverity-mt.sh | ||
|
||
distclean: clean | ||
rm -rf cov-int cppcheck cppcheck.xml *.d *~ tags | ||
|
||
# include dependency files for any other rule: | ||
ifneq ($(filter-out clean distclean,$(MAKECMDGOALS)),) | ||
-include $(DEPENDS) | ||
endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
/* GPLv2 applies | ||
* SVN revision: $Revision$ | ||
* (C) 2006-2019 by [email protected] | ||
*/ | ||
#define _LARGEFILE64_SOURCE | ||
#include <fcntl.h> | ||
#include <netinet/in.h> | ||
#include <signal.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
#include <unistd.h> | ||
#include <sys/stat.h> | ||
#include <sys/types.h> | ||
|
||
#include "mt.h" | ||
#include "error.h" | ||
#include "config.h" | ||
#include "utils.h" | ||
#include "term.h" | ||
#include "ui.h" | ||
#include "clipboard.h" | ||
|
||
char *clipboard = "/usr/bin/" CLIPBOARD_NAME; | ||
|
||
void send_to_clipboard_binary(char *what) | ||
{ | ||
int fds[2] = { 0 }; | ||
pid_t pid = -1; | ||
|
||
if (pipe(fds) == -1) | ||
error_exit(TRUE, TRUE, "error creating pipe\n"); | ||
|
||
pid = fork(); | ||
if (pid == -1) | ||
error_exit(TRUE, TRUE, "error forking\n"); | ||
|
||
if (pid == 0) | ||
{ | ||
int loop; | ||
|
||
for(loop=0; loop<1024; loop++) | ||
{ | ||
if (fds[0] != loop) | ||
close(loop); | ||
} | ||
|
||
signal(SIGHUP, SIG_DFL); | ||
|
||
if (dup(fds[0]) == -1) | ||
error_exit(TRUE, TRUE, "dup() failed\n"); | ||
|
||
setsid(); | ||
#ifndef __minix | ||
setpgid(0, 0); | ||
#endif | ||
|
||
if (execl(clipboard, clipboard, NULL) == -1) | ||
error_exit(TRUE, FALSE, "execl of %s failed\n", clipboard); | ||
|
||
exit(1); | ||
} | ||
|
||
WRITE(fds[1], what, strlen(what), CLIPBOARD_NAME); | ||
|
||
close(fds[1]); | ||
close(fds[0]); | ||
} | ||
|
||
void send_to_clipboard(buffer *pb) | ||
{ | ||
if (file_exist(clipboard) == -1) | ||
error_popup("Copy to clipboard", -1, CLIPBOARD_NAME " program not found"); | ||
else if (getenv("DISPLAY") == NULL) | ||
error_popup("Copy to clipboard", -1, "DISPLAY environment variable not set"); | ||
else | ||
{ | ||
char *data = NULL; | ||
int len_out = 0; | ||
int loop = 0; | ||
NEWWIN *mywin = create_popup(9, 40); | ||
|
||
#ifdef __APPLE__ | ||
win_header(mywin, "Copy buffer to clipboard"); | ||
#else | ||
win_header(mywin, "Copy buffer to X clipboard"); | ||
#endif | ||
mydoupdate(); | ||
|
||
for(loop=0; loop<pb -> curpos; loop++) | ||
{ | ||
int len = 0; | ||
|
||
if ((pb -> be)[loop].Bline == NULL) | ||
continue; | ||
|
||
len = strlen((pb -> be)[loop].Bline); | ||
|
||
data = (char *)realloc(data, len_out + len + 1); | ||
|
||
memcpy(&data[len_out], (pb -> be)[loop].Bline, len + 1); | ||
|
||
len_out += len; | ||
} | ||
|
||
send_to_clipboard_binary(data); | ||
|
||
free(data); | ||
|
||
mvwprintw(mywin -> win, 3, 2, "Finished!"); | ||
mvwprintw(mywin -> win, 4, 2, "Press any key to continue..."); | ||
mydoupdate(); | ||
|
||
(void)wait_for_keypress(-1, 0, mywin, 0); | ||
|
||
delete_popup(mywin); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
extern char *clipboard; | ||
|
||
#ifdef __APPLE__ | ||
#define CLIPBOARD_NAME "pbcopy" | ||
#else | ||
#define CLIPBOARD_NAME "xclip" | ||
#endif | ||
|
||
void send_to_clipboard_binary(char *what); | ||
void send_to_clipboard(buffer *pb); |
Oops, something went wrong.