You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
108 lines
2.7 KiB
108 lines
2.7 KiB
Index: src/Makefile |
|
--- src/Makefile.orig 2001-06-01 17:54:16 +0200 |
|
+++ src/Makefile 2005-12-25 14:05:39 +0100 |
|
@@ -1,5 +1,6 @@ |
|
-CFLAGS=-O |
|
-LDFLAGS=-O -lpthread -lfl |
|
+CC=gcc |
|
+CFLAGS=-O -pthread |
|
+LDFLAGS=-O -pthread -lfl |
|
|
|
all: ../ypanything |
|
|
|
@@ -8,13 +9,13 @@ |
|
y.tab.o: y.tab.c |
|
|
|
lex.yy.c: config.l |
|
- lex config.l |
|
+ flex config.l |
|
|
|
y.tab.c: config.y |
|
- yacc -d config.y |
|
+ bison -y -d config.y |
|
|
|
../ypanything: main.o ypanything.o data.o yp_svc.o yp_xdr.o log.o mapping.o rb.o y.tab.o lex.yy.o cmdSource.o heap.o |
|
- cc main.o ypanything.o data.o yp_svc.o yp_xdr.o log.o mapping.o rb.o y.tab.o lex.yy.o cmdSource.o heap.o -o ../ypanything $(LDFLAGS) |
|
+ $(CC) main.o ypanything.o data.o yp_svc.o yp_xdr.o log.o mapping.o rb.o y.tab.o lex.yy.o cmdSource.o heap.o -o ../ypanything $(LDFLAGS) |
|
|
|
clean: |
|
rm -vf *.o lex.yy.c y.tab.c y.tab.h |
|
Index: src/constants.h |
|
--- src/constants.h.orig 2004-03-10 21:04:57 +0100 |
|
+++ src/constants.h 2005-12-25 14:05:39 +0100 |
|
@@ -28,3 +28,4 @@ |
|
#define DEFAULT_MEMBLOCK 32768 |
|
#define DEFAULT_IOBLOCK 8192 |
|
#define DEFAULT_CONFIGFILE "ypanything.conf" |
|
+#define DEFAULT_PIDFILE "ypanything.pid" |
|
Index: src/log.h |
|
--- src/log.h.orig 2004-03-10 21:04:57 +0100 |
|
+++ src/log.h 2005-12-25 14:05:39 +0100 |
|
@@ -35,4 +35,4 @@ |
|
|
|
void logSetLevel (int minLevel); |
|
void logSetFile (char *fileName); |
|
-#define log(priority, format, args...) log_func(__FILE__, __FUNCTION__, __LINE__, priority, format, ## args) |
|
+#define log(priority, format, args...) log_func((char *)__FILE__, (char *)__FUNCTION__, __LINE__, priority, format, ## args) |
|
Index: src/main.c |
|
--- src/main.c.orig 2004-03-10 21:04:57 +0100 |
|
+++ src/main.c 2005-12-25 14:06:14 +0100 |
|
@@ -42,7 +42,7 @@ |
|
extern yyparse (); |
|
extern FILE *yyin; |
|
|
|
-void deamonize () |
|
+void deamonize (const char *pidFilename) |
|
{ |
|
pid_t childPID; |
|
int fd; |
|
@@ -81,6 +81,16 @@ |
|
close (fd); |
|
} |
|
|
|
+ { |
|
+ pid_t pid; |
|
+ FILE *fp; |
|
+ pid = getpid(); |
|
+ if ((fp = fopen(pidFilename, "w")) != NULL) { |
|
+ fprintf(fp, "%ld\n", (long)pid); |
|
+ fclose(fp); |
|
+ } |
|
+ } |
|
+ |
|
errno = 0; |
|
|
|
} |
|
@@ -92,17 +102,22 @@ |
|
int errorFlag = 0; |
|
int quietFlag = 0; |
|
char *configFilename = DEFAULT_CONFIGFILE; |
|
+ char *pidFilename = DEFAULT_PIDFILE; |
|
FILE *configFile; |
|
|
|
extern int optind; |
|
extern char *optarg; |
|
|
|
- while ((c = getopt (argc, argv, "qdf:")) != EOF) { |
|
+ while ((c = getopt (argc, argv, "qdp:f:")) != EOF) { |
|
switch (c) { |
|
case 'd': |
|
deamonFlag = 1; |
|
break; |
|
|
|
+ case 'p': |
|
+ pidFilename = optarg; |
|
+ break; |
|
+ |
|
case 'f': |
|
configFilename = optarg; |
|
break; |
|
@@ -134,7 +149,7 @@ |
|
heapInitialize (); |
|
|
|
if (deamonFlag) { |
|
- deamonize (); |
|
+ deamonize (pidFilename); |
|
} |
|
|
|
configFile = fopen (configFilename, "r");
|
|
|