move notify_supp functionality into the library,
authorAleš Křenek <ljocha@ics.muni.cz>
Thu, 16 Oct 2008 09:00:45 +0000 (09:00 +0000)
committerAleš Křenek <ljocha@ics.muni.cz>
Thu, 16 Oct 2008 09:00:45 +0000 (09:00 +0000)
renaming functions to avoid eventual clash

org.glite.lb.client/Makefile
org.glite.lb.client/interface/stat_fields.h [new file with mode: 0644]
org.glite.lb.client/src/notify.c
org.glite.lb.client/src/notify_supp.h [deleted file]
org.glite.lb.client/src/stat_fields.cpp [moved from org.glite.lb.client/src/notify_supp.cpp with 92% similarity]

index f8aa9cb..6e06f5a 100644 (file)
@@ -117,7 +117,7 @@ INSTALL:=libtool --mode=install install
 LIBOBJS:=connection.o consumer.o notification.o prod_proto.o \
        producer.o uiwrap.o statistics.o
 
-PLUSOBJS:=Event.o Job.o JobStatus.o Notification.o ServerConnection.o
+PLUSOBJS:=Event.o Job.o JobStatus.o Notification.o ServerConnection.o stat_fields.o
 
 HDRS:=consumer.h notification.h statistics.h prod_proto.h connection.h \
        Job.h Notification.h ServerConnection.h 
@@ -196,8 +196,8 @@ ${THRPLUSLIB}: ${PLUSTHROBJS} ${THRLIB}
 logevent: logevent.o args.o
        ${LINK} -o $@ logevent.o args.o ${LIB} ${EXT_LIB} 
 
-notify: notify.o notify_supp.o
-       ${LINKXX} -o $@ notify.o notify_supp.o ${PLUSLIB} ${EXT_LIB} 
+notify: notify.o
+       ${LINKXX} -o $@ notify.o ${PLUSLIB} ${EXT_LIB} 
 
 ${TOOLS} ${EXAMPLES}: %: %.o
        ${LINK} -o $@ $< ${LIB} ${EXT_LIB} 
@@ -210,7 +210,7 @@ ${EXAMPLES_CL_THR}: %: %.o
 
 ${TOOLS}: ${LIB}
 
-notify_supp.o ${PLUSOBJS}: %.o: %.cpp
+${PLUSOBJS}: %.o: %.cpp
        ${CXXCOMPILE} -c $<
 
 ${PLUSTHROBJS}: %.thr.o: %.cpp
diff --git a/org.glite.lb.client/interface/stat_fields.h b/org.glite.lb.client/interface/stat_fields.h
new file mode 100644 (file)
index 0000000..2221718
--- /dev/null
@@ -0,0 +1,12 @@
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+char * glite_lb_parse_stat_fields(const char *,void **);
+void glite_lb_print_stat_fields(void **,edg_wll_JobStat *);
+void glite_lb_dump_stat_fields(void);
+
+
+#ifdef __cplusplus
+}
+#endif
index 2d7e589..535beba 100644 (file)
@@ -10,7 +10,7 @@
 #include "glite/lb/context.h"
 #include "notification.h"
 
-#include "notify_supp.h"
+#include "stat_fields.h"
 
 
 static char *me;
@@ -77,7 +77,7 @@ static void usage(char *cmd)
                        "\n    -a, -t, and -r are unusable with -s\n"
                        , me);
                fprintf(stderr,"\navailable fields:\n\t");
-               dump_fields();
+               glite_lb_dump_stat_fields();
                putc(10,stderr);
        }
        if ( !cmd || !strcmp(cmd, "drop") )
@@ -236,7 +236,7 @@ int main(int argc,char **argv)
 
                if (opt_valid == 0) opt_valid = 3600;
 
-               if ((err = parse_fields(field_arg,&fields))) {
+               if ((err = glite_lb_parse_stat_fields(field_arg,&fields))) {
                        fprintf(stderr,"%s: invalid argument\n",err);
                        return EX_USAGE;
                }
@@ -281,7 +281,7 @@ int main(int argc,char **argv)
 
                                if (err != ETIMEDOUT) goto receive_err;
                        }
-                       else print_fields(fields,recv_nid,&stat);
+                       else glite_lb_print_stat_fields(fields,&stat);
 
                        if ((now = time(NULL)) >= client_tout) return 0;
 
diff --git a/org.glite.lb.client/src/notify_supp.h b/org.glite.lb.client/src/notify_supp.h
deleted file mode 100644 (file)
index 81daf50..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-char * parse_fields(const char *,void **);
-void print_fields(void **,const edg_wll_NotifId,edg_wll_JobStat *);
-void dump_fields(void);
-
-
-#ifdef __cplusplus
-}
-#endif
similarity index 92%
rename from org.glite.lb.client/src/notify_supp.cpp
rename to org.glite.lb.client/src/stat_fields.cpp
index 52ed7a8..5536409 100644 (file)
@@ -8,13 +8,13 @@
 #include "JobStatus.h"
 #include "notification.h"
 
-#include "notify_supp.h"
+#include "stat_fields.h"
 
 using namespace glite::lb;
 
 typedef std::pair<JobStatus::Attr,std::string> FieldPair;
 
-char * parse_fields(const char *arg,void **out)
+char * glite_lb_parse_stat_fields(const char *arg,void **out)
 {
        char    *aux = strdup(arg),*p;
        std::vector<FieldPair>  *fields = new std::vector<FieldPair>;
@@ -36,7 +36,7 @@ char * parse_fields(const char *arg,void **out)
 }
 
 
-std::string & escape(std::string &s)
+static std::string & escape(std::string &s)
 {
        for (std::string::iterator p = s.begin(); p < s.end(); p++) switch (*p) {
                case '\n':
@@ -50,7 +50,7 @@ std::string & escape(std::string &s)
 
 typedef std::vector<std::pair<JobStatus::Attr,JobStatus::AttrType> > attrs_t;
 
-void dump_fields(void)
+void glite_lb_dump_stat_fields(void)
 {
        JobStatus       s;
        attrs_t         a = s.getAttrs(); 
@@ -67,7 +67,7 @@ void dump_fields(void)
 
 extern "C" { char * TimeToStr(time_t); }
 
-void print_fields(void **ff,const edg_wll_NotifId n,edg_wll_JobStat *s)
+void glite_lb_print_stat_fields(void **ff,edg_wll_JobStat *s)
 {
        std::vector<FieldPair>  *fields = (std::vector<FieldPair> *) ff;
        JobStatus       stat(*s,0);