Back to index

lightning-sunbird  0.9+nobinonly
Functions | Variables
standalone.cpp File Reference
#include <stdio.h>
#include "nsXPCOM.h"
#include "nsIComponentManager.h"
#include "nsIServiceManager.h"
#include "nsCOMPtr.h"
#include "nsSpecialSystemDirectory.h"
#include "nscore.h"
#include "nspr.h"
#include "nsSimpleNotifier.h"
#include "nsISoftwareUpdate.h"
#include "nsSoftwareUpdateIIDs.h"

Go to the source code of this file.

Functions

static NS_DEFINE_IID (kSoftwareUpdateCID, NS_SoftwareUpdate_CID)
static void xpinstall_usage (int argc, char *argv[])
int main (int argc, char **argv)
 The Xalan testcases app.

Variables

static nsISoftwareUpdatesoftwareUpdate = NULL

Function Documentation

int main ( int  argc,
char **  argv 
)

The Xalan testcases app.

Definition at line 70 of file standalone.cpp.

{
 
    for (int i = 1; i < argc; i++) 
    {
        if (argv[i][0] != '-')
            break;

        switch (argv[i][1]) 
        {
            case 'f':
            if (argv[i][2] == '\0' && i == argc) 
            {
                fputs("ERROR: missing path after -f\n", stderr);
                xpinstall_usage(argc, argv);
                return 1;
            }
            //foo = argv[i + 1];
            i++;
            break;

          default:
            fprintf(stderr, "unknown option %s\n", argv[i]);
            xpinstall_usage(argc, argv);
            return 1;
        }
    }



    nsCOMPtr<nsIServiceManager> servMan;
    NS_InitXPCOM2(getter_AddRefs(servMan), nsnull, nsnull);
    nsCOMPtr<nsIComponentRegistrar> registrar = do_QueryInterface(servMan);
    if (!registrar) {
        NS_ASSERTION(0, "Null nsIComponentRegistrar");
        return rv;
    }
    registrar->AutoRegister(nsnull);


    nsresult rv = CallCreateInstance(kSoftwareUpdateCID, &softwareUpdate);

    if (NS_SUCCEEDED(rv))
    {
        nsSimpleNotifier *progress = new nsSimpleNotifier();

        nsFileSpec jarFile(argv[i]);
        nsFileURL jarFileURL(jarFile);
        
        softwareUpdate->InstallJar(  nsString( jarFileURL.GetAsString() ) ,
                                     nsString( nsNSPRPath(jarFile) ), 
                                     0x0000FFFF,
                                     progress);
    }

    return rv;
}

Here is the call graph for this function:

static NS_DEFINE_IID ( kSoftwareUpdateCID  ,
NS_SoftwareUpdate_CID   
) [static]
static void xpinstall_usage ( int  argc,
char *  argv[] 
) [static]

Definition at line 64 of file standalone.cpp.

{
    fprintf(stderr, "Usage: %s [-f flags] [-a arguments] filename\n", argv[0]);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 58 of file standalone.cpp.