/* * Dump the contents from the streaming input. * * If we're not interested in handling an archive on stdin, we could just * pass the filename in here and use NuOpenRO instead. */ int DoStreamStuff(FILE* fp) { NuError err; NuArchive* pArchive = nil; err = NuStreamOpenRO(fp, &pArchive); if (err != kNuErrNone) { fprintf(stderr, "ERROR: unable to open stream archive (err=%d)\n", err); goto bail; } printf("*** Streaming contents!\n"); err = NuContents(pArchive, ShowContents); if (err != kNuErrNone) { fprintf(stderr, "ERROR: NuContents failed (err=%d)\n", err); goto bail; } bail: if (pArchive != nil) { NuError err2 = NuClose(pArchive); if (err == kNuErrNone) err = err2; } return err; }
/* * p - print */ static NuError PrintFunc(ExerciserState* pState, int argc, char** argv) { (void) pState, (void) argc, (void) argv; /* shut up, gcc */ assert(ExerciserState_GetNuArchive(pState) != NULL); assert(argc == 1); return NuContents(ExerciserState_GetNuArchive(pState), PrintEntry); }