XMLOBJ = lib/tinyxml/tinystr.o lib/tinyxml/tinyxml.o lib/tinyxml/tinyxmlerror.o lib/tinyxml/tinyxmlparser.o
ALLOBJ = pnd_conf.o pnd_container.o pnd_discovery.o pnd_pxml.o pnd_notify.o pnd_locate.o pnd_tinyxml.o pnd_pndfiles.o pnd_apps.o pnd_utility.o pnd_desktop.o
-all: ${SOLIB} ${LIB} conftest discotest notifytest pndnotifyd rawpxmltest
+all: ${SOLIB} ${LIB} conftest discotest notifytest pndnotifyd rawpxmltest pndvalidator
clean:
- ${RM} -f ${ALLOBJ} ${XMLOBJ} ${LIB} ${SOLIB1} locatetest.o bin/locatetest conftest.o bin/conftest discotest.o bin/discotest bin/notifytest notifytest.o bin/rawpxmltest rawpxmltest.o bin/pndnotifyd pndnotifyd.o ${SOLIB} testdata/dotdesktop/*.desktop testdata/apps/*.pnd testdata/dotdesktop/*.png deployment/usr/lib/libpnd* deployment/usr/bin/pndnotifyd deployment/usr/pandora/scripts/* deployment/etc/sudoers deployment/etc/init.d/pndnotifyd
+ ${RM} -f ${ALLOBJ} ${XMLOBJ} ${LIB} ${SOLIB1} locatetest.o bin/locatetest conftest.o bin/conftest discotest.o bin/discotest bin/notifytest notifytest.o bin/rawpxmltest rawpxmltest.o bin/pndnotifyd pndnotifyd.o ${SOLIB} testdata/dotdesktop/*.desktop testdata/apps/*.pnd testdata/dotdesktop/*.png deployment/usr/lib/libpnd* deployment/usr/bin/pndnotifyd deployment/usr/pandora/scripts/* deployment/etc/sudoers deployment/etc/init.d/pndnotifyd bin/pndvalidator
${RM} -rf deployment/media
find . -name "*~*" -exec rm {} \; -print
${CC} -shared -Wl,-soname,${SOLIB} -o ${SOLIB1} ${ALLOBJ} ${XMLOBJ}
ln -f -s ${SOLIB1} ${SOLIB}
+${SOLIB1}: ${ALLOBJ} ${XMLOBJ}
+ ${CC} -shared -Wl,-soname,${SOLIB} -o ${SOLIB1} ${ALLOBJ} ${XMLOBJ}
+ ln -f -s ${SOLIB1} ${SOLIB}
+
pndnotifyd: pndnotifyd.o ${SOLIB1}
${CC} -lstdc++ -o bin/pndnotifyd pndnotifyd.o ${SOLIB1}
+pndvalidator: pndvalidator.o ${SOLIB1}
+ ${CC} -lstdc++ -o bin/pndvalidator pndvalidator.o ${SOLIB1}
+
# deployment and assembly components
#
#include "../lib/pnd_pathiter.h"
#include "pnd_discovery.h"
#include "pnd_locate.h"
+#include "pnd_pxml.h"
#include "pnd_utility.h"
#include "pnd_desktop.h"
char *clockspeed;
char *background;
char *startdir;
+ char *package_name;
+ char *package_release_date;
} pnd_pxml_t;
#define PND_PXML_ENAME_CLOCK "clockspeed"
#define PND_PXML_ATTRNAME_CLOCKFREQ "frequency"
+/* <package name="foo" released="1/1/0001"/> */
+#define PND_PXML_ENAME_PACKAGE "package"
+#define PND_PXML_ATTRNAME_PACKAGE_NAME "name"
+#define PND_PXML_ATTRNAME_PACKAGE_DATE "released"
+
#ifdef __cplusplus
} // extern "C"
#endif
-#endif /* ifndef h_pnd_pxml_names_h */
\ No newline at end of file
+#endif /* ifndef h_pnd_pxml_names_h */
// arbtrary execute function; fire and forget really
void pnd_exec_no_wait_1 ( char *fullpath, char *arg1 );
+// pnd_pxml_get_always() will work against a PXML.xml file or a foo.pnd app-bundle and return
+// the resulting PXML structure, or fail; ie: It should be handy to avoid the user having to
+// do the 'what type is this, and if-this-or-that' themselves.
+// NOTE: Does _NOT_ automatically pick up PXML-overrides; you can call that function if you want
+pnd_pxml_handle pnd_pxml_get_by_path ( char *fullpath );
+
#ifdef __cplusplus
} /* "C" */
#endif
app->clockspeed = pnd_pxml_get_attribute(pElem, PND_PXML_ATTRNAME_CLOCKFREQ);
}
+ // Package
+ pElem = hRoot.FirstChild ( PND_PXML_ENAME_PACKAGE ).Element();
+ if ( pElem ) {
+ app -> package_name = pnd_pxml_get_attribute ( pElem, PND_PXML_ATTRNAME_PACKAGE_NAME );
+ app -> package_release_date = pnd_pxml_get_attribute ( pElem, PND_PXML_ATTRNAME_PACKAGE_DATE );
+ }
+
return (1);
}
#include <stdio.h> /* for FILE etc */
#include <stdlib.h> /* for malloc */
+#define __USE_GNU /* for strcasestr */
#include <string.h> /* for making ftw.h happy */
#include <unistd.h> /* for fork exec */
+#include "pnd_pxml.h"
+#include "pnd_container.h"
#include "pnd_utility.h"
+#include "pnd_pndfiles.h"
+#include "pnd_discovery.h"
// a generalized variable-substitution routine might be nice; for now we need a quick tilde one,
// so here goes. Brute force ftw!
return;
}
+
+pnd_pxml_handle pnd_pxml_get_by_path ( char *fullpath ) {
+ unsigned char valid = pnd_object_type_unknown;
+ pnd_pxml_handle pxmlh = 0;
+
+ // WARN: this is way too close to callback in pnd_disco .. should be refactored!
+
+ if ( strcasestr ( fullpath, PXML_FILENAME ) ) {
+ valid = pnd_object_type_directory;
+ } else if ( strcasestr ( fullpath, PND_PACKAGE_FILEEXT "\0" ) ) {
+ valid = pnd_object_type_pnd;
+ }
+
+ // if not a file of interest, just keep looking until we run out
+ if ( ! valid ) {
+ return ( 0 );
+ }
+
+ // potentially a valid application
+ if ( valid == pnd_object_type_directory ) {
+ pxmlh = pnd_pxml_fetch ( (char*) fullpath );
+
+ } else if ( valid == pnd_object_type_pnd ) {
+ FILE *f;
+ char pxmlbuf [ 32 * 1024 ]; // TBD: assuming 32k pxml accrual buffer is a little lame
+
+ // open it up..
+ f = fopen ( fullpath, "r" );
+
+ // try to locate the PXML portion
+ if ( ! pnd_pnd_seek_pxml ( f ) ) {
+ fclose ( f );
+ return ( 0 ); // pnd or not, but not to spec. Pwn'd the pnd?
+ }
+
+ // accrue it into a buffer
+ if ( ! pnd_pnd_accrue_pxml ( f, pxmlbuf, 32 * 1024 ) ) {
+ fclose ( f );
+ return ( 0 );
+ }
+
+ // by now, we have <PXML> .. </PXML>, try to parse..
+ pxmlh = pnd_pxml_fetch_buffer ( (char*) fullpath, pxmlbuf );
+
+ // done with file
+ fclose ( f );
+
+ }
+
+ // ..
+
+ return ( pxmlh );
+}