示例#1
0
/*
 * e - extract all files (selection-filtered)
 */
static NuError ExtractFunc(ExerciserState* pState, int argc, char** argv)
{
    (void) pState, (void) argc, (void) argv;    /* shut up, gcc */
    assert(ExerciserState_GetNuArchive(pState) != NULL);
    assert(argc == 1);

    NuSetSelectionFilter(ExerciserState_GetNuArchive(pState), SelectionFilter);

    return NuExtract(ExerciserState_GetNuArchive(pState));
}
示例#2
0
文件: Extract.c 项目: iKarith/nulib2
/*
 * Extract the specified files.
 */
NuError DoExtract(NulibState* pState)
{
    NuError err;
    NuArchive* pArchive = NULL;

    Assert(pState != NULL);

    if (NState_GetModBinaryII(pState))
        return BNYDoExtract(pState);

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

    NState_SetMatchCount(pState, 0);

    /*
     * If we're not interested in comments, just use the "bulk" extract
     * call.  If we want comments, we need to do this one at a time.
     */
    if (!NState_GetModComments(pState)) {
        err = NuExtract(pArchive);
        if (err != kNuErrNone)
            goto bail;
    } else {
        err = ExtractAllRecords(pState, 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;
}