Exemple #1
0
static afs_int32 ScanForChildren(afs_int32 aparentID)
{
    DIR *tdir;
    register struct dirent *tde;
    afs_int32 dumpID, parent;
    register FILE *tfile;
    register afs_int32 code;
    afs_int32 j2, j3, j4;
    char dname[256];
    char dumpName[1024];

    tdir = opendir(AFSDIR_SERVER_BACKUP_DIRPATH);
    if (!tdir)
	return -1;

    for (tde = readdir(tdir); tde; tde = readdir(tdir)) {
	code = sscanf(tde->d_name, "D%ld.db", (long int *) &dumpID);
	if (code != 1)
	    continue;

	tfile = OpenDump(dumpID, "r");
	if (!tfile)
	    continue;		/* shouldn't happen, but should continue anyway */

	code = ScanDumpHdr(tfile, dname, dumpName, &parent, &j2, &j3, &j4);
	fclose(tfile);
	if (code) {
	    printf("backup:dsstub: bad dump header for dump %d\n", dumpID);
	    continue;
	}

	/* if this guy's parent is the ID we're scanning for, delete it */
	if (aparentID == parent) {
	    code = DeleteDump(dumpID);
	    if (code)
		printf("backup:dsstub: failed to delete child dump %d\n",
		       dumpID);
	}
    }
    closedir(tdir);
    return 0;
}
Exemple #2
0
BOOL KMemViewer::OnCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
	switch ( LOWORD(wParam) )
	{
		case IDC_BYTE:
		case IDC_WORD:
		case IDC_DWORD:
			DumpPage();
			return TRUE;

		case IDC_DOWN:
			if ( m_current + m_pagesize >= m_start + m_size )
				return FALSE;
			m_current += m_pagesize;
			DumpPage();
			return TRUE;

		case IDC_UP:
			if ( m_current == m_start )
				return FALSE;
			m_current -= m_pagesize;
			DumpPage();
			return TRUE;

		case IDC_MEMORYDUMP:
            OpenDump();
			Dump(m_start, 0, m_size, UnitSize());
            CloseDump();
			return TRUE;

		case IDC_SEARCH:
			Search();
			return TRUE;

		case IDOK:
			EndDialog(m_hWnd, TRUE);
			return TRUE;
	}

	return FALSE;
}