Back to index

lightning-sunbird  0.9+nobinonly
Classes | Typedefs | Functions | Variables
i2l.c File Reference
#include <stdlib.h>
#include "prio.h"
#include "prinit.h"
#include "prprf.h"
#include "prlong.h"
#include "plerror.h"
#include "plgetopt.h"

Go to the source code of this file.


union  Overlay_i
union  Overlay_u


typedef union Overlay_i Overlay_i
typedef union Overlay_u Overlay_u


static void Help (void)
static PRIntn PR_CALLBACK RealMain (PRIntn argc, char **argv)
PRIntn main (PRIntn argc, char *argv[])


static PRFileDescerr = NULL

Class Documentation

union Overlay_i

Definition at line 48 of file i2l.c.

Collaboration diagram for Overlay_i:
Class Members
PRInt32 i
PRInt64 l
union Overlay_u

Definition at line 54 of file i2l.c.

Collaboration diagram for Overlay_u:
Class Members
PRUint32 i
PRUint64 l

Typedef Documentation

typedef union Overlay_i Overlay_i
typedef union Overlay_u Overlay_u

Function Documentation

static void Help ( void  ) [static]

Definition at line 62 of file i2l.c.

    PR_fprintf(err, "Usage: -i n | -u n | -h\n");
    PR_fprintf(err, "\t-i n treat following number as signed integer\n");
    PR_fprintf(err, "\t-u n treat following number as unsigned integer\n");
    PR_fprintf(err, "\t-h   This message and nothing else\n");
}  /* Help */
PRIntn main ( PRIntn  argc,
char *  argv[] 

Definition at line 124 of file i2l.c.

    PRIntn rv;
    rv = PR_Initialize(RealMain, argc, argv, 0);
    return rv;
}  /* main */

Here is the call graph for this function:

static PRIntn PR_CALLBACK RealMain ( PRIntn  argc,
char **  argv 
) [static]

Definition at line 70 of file i2l.c.

    Overlay_i si;
    Overlay_u ui;
    PLOptStatus os;
    PRBool bsi = PR_FALSE, bui = PR_FALSE;
    PLOptState *opt = PL_CreateOptState(argc, argv, "hi:u:");
    err = PR_GetSpecialFD(PR_StandardError);

    while (PL_OPT_EOL != (os = PL_GetNextOpt(opt)))
        if (PL_OPT_BAD == os) continue;
        switch (opt->option)
        case 'i':  /* signed integer */
            si.i = (PRInt32)atoi(opt->value);
            bsi = PR_TRUE;
        case 'u':  /* unsigned */
            ui.i = (PRUint32)atoi(opt->value);
            bui = PR_TRUE;
        case 'h':  /* user wants some guidance */
            Help();  /* so give him an earful */
            return 2;  /* but not a lot else */

#if defined(HAVE_LONG_LONG)
    PR_fprintf(err, "We have long long\n");
    PR_fprintf(err, "We don't have long long\n");

    if (bsi)
        PR_fprintf(err, "Converting %ld: ", si.i);
        LL_I2L(si.l, si.i);
        PR_fprintf(err, "%lld\n", si.l);

    if (bui)
        PR_fprintf(err, "Converting %lu: ", ui.i);
        LL_I2L(ui.l, ui.i);
        PR_fprintf(err, "%llu\n", ui.l);
    return 0;

}  /* main */

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

PRFileDesc* err = NULL [static]

Definition at line 60 of file i2l.c.