2 /* pndvalidator - a really dumb little tool to check a given PXML-app or pnd-app for 'compliance'.
3 * The "PXML spec" is not hard-defined so hopefull yover time this tool will prove useful, if it is
4 * updated to be 'tough enough' on PXML/pnd's and people actually use it
7 #include <stdio.h> // for stdio
8 #include <string.h> // for strcmp
12 #include "pnd_utility.h"
14 int main ( int argc, char *argv[] ) {
15 char *fullpath = NULL;
16 unsigned char do_override = 0;
17 unsigned char do_assets = 0;
20 printf ( "usage: %s [options] path-to-file\n", argv [ 0 ] );
22 printf ( "path-to-file\tCan refer to a PXML.xml in a subdir, or can refer to a .pnd-style application bundle\n" );
24 printf ( "Options:\n" );
25 printf ( "\t-a\tattempt to mount and verify assets (executable, icon, screenshots, etc) are present\n" );
26 printf ( "\t-m\tattempt to merge in PXML-overrides and validate against the result\n" );
28 printf ( "By default, the validator will only pick up the PXML and perform checks on field content.\n" );
36 if ( strncmp ( argv [ i ], "-m", 2 ) == 0 ) {
38 } else if ( strncmp ( argv [ i ], "-a", 2 ) == 0 ) {
41 fullpath = argv [ i ];
51 printf ( "Note: Will attempt to examine application assets\n" );
55 printf ( "Note: Will merge PXML-overrides if found (not an error if not found.)\n" );
59 printf ( "ERROR: No path provided.\n" );
63 printf ( "Path to examine: %s\n", fullpath );
68 // actually do useful work
71 pnd_pxml_handle *pxmlapps;
73 pxmlapps = pnd_pxml_get_by_path ( fullpath );
76 printf ( "ERROR: PXML could not be extracted meaningfully.\n" );
80 printf ( "Got back a meaningful list of PXMLs.\n" );
82 pnd_pxml_handle h = *pxmlapps;
89 // check for required fields
97 // package-name (shortname)
99 // free up that particular pxml_handle within the return-list
108 pnd_pxml_delete ( pxmlapps );