Example #1
0
void Exercise2()
{
	Player_Struct Player = {};	

	Ask(Player);
	Tell(Player);
}
Example #2
0
bool CmdExtract::ExtrGetPassword(Archive &Arc,const wchar *ArcFileName)
{
  if (!Cmd->Password.IsSet())
  {
    if (!uiGetPassword(UIPASSWORD_FILE,ArcFileName,&Cmd->Password) || !Cmd->Password.IsSet())
    {
      // Suppress "test is ok" message in GUI if user entered
      // an empty password or cancelled a password prompt.
      uiMsg(UIERROR_INCERRCOUNT);

      return false;
    }
    Cmd->ManualPassword=true;
  }
#if !defined(GUI) && !defined(SILENT)
  else
    if (!PasswordAll && !Arc.FileHead.Solid)
    {
      eprintf(St(MUseCurPsw),ArcFileName);
      switch(Cmd->AllYes ? 1 : Ask(St(MYesNoAll)))
      {
        case -1:
          ErrHandler.Exit(RARX_USERBREAK);
        case 2:
          if (!uiGetPassword(UIPASSWORD_FILE,ArcFileName,&Cmd->Password))
            return false;
          break;
        case 3:
          PasswordAll=true;
          break;
      }
    }
#endif
  return true;
}
Example #3
0
// Purely user interface function. Gets and returns user input.
UIASKREP_RESULT uiAskReplace(wchar *Name,size_t MaxNameSize,int64 FileSize,RarTime *FileTime,uint Flags)
{
  bool AllowRename=(Flags & UIASKREP_F_NORENAME)==0;
  eprintf(St(MFileExists),Name);
  int Choice=0;
  do
  {
    Choice=Ask(St(AllowRename ? MYesNoAllRenQ : MYesNoAllQ));
  } while (Choice==0); // 0 means invalid input.
  switch(Choice)
  {
    case 1:
      return UIASKREP_R_REPLACE;
    case 2:
      return UIASKREP_R_SKIP;
    case 3:
      return UIASKREP_R_REPLACEALL;
    case 4:
      return UIASKREP_R_SKIPALL;
  }
  if (AllowRename && Choice==5)
  {
    mprintf(St(MAskNewName));
    if (getwstr(Name,MaxNameSize))
      return UIASKREP_R_RENAME;
    else
      return UIASKREP_R_SKIP; // Process fwgets failure as if user answered 'No'.
  }
  return UIASKREP_R_CANCEL;
}
Example #4
0
bool CmdExtract::ExtrGetPassword(CommandData *Cmd,Archive &Arc,const wchar *ArcFileName)
{
  if (!Password.IsSet())
  {
    if (!GetPassword(PASSWORD_FILE,ArcFileName,&Password))
    {
      return false;
    }
  }
#if !defined(GUI) && !defined(SILENT)
  else
    if (!PasswordAll && !Arc.FileHead.Solid)
    {
      eprintf(St(MUseCurPsw),ArcFileName);
      switch(Cmd->AllYes ? 1:Ask(St(MYesNoAll)))
      {
        case -1:
          ErrHandler.Exit(RARX_USERBREAK);
        case 2:
          if (!GetPassword(PASSWORD_FILE,ArcFileName,&Password))
            return false;
          break;
        case 3:
          PasswordAll=true;
          break;
      }
    }
#endif
  return true;
}
Example #5
0
bool AskNextVol(char *ArcName)
{
  eprintf(St(MAskNextVol),ArcName);
  if (Ask(St(MContinueQuit))==2)
    return(false);
  return(true);
}
Example #6
0
const char* EnterRunCfgFN(configure_slot_t slot_fn, configure_slot_t slot_js)
{
	int ret = 0;
	const char* run_cfg_fn = strings_storage_get(slot_fn, 0);
	char run_cfg_fn_new[MAX_PATH];
	const char *run_cfg_fn_js;
	do {
		log_printf(
			"\n"
			"Enter a custom name for this configuration, or leave blank to use the default\n"
			" (%s): ", run_cfg_fn
		);
		console_read(run_cfg_fn_new, sizeof(run_cfg_fn_new));
		if(run_cfg_fn_new[0]) {
			run_cfg_fn = strings_sprintf(slot_fn, "%s", run_cfg_fn_new);
		}
		run_cfg_fn_js = strings_sprintf(slot_js, "%s.js", run_cfg_fn);
		if(PathFileExists(run_cfg_fn_js)) {
			log_printf("\"%s\" already exists. ", run_cfg_fn_js);
			ret = !Ask("Overwrite?");
		} else {
			ret = 0;
		}
	} while(ret);
	return run_cfg_fn;
}
Example #7
0
bool AskNextVol(vector<string> *pvRarFiles, string sParfileName, char *ArcName)
{
  eprintf(sParfileName,St(MAskNextVol),ArcName);
  if (Ask(pvRarFiles, sParfileName,St(MContinueQuit))==2)
    return(false);
  return(true);
}
Example #8
0
bool AskNextVol(wchar *ArcName)
{
  eprintf(St(MAskNextVol),ArcName);
  if (Ask(St(MContinueQuit))==2)
    return false;
  return true;
}
Example #9
0
void QA::GetSlot()
{
   do {
      Ask();
      while (status == unconfirmed) Check();
   }while (status != grounded && status != cancelled && !terminated);
}
Example #10
0
int main(){
    FILE *fileToPrint;
    fileToPrint = fopen("Solutions.out","w");

    /** Create Interface of Program */
    while(!Start){
        GameOver = false;
        system("CLS");
        Intro();

        Ask();

        int puzzle[SizeOfPuzzle][SizeOfPuzzle];
        int copy[SizeOfPuzzle][SizeOfPuzzle];
        int i, j;
        /** Here is generated the puzzle full with 0 */
        for(i = 0; i < SizeOfPuzzle; i++){
            for(j = 0; j < SizeOfPuzzle; j++){
                puzzle[i][j] = 0;
            }
        }
        while(!GameOver){
            system("CLS");

            Intro();
            AskSize(SizeOfPuzzle, puzzle);
            ChoseOptions();

            scanf("%d",&choice);

            switch(choice){
                case 1:
                    main();
                    break;
                case 2:
                    InsertNumberInPozitionChoice(puzzle, copy, SizeOfPuzzle);
                    break;
                case 3:
                    GenerateRandomPuzzle(puzzle, copy, fileToPrint, SizeOfPuzzle);
                    break;
                case 4:
                    SolvePuzzle(puzzle, fileToPrint, SizeOfPuzzle);
                    break;
                case 5:
                    Back(puzzle, copy, SizeOfPuzzle);
                    break;
                case 6:
                    GameOver = true;
                    Start = true;
                    break;
                default:
                    printf("\t\t Wrong choice try again :");
                    scanf("%d",&choice);
                    break;
            }
        }
    }

	return 0;
}
Example #11
0
//Find Kth
int Kth(int k, int l, int r){
	while (l < r){
		int m = (l + r) >> 1, s = Ask(l, m);
		if (k <= s) r = m;
		else k -= s, l = m + 1;
	}
	return l;
}
Example #12
0
void _TravellerSearch::Search(WordList& list)
{
    bool flag = false;
    while(1)
    {
        Find(list,flag);
        if (flag) break;
        if(Ask()) break;
    }
}
Example #13
0
bool ErrorHandler::AskRepeatRead(const char *FileName)
{
#if !defined(SILENT) && !defined(SFX_MODULE) //&& !defined(_WIN_CE)
  if (!Silent)
  {
    mprintf("\n");
    Log(NULL,St(MErrRead),FileName);
    return(Ask(St(MRetryAbort))==1);
  }
#endif
  return(false);
}
Example #14
0
bool ErrorHandler::AskRepeatRead(vector<string> *pvRarFiles, string sParfileName, const char *FileName)
{
#if !defined(SILENT) && !defined(SFX_MODULE) && !defined(_WIN_CE)
    if (!Silent)
    {
        mprintf(sParfileName,"\n");
        Log(sParfileName,NULL,St(MErrRead),FileName);
        return(Ask(pvRarFiles, sParfileName, St(MRetryAbort))==1);
    }
#endif
    return(false);
}
Example #15
0
bool ErrorHandler::AskRepeatWrite(const char *FileName)
{
#if !defined(RAR_SILENT) && !defined(_WIN_CE)
  if (!Silent)
  {
    mprintf("\n");
    Log(NULL,St(MErrWrite),FileName);
    return(Ask(St(MRetryAbort))==1);
  }
#endif
  return(false);
}
Example #16
0
void _Search::Search(WordList& list)
{
    bool flag = false;
    while(1)
    {
        Find(list,flag);
        if (flag) break;
        Addnote();
        AddUnfamilar();
        if(Ask()) break;
    }
}
Example #17
0
bool ErrorHandler::AskRepeatWrite(const char *FileName,const wchar *FileNameW,bool DiskFull)
{
#if !defined(SILENT) && !defined(_WIN_CE)
  if (!Silent)
  {
    SysErrMsg();
    mprintf("\n");
    Log(NULL,St(DiskFull ? MNotEnoughDisk:MErrWrite),FileName);
    return(Ask(St(MRetryAbort))==1);
  }
#endif
  return(false);
}
Example #18
0
UINT CDialogMessageBox::Show(HWND hWndParent,LPCTSTR szText,LPCTSTR szCaption,UINT ButtonsCount,LPCTSTR* szButtonNames,HANDLE hIcon,UINT DefaultButton)
{
	//запомнить параметры
	mhWndParent=hWndParent;
	mszText=szText;
	mszCaption=szCaption;
	mButtonsCount=ButtonsCount;
	mszButtonNames=szButtonNames;
	mhIcon=hIcon;
	mDefaultButton=DefaultButton;

	//вывести диалог
	return Ask(MAKEINTRESOURCE(IDD_DIALOG_MESSAGEBOX),hWndParent);
}
Example #19
0
// Purely user interface function. Gets and returns user input.
UIASKREP_RESULT uiAskReplace(wchar *Name,size_t MaxNameSize,int64 FileSize,RarTime *FileTime,uint Flags)
{
  wchar SizeText1[20],DateStr1[50],SizeText2[20],DateStr2[50];

  FindData ExistingFD;
  memset(&ExistingFD,0,sizeof(ExistingFD)); // In case find fails.
  FindFile::FastFind(Name,&ExistingFD);
  itoa(ExistingFD.Size,SizeText1,ASIZE(SizeText1));
  ExistingFD.mtime.GetText(DateStr1,ASIZE(DateStr1),false);

  if (FileSize==INT64NDF || FileTime==NULL)
  {
    eprintf(L"\n");
    eprintf(St(MAskOverwrite),Name);
  }
  else
  {
    itoa(FileSize,SizeText2,ASIZE(SizeText2));
    FileTime->GetText(DateStr2,ASIZE(DateStr2),false);
    eprintf(St(MAskReplace),Name,SizeText1,DateStr1,SizeText2,DateStr2);
  }

  bool AllowRename=(Flags & UIASKREP_F_NORENAME)==0;
  int Choice=0;
  do
  {
    Choice=Ask(St(AllowRename ? MYesNoAllRenQ : MYesNoAllQ));
  } while (Choice==0); // 0 means invalid input.
  switch(Choice)
  {
    case 1:
      return UIASKREP_R_REPLACE;
    case 2:
      return UIASKREP_R_SKIP;
    case 3:
      return UIASKREP_R_REPLACEALL;
    case 4:
      return UIASKREP_R_SKIPALL;
  }
  if (AllowRename && Choice==5)
  {
    mprintf(St(MAskNewName));
    if (getwstr(Name,MaxNameSize))
      return UIASKREP_R_RENAME;
    else
      return UIASKREP_R_SKIP; // Process fwgets failure as if user answered 'No'.
  }
  return UIASKREP_R_CANCEL;
}
Example #20
0
//показать диалог
BOOL CToolDumper::CSelectProcessDialog::Show(HWND hWndParent,DWORD* pProcessID)
{
	//инициализировать указатель на список процессов
	mpList=NULL;
	//вывести диалог
	if(Ask(MAKEINTRESOURCE(IDD_DIALOG_TOOL_DUMPER_SELECT_PROCESS),hWndParent))
	{
		//вернуть идентификатор выбранного процесса
		*pProcessID=mProcessID;
		//диалог завершен успешно
		return TRUE;
	}
	//выбрана отмена
	return FALSE;
}
Example #21
0
int file_write_error(const char *fn)
{
	static int error_nag = 0;
	log_printf(
		"\n"
		"Error writing to %s!\n"
		"You probably do not have the permission to write to the current directory,\n"
		"or the file itself is write-protected.\n",
		fn
	);
	if(!error_nag) {
		log_printf("Writing is likely to fail for all further files as well.\n");
		error_nag = 1;
	}
	return Ask("Continue configuration anyway?");
}
Example #22
0
int main()
{
    LinkinPark();
    struct KnowledgeBase * kb=0;
    kb = InitKnowledgeBase();
    LoadKnowledgeBase(kb,"my_knowledgebase");

      PrintObjectsAtKnowledgeBase(kb);

      Ask("AMMAR CONTAINS TECHNOLOGY");


    //SaveKnowledgeBase(kb,"my_knowledgebase");
    CloseKnowledgeBase(kb);
    return 0;
}
Example #23
0
int main(void) {
	fillDeck();
	shuffleDeck();
	passCard(playerHand, Player);
	passCard(playerHand, Player);
	PrintHand();
	printf("You score is (%i).        ", scorePlayerHand);
	do {
		CheckHand();
		Ask();
		Choice();
		PrintHand();
		printf("You score is (%i).    ", scorePlayerHand);
	} while ((userAnswer == 'y' || userAnswer == 'Y'));
	getWinner();
	return 0;
}
Example #24
0
	void Work(void) {
		scanf("%ld %ld", &n, &s);
		for (long i = 1; i <= n; i++)
			a[i] = Read(), b[i] = Read(), k[i] = Read();
		f[1] = s;
		Y[1] = Cal(1);
		X[1] = Y[1] * k[1];
		Add(X[1], Y[1]);
		for (long i = 2; i <= n; i++) {
			double v = Ask(a[i], b[i]);
			f[i] = std::max(f[i - 1], v);

			Y[i] = Cal(i);
			X[i] = Y[i] * k[i];
			Add(X[i], Y[i]);
		}
		printf("%.3lf\n", f[n]);
	}
Example #25
0
/*
 * Explode -f N:s,h:o,t ops in fashion similar to -b above.
 */
void
AddFileOp(int flags, long long n)
{
	int TypeMask, ScopeMask;
	int TypeBit, ScopeBit, opbase;

	opbase = OP_SET|ARG_FILE;

	ScopeMask = flags&SCOPE_MASK;
	for (ScopeBit = GETBIT(ScopeMask); ScopeBit != 0;
	    ScopeBit = GETBIT(ScopeMask)) {
		TypeMask = flags&TYPE_MASK;
		for (TypeBit = GETBIT(TypeMask); TypeBit != 0;
		    TypeBit = GETBIT(TypeMask)) {
			switch (ScopeBit|TypeBit) {
			case SCOPE_ONLINE|TYPE_INUSE:
			case SCOPE_TOTAL|TYPE_INUSE:
				if (wflag &&
				    !Ask("Setting In-Use Field:  continue? ",
				    'n')) {
					Err++;
					return;
				}
				AddPrimOp(opbase|ScopeBit|TypeBit, n);
				break;
			case SCOPE_ONLINE|TYPE_SOFT:
			case SCOPE_ONLINE|TYPE_HARD:
			case SCOPE_TOTAL|TYPE_SOFT:
			case SCOPE_TOTAL|TYPE_HARD:
				AddPrimOp(opbase|ScopeBit|TypeBit, n);
				break;
			default:
				fprintf(stderr,
				    "%s:  AddFilekOp:  bad option %#x\n",
				    Program, ScopeBit|TypeBit);
				Err++;
			}
			TypeMask &= ~TypeBit;
		}
		ScopeMask &= ~ScopeBit;
	}
}
Example #26
0
//Main
int main(){
#if 1
	freopen("test.txt", "r", stdin);
	freopen("test.out", "w", stdout);
#endif
	while (scanf("%d%d", &s, &b), s || b){
		Init();
		Draw(1, 0, s + 1);
		while (b--){
			int x, y;
			scanf("%d%d", &x, &y);
			Draw(-1, x, y);
			x = Kth(Ask(0, x - 1), 0, x - 1),
			y = Kth(1, y + 1, s + 1);
			printf(x < 1? "* ": "%d ", x);
			printf(y > s? "*\n": "%d\n", y);
		}
		puts("-");
	}
	return 0;
}
Example #27
0
void Exercise4()
{
	Player_Struct Players[5];
	
	int i;
	for (i = 0; i < 5; i++)
	{
		Ask(Players[i]);
		if (i < 4)
			std::cout << "-----------------------" << std::endl;
	}
	for (i = 0; i < 5; i++)
	{
		Tell(Players[i]);

		if (i < 4)
			std::cout << std::endl << "-----------------------";
	}

	End();
	New("5");
	Exercise5(Players);
}
Example #28
0
void TradingEngine::processNewRecord(Record::Ptr r) {

    if (r->type() == Record::Type::ENTER && (r->askId() == 6666 || r->bidId() == 6666)) {
        qDebug() << "Found one of our trades: " << r;
        Trade t(*r);
        t.setType(Record::Type::TRADE);
        t.setPrice(r->price());
        emit newTradeCreated(t);
        return;
    }

    switch (r->type()) {

    case Record::Type::ENTER:
        switch (r->bidOrAsk()) {
        case Record::BidAsk::Bid:
            enterBid(Bid(r));
            break;
        case Record::BidAsk::Ask:
            enterAsk(Ask(r));
            break;
        default:
            qWarning() << "encountered record with Type ENTER, but is neither a Bid nor Ask";
            break;
        }
        break;
    case Record::Type::DELETE:
        switch (r->bidOrAsk()) {
        case Record::BidAsk::Ask:
            removeAsk(Ask(r));
            break;
        case Record::BidAsk::Bid:
            removeBid(Bid(r));
            break;
        default:
            qWarning() << "trying to delete a record that is neither a Bid nor Ask";
            break;
        }
        break;
    case Record::Type::AMEND:
        switch (r->bidOrAsk()) {
        case Record::BidAsk::Ask:
            modifyAsk(Ask(r));
            break;
        case Record::BidAsk::Bid:
            modifyBid(Bid(r));
            break;
        default:
            qWarning() << "trying to amend a record that is neither a Bid nor Ask";
            break;
        }
        break;

    case Record::Type::TRADE:
//        createTrade(Trade(*r.data()));
        break;

    default:
        break;
    }
}
Example #29
0
bool FileCreate(RAROptions *Cmd,File *NewFile,char *Name,wchar *NameW,
                OVERWRITE_MODE Mode,bool *UserReject,Int64 FileSize,
                uint FileTime)
{
  if (UserReject!=NULL)
    *UserReject=false;
  while (FileExist(Name,NameW))
  {
    if (Mode==OVERWRITE_NONE)
    {
      if (UserReject!=NULL)
        *UserReject=true;
      return(false);
    }
#ifdef SILENT
    Mode=OVERWRITE_ALL;
#endif
    if (Cmd->AllYes || Mode==OVERWRITE_ALL)
      break;
    if (Mode==OVERWRITE_ASK)
    {
      eprintf(St(MFileExists),Name);
      int Choice=Ask(St(MYesNoAllRenQ));
      if (Choice==1)
        break;
      if (Choice==2)
      {
        if (UserReject!=NULL)
          *UserReject=true;
        return(false);
      }
      if (Choice==3)
      {
        Cmd->Overwrite=OVERWRITE_ALL;
        break;
      }
      if (Choice==4)
      {
        if (UserReject!=NULL)
          *UserReject=true;
        Cmd->Overwrite=OVERWRITE_NONE;
        return(false);
      }
      if (Choice==5)
      {
        mprintf(St(MAskNewName));

        char NewName[NM];
#ifdef  _WIN_32
        File SrcFile;
        SrcFile.SetHandleType(FILE_HANDLESTD);
        int Size=SrcFile.Read(NewName,NM);
        NewName[Size]=0;
        OemToChar(NewName,NewName);
#else
        fgets(NewName,sizeof(NewName),stdin);
#endif
        RemoveLF(NewName);
        if (PointToName(NewName)==NewName)
          strcpy(PointToName(Name),NewName);
        else
          strcpy(Name,NewName);
        if (NameW!=NULL)
          *NameW=0;
        continue;
      }
      if (Choice==6)
        ErrHandler.Exit(USER_BREAK);
    }
  }
  if (NewFile!=NULL && NewFile->Create(Name,NameW))
    return(true);
  PrepareToDelete(Name,NameW);
  CreatePath(Name,NameW,true);
  return(NewFile!=NULL ? NewFile->Create(Name,NameW):remove(Name)==0);
}
Example #30
0
static int
readDump(afs_uint32 taskId, struct butm_tapeInfo *tapeInfoPtr,
         struct tapeScanInfo *scanInfoPtr)
{
    int moreTapes = 1;
    afs_int32 flags, seq;
    afs_uint32 nbytes = 0;
    int newDump = 1, newTape = 1;
    afs_int32 tapePosition;
    afs_int32 code = 0, tcode;
    int badscan;
    struct volumeHeader volHeader, volTrailer;
    struct budb_tapeEntry tapeEntry;
    struct budb_volumeEntry volEntry;

    volEntry.dump = 0;
    PrintDumpLabel(&scanInfoPtr->dumpLabel);

    while (moreTapes) {
        /* While there is a tape to read *//*t */
        badscan = 0;
        while (1) {
            /* Read each volume on the tape *//*w */
            moreTapes = -1;
            tapePosition = tapeInfoPtr->position;	/* remember position */

            /*
             * Skip the volume data
             */
            tcode =
                scanVolData(taskId, tapeInfoPtr,
                            scanInfoPtr->tapeLabel.structVersion, &volHeader,
                            &volTrailer, &nbytes);
            if (tcode) {
                badscan++;

                if (tcode == TC_ABORTEDBYREQUEST) {	/* Aborted */
                    ERROR_EXIT(tcode);
                }

                if (tcode == BUTM_EOD) {
                    moreTapes = 0;	/* the end of the dump */
                    break;
                }

                /* Found a volume but it's incomplete. Skip over these */
                if (volHeader.volumeID) {
                    TapeLog(0, taskId, tcode, 0,
                            "Warning: volume %s (%u) ignored. Incomplete\n",
                            volHeader.volumeName, volHeader.volumeID);
                    continue;
                }

                /* No volume was found. We may have hit the EOT or a
                 * bad-spot. Try to skip over this spot.
                 */
                if (badscan < 2) {	/* allow 2 errors, then fail */
                    TapeLog(0, taskId, tcode, 0,
                            "Warning: Error in scanning tape - will try skipping volume\n");
                    continue;
                }
                if (scanInfoPtr->tapeLabel.structVersion >= TAPE_VERSION_4) {
                    TapeLog(0, taskId, tcode, 0,
                            "Warning: Error in scanning tape - end-of-tape inferred\n");
                    moreTapes = 1;	/* then assume next tape */
                } else {
                    ErrorLog(0, taskId, tcode, 0, "Error in scanning tape\n");
                    /* will ask if there is a next tape */
                }
                break;
            }

            PrintVolumeHeader(&volHeader);

            /* If this is not the first volume fragment, make sure it follows
             * the last volume fragment
             */
            if (volEntry.dump) {
                if ((volEntry.dump != volHeader.dumpID)
                        || (volEntry.id != volHeader.volumeID)
                        || (volEntry.seq != volHeader.frag - 2)
                        || (strcmp(volEntry.name, volHeader.volumeName))) {
                    TLog(taskId,
                         "Warning: volume %s (%u) ignored. Incomplete - no last fragment\n",
                         volEntry.name, volEntry.id);

                    if (scanInfoPtr->addDbFlag) {
                        tcode = flushSavedEntries(DUMP_FAILED);
                        if (tcode)
                            ERROR_EXIT(tcode);
                        volEntry.dump = 0;
                    }
                }
            }

            /* If this is the first volume fragment, make sure says so */
            if (scanInfoPtr->addDbFlag && !volEntry.dump
                    && (volHeader.frag != 1)) {
                TLog(taskId,
                     "Warning: volume %s (%u) ignored. Incomplete - no first fragment\n",
                     volHeader.volumeName, volHeader.volumeID);
            }

            /* Check that this volume belongs to the dump we are scanning */
            else if (scanInfoPtr->dumpLabel.dumpid
                     && (volHeader.dumpID != scanInfoPtr->dumpLabel.dumpid)) {
                TLog(taskId,
                     "Warning: volume %s (%u) ignored. Expected DumpId %u, got %u\n",
                     volHeader.volumeName, volHeader.volumeID,
                     scanInfoPtr->dumpLabel.dumpid, volHeader.dumpID);
            }

            /* Passed tests, Now add to the database (if dbadd flag is set) */
            else if (scanInfoPtr->addDbFlag) {
                /* Have enough information to create a dump entry */
                if (newDump) {
                    tcode = RcreateDump(scanInfoPtr, &volHeader);
                    if (tcode) {
                        ErrorLog(0, taskId, tcode, 0,
                                 "Can't add dump %u to database\n",
                                 volHeader.dumpID);
                        ERROR_EXIT(tcode);
                    }
                    newDump = 0;
                }

                /* Have enough information to create a tape entry */
                if (newTape) {
                    seq = extractTapeSeq(scanInfoPtr->tapeLabel.AFSName);
                    if (seq < 0)
                        ERROR_EXIT(TC_INTERNALERROR);

                    tcode =
                        useTape(&tapeEntry, volHeader.dumpID,
                                TNAME(&scanInfoPtr->tapeLabel), seq,
                                scanInfoPtr->tapeLabel.useCount,
                                scanInfoPtr->dumpLabel.creationTime,
                                scanInfoPtr->dumpLabel.expirationDate,
                                tapepos);
                    if (tcode) {
                        char gotName[BU_MAXTAPELEN + 32];

                        LABELNAME(gotName, &scanInfoPtr->tapeLabel);
                        ErrorLog(0, taskId, tcode, 0,
                                 "Can't add tape %s for dump %u to database\n",
                                 gotName, volHeader.dumpID);
                        ERROR_EXIT(tcode);
                    }
                    newTape = 0;
                }

                /* Create the volume entry */
                flags = ((volHeader.frag == 1) ? BUDB_VOL_FIRSTFRAG : 0);
                if (!volTrailer.contd)
                    flags |= BUDB_VOL_LASTFRAG;
                tcode =
                    addVolume(&volEntry, volHeader.dumpID,
                              TNAME(&scanInfoPtr->tapeLabel),
                              volHeader.volumeName, volHeader.volumeID,
                              volHeader.cloneDate, tapePosition, nbytes,
                              (volHeader.frag - 1), flags);
                if (tcode) {
                    ErrorLog(0, taskId, tcode, 0,
                             "Can't add volume %s (%u) for dump %u to database\n",
                             volHeader.volumeName, volHeader.volumeID,
                             volHeader.dumpID);
                    ERROR_EXIT(tcode);
                }
            }

            if (volTrailer.contd) {
                /* No need to read the EOD marker, we know there is a next tape */
                moreTapes = 1;
                break;
            } else {
                if (scanInfoPtr->addDbFlag) {
                    tcode = flushSavedEntries(DUMP_SUCCESS);
                    if (tcode)
                        ERROR_EXIT(tcode);
                    volEntry.dump = 0;
                }
            }
        }			/*w */

        if (!newTape) {
            if (scanInfoPtr->addDbFlag) {
                tcode =
                    finishTape(&tapeEntry,
                               (tapeInfoPtr->kBytes +
                                (tapeInfoPtr->nBytes ? 1 : 0)));
                if (tcode) {
                    char gotName[BU_MAXTAPELEN + 32];

                    LABELNAME(gotName, &scanInfoPtr->tapeLabel);
                    ErrorLog(0, taskId, tcode, 0,
                             "Can't mark tape %s 'completed' for dump %u in database\n",
                             gotName, tapeEntry.dump);
                    ERROR_EXIT(tcode);
                }
            }
        }

        /* Ask if there is another tape if we can't figure it out */
        if (moreTapes == -1)
            moreTapes = (queryoperator ? Ask("Are there more tapes") : 1);

        /* Get the next tape label */
        if (moreTapes) {
            char *tapeName;
            afs_int32 dumpid;

            unmountTape(taskId, tapeInfoPtr);

            tapeName = nextTapeLabel(scanInfoPtr->tapeLabel.AFSName);
            dumpid = scanInfoPtr->tapeLabel.dumpid;
            tcode =
                getScanTape(taskId, tapeInfoPtr, tapeName, dumpid, 1,
                            &scanInfoPtr->tapeLabel);
            if (tcode)
                ERROR_EXIT(tcode);
            newTape = 1;
        }
    }				/*t */

    if (!newDump) {
        if (scanInfoPtr->addDbFlag) {
            tcode = finishDump(&scanInfoPtr->dumpEntry);
            if (tcode) {
                ErrorLog(0, taskId, tcode, 0,
                         "Can't mark dump %u 'completed' in database\n",
                         scanInfoPtr->dumpEntry.id);
            }

            tcode = flushSavedEntries(DUMP_SUCCESS);
            if (tcode)
                ERROR_EXIT(tcode);
        }
    }

error_exit:
    return (code);
}