Exemplo n.º 1
0
/*
 * Do an integrity check on one or more records in the archive.
 */
NuError DoTest(NulibState* pState)
{
    NuError err;
    NuArchive* pArchive = NULL;

    Assert(pState != NULL);

    if (NState_GetModBinaryII(pState))
        return BNYDoTest(pState);

    err = OpenArchiveReadOnly(pState);
    if (err == kNuErrIsBinary2)
        return BNYDoTest(pState);
    if (err != kNuErrNone)
        goto bail;
    pArchive = NState_GetNuArchive(pState);
    Assert(pArchive != NULL);

    NState_SetMatchCount(pState, 0);

    err = NuTest(pArchive);
    if (err != kNuErrNone)
        goto bail;

    if (!NState_GetMatchCount(pState))
        printf("%s: no records match\n", gProgName);

bail:
    if (pArchive != NULL)
        (void) NuClose(pArchive);
    return err;
}
Exemplo n.º 2
0
/*
 * t - test archive
 */
static NuError TestFunc(ExerciserState* pState, int argc, char** argv)
{
    (void) pState, (void) argc, (void) argv;    /* shut up, gcc */
    assert(ExerciserState_GetNuArchive(pState) != NULL);
    assert(argc == 1);

    return NuTest(ExerciserState_GetNuArchive(pState));
}