forked from philberty/vigilant
-
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
Showing
4 changed files
with
94 additions
and
5 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 |
---|---|---|
@@ -1,4 +1,8 @@ | ||
bin_PROGRAMS = test$(EXEEXT) log$(EXEEXT) watcher$(EXEEXT) | ||
bin_PROGRAMS = \ | ||
proTest$(EXEEXT) \ | ||
logTest$(EXEEXT) \ | ||
wtail$(EXEEXT) \ | ||
watcher$(EXEEXT) | ||
lib_LTLIBRARIES = libwatchy.la | ||
|
||
pkgconfigdir = $(libdir)/pkgconfig | ||
|
@@ -9,13 +13,17 @@ libwatchy_cindlude_HEADERS = watchy.h | |
libwatchy_la_LDFLAGS = -rpath '$(libdir)' | ||
libwatchy_la_SOURCES = \ | ||
libwatchy.c \ | ||
runtime.c \ | ||
osdep-@[email protected] | ||
|
||
watcher_SOURCES = watcher.c | ||
watcher_LDADD = libwatchy.la | ||
|
||
test_SOURCES = test.c | ||
test_LDADD = libwatchy.la | ||
wtail_SOURCES = wtail.c | ||
wtail_LDADD = libwatchy.la | ||
|
||
log_SOURCES = log.c | ||
log_LDADD = libwatchy.la | ||
proTest_SOURCES = test.c | ||
proTest_LDADD = libwatchy.la | ||
|
||
logTest_SOURCES = log.c | ||
logTest_LDADD = libwatchy.la |
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,29 @@ | ||
#include "config.h" | ||
|
||
#include <stdio.h> | ||
#include <string.h> | ||
#include <stdbool.h> | ||
|
||
#include <sys/stat.h> | ||
#include <unistd.h> | ||
#include <fcntl.h> | ||
|
||
#include "watchy.h" | ||
|
||
static int pfd; | ||
static bool init = false; | ||
|
||
int watchy_writePacket (const struct watchy_data * data, const int fd) | ||
{ | ||
return 0; | ||
} | ||
|
||
int watchy_cAttachRuntime (const char * fifo, const char * bind, const int port) | ||
{ | ||
return; | ||
} | ||
|
||
void watchy_detachRuntime (void) | ||
{ | ||
return; | ||
} |
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
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,49 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
int main (int argc char **argv) | ||
{ | ||
FILE *ps_pipe; | ||
FILE *grep_pipe; | ||
|
||
int bytes_read; | ||
int nbytes = 100; | ||
char *my_string; | ||
|
||
/* Open our two pipes */ | ||
ps_pipe = popen ("ps -A", "r"); | ||
grep_pipe = popen ("grep init", "w"); | ||
|
||
/* Check that pipes are non-null, therefore open */ | ||
if ((!ps_pipe) || (!grep_pipe)) | ||
{ | ||
fprintf (stderr, | ||
"One or both pipes failed.\n"); | ||
return EXIT_FAILURE; | ||
} | ||
|
||
/* Read from ps_pipe until two newlines */ | ||
my_string = (char *) malloc (nbytes + 1); | ||
bytes_read = getdelim (&my_string, &nbytes, "\n\n", ps_pipe); | ||
|
||
/* Close ps_pipe, checking for errors */ | ||
if (pclose (ps_pipe) != 0) | ||
{ | ||
fprintf (stderr, | ||
"Could not run 'ps', or other error.\n"); | ||
} | ||
|
||
/* Send output of 'ps -A' to 'grep init', with two newlines */ | ||
fprintf (grep_pipe, "%s\n\n", my_string); | ||
|
||
/* Close grep_pipe, cehcking for errors */ | ||
if (pclose (grep_pipe) != 0) | ||
{ | ||
fprintf (stderr, | ||
"Could not run 'grep', or other error.\n"); | ||
} | ||
|
||
/* Exit! */ | ||
return 0; | ||
} | ||
|