Ejemplo n.º 1
0
bool RelationData::undelete(QString & warning, QString & renamed,
                            BrowserRelation * rel, BooL & br_deleted)
{
    QString s;
    bool changed = FALSE;
    BrowserNode * parent = (BrowserNode *) rel->parent();

    if (is_a(rel)) {
        while (parent->wrong_child_name(a.role, type, FALSE, TRUE)) {
            changed = TRUE;
            a.role = "_" + a.role;
        }
    }
    else {
        while (parent->wrong_child_name(b.role, type, FALSE, TRUE)) {
            changed = TRUE;
            b.role = "_" + b.role;
        }
    }

    br_deleted = FALSE;
    undelete(warning, renamed);

    return changed;
}
Ejemplo n.º 2
0
int append(int laddr, char under_glob)
	{
	register int status;

	if(*lp != '\n'  &&  *lp++ != ' ') {
		if(*(lp + -1) == 'd')
			return(undelete(laddr));
		return(ERROR9);
		}

	curln = laddr;
	if((status = addline(esc_line(lp), 0, 0)) == OK) {
		curcol = left_margin;
		change_state(TEXT);
		if(!under_glob)
			opt.opt_n = TRUE;
		if(opt.opt_s  &&  ++auto_save_cnt >= SAVE_THRESHOLD) {
			_write("auto_save", 1, lastln, 0, 0);
			auto_save_cnt = 0;
			}
		}

	lp = "\n";  /* forces main to fetch a new line */
	return( status );
	}
Ejemplo n.º 3
0
Archivo: rm.c Proyecto: cheusov/nbase
static void
rm_file(char **argv)
{
	struct stat sb;
	int rval;
	char *f;

	/*
	 * Remove a file.  POSIX 1003.2 states that, by default, attempting
	 * to remove a directory is an error, so must always stat the file.
	 */
	while ((f = *argv++) != NULL) {
		/* Assume if can't stat the file, can't unlink it. */
		if (lstat(f, &sb)) {
			if (Wflag) {
				sb.st_mode = S_IFWHT|S_IWUSR|S_IRUSR;
			} else {
				if (!fflag || !NONEXISTENT(errno)) {
					warn("%s", f);
					eval = 1;
				}
				continue;
			}
		} else if (Wflag) {
			warnx("%s: %s", f, strerror(EEXIST));
			eval = 1;
			continue;
		}

		if (S_ISDIR(sb.st_mode) && !dflag) {
			warnx("%s: is a directory", f);
			eval = 1;
			continue;
		}
		if (!fflag && !S_ISWHT(sb.st_mode) && !check(f, f, &sb))
			continue;
		if (S_ISWHT(sb.st_mode))
#ifdef HAVE_FUNC1_UNDELETE_UNISTD_H
			rval = undelete(f);
#else
			rval = EPERM;
#endif
		else if (S_ISDIR(sb.st_mode))
			rval = rmdir(f);
		else {
			if (Pflag) {
				if (rm_overwrite(f, &sb))
					continue;
			}
			rval = unlink(f);
		}
		if (rval && (!fflag || !NONEXISTENT(errno))) {
			warn("%s", f);
			eval = 1;
		}
		if (vflag && rval == 0)
			(void)printf("%s\n", f);
	}
Ejemplo n.º 4
0
static gboolean key_press_event(GtkWidget *widget, GdkEventKey *event,
    gpointer data)
{
	struct coord pos = canvas_to_coord(curr_pos.x, curr_pos.y);

	DPRINTF("--- key press ---");
	switch (event->keyval) {
	case ' ':
		user_origin = pos;
		update_pos(pos);
		break;
	case '+':
	case '=':
		zoom_in(pos);
		break;
	case '-':
		zoom_out(pos);
		break;
	case '*':
		zoom_to_extents();
		break;
	case '#':
		zoom_to_frame();
		break;
	case '.':
		tool_dehover();
		draw_ctx.center = pos;
		redraw();
		tool_hover(canvas_to_coord(curr_pos.x, curr_pos.y));
		break;
	case GDK_BackSpace:
	case GDK_Delete:
#if 0
	case GDK_KP_Delete:
		if (selected_inst) {
			inst_delete(selected_inst);
			change_world();
		}
		break;
#endif
	case 'u':
		if (undelete())
			change_world();
		break;
	case '/':
{
/* @@@ find a better place for this */
extern int show_vars;
		show_vars = !show_vars;
change_world();
}
	}
	return TRUE;
}
Ejemplo n.º 5
0
void BrowserNode::undelete(bool rec) {
  QString warning;
  QString renamed;
  
  if (undelete(rec, warning, renamed) && rec) {
    // Redo it because now all classes are undeleted but it is
    // possible that some relations was not undeleted because
    // at least one of the two extremities was not undeleted
    warning = QString::null;
    undelete(rec, warning, renamed);
  }
      
  if (!warning.isEmpty())
    warning = "<p>" + TR("Some items cannot be undeleted") + " :\n<ul>"
      + warning + "</ul></p>";
  
  if (! renamed.isEmpty()) {
    warning += "<p>" + TR("Some items are renamed") + " :\n<ul>"
      + renamed + "</ul></p>";
  }
  if (!warning.isEmpty())
    warn(warning);
}
Ejemplo n.º 6
0
static void
rm_tree(char **argv)
{
	FTS *fts;
	FTSENT *p;
	int flags, needstat, rval;
			
	/*
	 * Remove a file hierarchy.  If forcing removal (-f), or interactive
	 * (-i) or can't ask anyway (stdin_ok), don't stat the file.
	 */
	needstat = !fflag && !iflag && stdin_ok;

	/*
	 * If the -i option is specified, the user can skip on the pre-order
	 * visit.  The fts_number field flags skipped directories.
	 */
#define	SKIPPED	1

	flags = FTS_PHYSICAL;
	if (!needstat)
		flags |= FTS_NOSTAT;
#ifndef __ANDROID__
	if (Wflag)
		flags |= FTS_WHITEOUT;
#endif
	if (xflag)
		flags |= FTS_XDEV;
	if ((fts = fts_open(argv, flags, NULL)) == NULL)
		err(1, "fts_open failed");
	while ((p = fts_read(fts)) != NULL) {
	
		switch (p->fts_info) {
		case FTS_DNR:
			if (!fflag || p->fts_errno != ENOENT) {
				warnx("%s: %s", p->fts_path,
						strerror(p->fts_errno));
				eval = 1;
			}
			continue;
		case FTS_ERR:
			errx(EXIT_FAILURE, "%s: %s", p->fts_path,
					strerror(p->fts_errno));
			/* NOTREACHED */
		case FTS_NS:
			/*
			 * FTS_NS: assume that if can't stat the file, it
			 * can't be unlinked.
			 */
			if (fflag && NONEXISTENT(p->fts_errno))
				continue;
			if (needstat) {
				warnx("%s: %s", p->fts_path,
						strerror(p->fts_errno));
				eval = 1;
				continue;
			}
			break;
		case FTS_D:
			/* Pre-order: give user chance to skip. */
			if (!fflag && !check(p->fts_path, p->fts_accpath,
			    p->fts_statp)) {
				(void)fts_set(fts, p, FTS_SKIP);
				p->fts_number = SKIPPED;
			}
			continue;
		case FTS_DP:
			/* Post-order: see if user skipped. */
			if (p->fts_number == SKIPPED)
				continue;
			break;
		default:
			if (!fflag &&
			    !check(p->fts_path, p->fts_accpath, p->fts_statp))
				continue;
		}

		rval = 0;
		/*
		 * If we can't read or search the directory, may still be
		 * able to remove it.  Don't print out the un{read,search}able
		 * message unless the remove fails.
		 */
		switch (p->fts_info) {
		case FTS_DP:
		case FTS_DNR:
			rval = rmdir(p->fts_accpath);
			if (rval != 0 && fflag && errno == ENOENT)
				continue;
			break;

#ifndef __ANDROID__
		case FTS_W:
			rval = undelete(p->fts_accpath);
			if (rval != 0 && fflag && errno == ENOENT)
				continue;
			break;
#endif

		default:
			if (Pflag) {
				if (rm_overwrite(p->fts_accpath, NULL))
					continue;
			}
			rval = unlink(p->fts_accpath);
			if (rval != 0 && fflag && NONEXISTENT(errno))
				continue;
			break;
		}
		if (rval != 0) {
			warn("%s", p->fts_path);
			eval = 1;
		} else if (vflag || pinfo) {
			pinfo = 0;
			(void)printf("%s\n", p->fts_path);
		}
	}
	if (errno)
		err(1, "fts_read");
	fts_close(fts);
}
Ejemplo n.º 7
0
				SLOT(changeSoPin()) );
	token->addAction(tr("Init PIN"), this,
				SLOT(initPin()) );

	extra = menuBar()->addMenu(tr("Extra"));
	acList += extra->addAction(tr("&Dump DataBase"), this,
				SLOT(dump_database()));
	acList += extra->addAction(tr("&Export Certificate Index"), this,
				SLOT(exportIndex()));
	acList += extra->addAction(tr("&Export Certificate Index hierarchy"), this,
				SLOT(exportIndexHierarchy()));
	acList += extra->addAction(tr("C&hange DataBase password"), this,
				SLOT(changeDbPass()));
#if 0
	acList += extra->addAction(tr("&Undelete items"), this,
				SLOT(undelete()));
#endif
	extra->addAction(tr("Generate DH parameter"), this,
				 SLOT(generateDHparam()));
	extra->addAction(tr("OID Resolver"), resolver, SLOT(show()));

	help = menuBar()->addMenu(tr("&Help") );
	help->addAction(tr("&Content"), this, SLOT(help()),
			QKeySequence::HelpContents);
	a = new QAction(tr("About"), this);
	connect(a, SIGNAL(triggered()), this, SLOT(about()));
	a->setMenuRole(QAction::AboutRole);
	help->addAction(a);
	wdMenuList += import;
	scardList += token;
Ejemplo n.º 8
0
static void
rm_file(char **argv)
{
    struct stat sb;
    int rval;
    char *f;

    /*
     * Remove a file.  POSIX 1003.2 states that, by default, attempting
     * to remove a directory is an error, so must always stat the file.
     */
    while ((f = *argv++) != NULL) {
        /* Assume if can't stat the file, can't unlink it. */
        if (lstat(f, &sb)) {
            if (Wflag) {
                sb.st_mode = S_IFWHT|S_IWUSR|S_IRUSR;
            } else {
                if (!fflag || errno != ENOENT) {
                    warn("%s", f);
                    eval = 1;
                }
                continue;
            }
        } else if (Wflag) {
            warnx("%s: %s", f, strerror(EEXIST));
            eval = 1;
            continue;
        }

        if (S_ISDIR(sb.st_mode) && !dflag) {
            warnx("%s: is a directory", f);
            eval = 1;
            continue;
        }
        if (!fflag && !S_ISWHT(sb.st_mode) && !check(f, f, &sb))
            continue;
        rval = 0;
        if (!uid && !S_ISWHT(sb.st_mode) &&
                (sb.st_flags & (UF_APPEND|UF_IMMUTABLE)) &&
                !(sb.st_flags & (SF_APPEND|SF_IMMUTABLE)))
            rval = lchflags(f, sb.st_flags & ~(UF_APPEND|UF_IMMUTABLE));
        if (rval == 0) {
            if (S_ISWHT(sb.st_mode))
                rval = undelete(f);
            else if (S_ISDIR(sb.st_mode))
                rval = rmdir(f);
            else {
                if (Pflag)
                    if (!rm_overwrite(f, &sb))
                        continue;
                rval = unlink(f);
            }
        }
        if (rval && (!fflag || errno != ENOENT)) {
            warn("%s", f);
            eval = 1;
        }
        if (vflag && rval == 0)
            (void)printf("%s\n", f);
        if (info && rval == 0) {
            info = 0;
            (void)printf("%s\n", f);
        }
    }
}
Ejemplo n.º 9
0
static void
rm_tree(char **argv)
{
    FTS *fts;
    FTSENT *p;
    int needstat;
    int flags;
    int rval;

    /*
     * Remove a file hierarchy.  If forcing removal (-f), or interactive
     * (-i) or can't ask anyway (stdin_ok), don't stat the file.
     */
    needstat = !uid || (!fflag && !iflag && stdin_ok);

    /*
     * If the -i option is specified, the user can skip on the pre-order
     * visit.  The fts_number field flags skipped directories.
     */
#define	SKIPPED	1

    flags = FTS_PHYSICAL;
    if (!needstat)
        flags |= FTS_NOSTAT;
    if (Wflag)
        flags |= FTS_WHITEOUT;
    if (xflag)
        flags |= FTS_XDEV;
    if (!(fts = fts_open(argv, flags, NULL))) {
        if (fflag && errno == ENOENT)
            return;
        err(1, "fts_open");
    }
    while ((p = fts_read(fts)) != NULL) {
        switch (p->fts_info) {
        case FTS_DNR:
            if (!fflag || p->fts_errno != ENOENT) {
                warnx("%s: %s",
                      p->fts_path, strerror(p->fts_errno));
                eval = 1;
            }
            continue;
        case FTS_ERR:
            errx(1, "%s: %s", p->fts_path, strerror(p->fts_errno));
        case FTS_NS:
            /*
             * Assume that since fts_read() couldn't stat the
             * file, it can't be unlinked.
             */
            if (!needstat)
                break;
            if (!fflag || p->fts_errno != ENOENT) {
                warnx("%s: %s",
                      p->fts_path, strerror(p->fts_errno));
                eval = 1;
            }
            continue;
        case FTS_D:
            /* Pre-order: give user chance to skip. */
            if (!fflag && !check(p->fts_path, p->fts_accpath,
                                 p->fts_statp)) {
                (void)fts_set(fts, p, FTS_SKIP);
                p->fts_number = SKIPPED;
            }
            else if (!uid &&
                     (p->fts_statp->st_flags & (UF_APPEND|UF_IMMUTABLE)) &&
                     !(p->fts_statp->st_flags & (SF_APPEND|SF_IMMUTABLE)) &&
                     lchflags(p->fts_accpath,
                              p->fts_statp->st_flags &= ~(UF_APPEND|UF_IMMUTABLE)) < 0)
                goto err;
            continue;
        case FTS_DP:
            /* Post-order: see if user skipped. */
            if (p->fts_number == SKIPPED)
                continue;
            break;
        default:
            if (!fflag &&
                    !check(p->fts_path, p->fts_accpath, p->fts_statp))
                continue;
        }

        rval = 0;
        if (!uid &&
                (p->fts_statp->st_flags & (UF_APPEND|UF_IMMUTABLE)) &&
                !(p->fts_statp->st_flags & (SF_APPEND|SF_IMMUTABLE)))
            rval = lchflags(p->fts_accpath,
                            p->fts_statp->st_flags &= ~(UF_APPEND|UF_IMMUTABLE));
        if (rval == 0) {
            /*
             * If we can't read or search the directory, may still be
             * able to remove it.  Don't print out the un{read,search}able
             * message unless the remove fails.
             */
            switch (p->fts_info) {
            case FTS_DP:
            case FTS_DNR:
                rval = rmdir(p->fts_accpath);
                if (rval == 0 || (fflag && errno == ENOENT)) {
                    if (rval == 0 && vflag)
                        (void)printf("%s\n",
                                     p->fts_path);
                    if (rval == 0 && info) {
                        info = 0;
                        (void)printf("%s\n",
                                     p->fts_path);
                    }
                    continue;
                }
                break;

            case FTS_W:
                rval = undelete(p->fts_accpath);
                if (rval == 0 && (fflag && errno == ENOENT)) {
                    if (vflag)
                        (void)printf("%s\n",
                                     p->fts_path);
                    if (info) {
                        info = 0;
                        (void)printf("%s\n",
                                     p->fts_path);
                    }
                    continue;
                }
                break;

            case FTS_NS:
                /*
                 * Assume that since fts_read() couldn't stat
                 * the file, it can't be unlinked.
                 */
                if (fflag)
                    continue;
            /* FALLTHROUGH */

            case FTS_F:
            case FTS_NSOK:
                if (Pflag)
                    if (!rm_overwrite(p->fts_accpath, p->fts_info ==
                                      FTS_NSOK ? NULL : p->fts_statp))
                        continue;
            /* FALLTHROUGH */

            default:
                rval = unlink(p->fts_accpath);
                if (rval == 0 || (fflag && errno == ENOENT)) {
                    if (rval == 0 && vflag)
                        (void)printf("%s\n",
                                     p->fts_path);
                    if (rval == 0 && info) {
                        info = 0;
                        (void)printf("%s\n",
                                     p->fts_path);
                    }
                    continue;
                }
            }
        }
err:
        warn("%s", p->fts_path);
        eval = 1;
    }
    if (!fflag && errno)
        err(1, "fts_read");
    fts_close(fts);
}
Ejemplo n.º 10
0
void MainWindow::init_menu()
{
	QMenu *file, *help, *import, *token;

	file = menuBar()->addMenu(tr("&File"));
	file->addAction(tr("&New DataBase"), this, SLOT(new_database()),
		QKeySequence::New);
	file->addAction(tr("&Open DataBase"), this, SLOT(load_database()),
		QKeySequence::Open);
	file->addAction(tr("Generate DH parameter"), this,
				 SLOT(generateDHparam()));
	acList += file->addAction(tr("&Close DataBase"), this,
		SLOT(close_database()), QKeySequence(QKeySequence::Close));
	acList += file->addAction(tr("&Dump DataBase"), this,
				SLOT(dump_database()));
	acList += file->addAction(tr("C&hange DataBase password"), this,
				SLOT(changeDbPass()));
	acList += file->addAction(tr("&Import old db_dump"), this,
				SLOT(import_dbdump()));
	acList += file->addAction(tr("&Undelete items"), this,
				SLOT(undelete()));
	file->addSeparator();
	acList += file->addAction(tr("Options"), this, SLOT(setOptions()));
	file->addSeparator();
	file->addAction(tr("Exit"), qApp, SLOT(quit()), Qt::ALT+Qt::Key_F4);

	import = menuBar()->addMenu(tr("I&mport"));
	import->addAction(tr("Keys"), this,
				SLOT(on_BNimportKey_clicked()) );
	import->addAction(tr("Requests"), this,
				SLOT(on_BNimportReq_clicked()) );
	import->addAction(tr("Certificates"), this,
				SLOT(on_BNimportCert_clicked()) );
	import->addAction(tr("PKCS#12"), this,
				SLOT(on_BNimportPKCS12_clicked()) );
	import->addAction(tr("PKCS#7"), this,
				SLOT(on_BNimportPKCS7_clicked()) );
	import->addAction(tr("Template"), this,
				SLOT(on_BNimportTemp_clicked()) );
	import->addAction(tr("Revocation list"), this,
				SLOT(on_BNimportCrl_clicked()) );
	import->addAction(tr("PEM file"), this,
				SLOT(loadPem()) );
	import->addAction(tr("paste PEM file"), this,
				SLOT(pastePem()) );

	token = menuBar()->addMenu(tr("&Token"));
	token->addAction(tr("&Manage Security token"), this,
				SLOT(manageToken()));
	token->addAction(tr("&Init Security token"),  this,
				SLOT(initToken()));
	token->addAction(tr("&Change PIN"), this,
				SLOT(changePin()) );
	token->addAction(tr("Change &SO PIN"), this,
				SLOT(changeSoPin()) );
	token->addAction(tr("Init PIN"), this,
				SLOT(initPin()) );

	help = menuBar()->addMenu(tr("&Help") );
	help->addAction(tr("&Content"), this, SLOT(help()),
			QKeySequence::HelpContents);
	help->addAction(tr("&About"), this, SLOT(about()) );
	help->addAction(tr("Donations"), this, SLOT(donations()) );
	wdList += import;
	scardList += token;
}
Ejemplo n.º 11
0
Archivo: rm.c Proyecto: dezelin/kBuild
static int
rm_file(char **argv)
{
	struct stat sb;
	int rval;
	char *f;

	/*
	 * Check up front before anything is deleted.
	 */
	int i;
	for (i = 0; argv[i]; i++) {
		if (kBuildProtectionEnforce(&g_ProtData, KBUILDPROTECTIONTYPE_FULL, argv[i]))
			return 1;
	}

	/*
	 * Remove a file.  POSIX 1003.2 states that, by default, attempting
	 * to remove a directory is an error, so must always stat the file.
	 */
	while ((f = *argv++) != NULL) {
		const char *operation = "?";
		/* Assume if can't stat the file, can't unlink it. */
		if (lstat(f, &sb)) {
#ifdef FTS_WHITEOUT
			if (Wflag) {
				sb.st_mode = S_IFWHT|S_IWUSR|S_IRUSR;
			} else {
#else
			{
#endif
				if (!fflag || errno != ENOENT) {
					fprintf(stderr, "lstat: %s: %s: %s " CUR_LINE() "\n", argv0, f, strerror(errno));
					eval = 1;
				}
				continue;
			}
#ifdef FTS_WHITEOUT
		} else if (Wflag) {
			fprintf(stderr, "%s: %s: %s\n", argv0, f, strerror(EEXIST));
			eval = 1;
			continue;
#endif
		}

		if (S_ISDIR(sb.st_mode) && !dflag) {
			fprintf(stderr, "%s: %s: is a directory\n", argv0, f);
			eval = 1;
			continue;
		}
		if (!fflag && !S_ISWHT(sb.st_mode) && !check(f, f, &sb))
			continue;
		rval = 0;
#ifdef UF_APPEND
		if (!uid &&
		    (sb.st_flags & (UF_APPEND|UF_IMMUTABLE)) &&
		    !(sb.st_flags & (SF_APPEND|SF_IMMUTABLE)))
			rval = chflags(f, sb.st_flags & ~(UF_APPEND|UF_IMMUTABLE));
#endif
		if (rval == 0) {
			if (S_ISWHT(sb.st_mode)) {
				rval = undelete(f);
				operation = "undelete";
			} else if (S_ISDIR(sb.st_mode)) {
				rval = rmdir(f);
				operation = "rmdir";
			} else {
				if (Pflag)
					if (!rm_overwrite(f, &sb))
						continue;
				rval = unlink(f);
#ifdef _MSC_VER
				if (rval != 0) {
					chmod(f, 0777);
					rval = unlink(f);
				}
#endif
				operation = "unlink";
			}
		}
		if (rval && (!fflag || errno != ENOENT)) {
			fprintf(stderr, "%s: %s: %s: %s" CUR_LINE() "\n", operation, argv0, f, strerror(errno));
			eval = 1;
		}
		if (vflag && rval == 0)
			(void)printf("%s\n", f);
	}
	return eval;
}
Ejemplo n.º 12
0
Archivo: rm.c Proyecto: dezelin/kBuild
static int
rm_tree(char **argv)
{
	FTS *fts;
	FTSENT *p;
	int needstat;
	int flags;
	int rval;

	/*
	 * Check up front before anything is deleted. This will not catch
	 * everything, but we'll check the individual items later.
	 */
	int i;
	for (i = 0; argv[i]; i++) {
		if (kBuildProtectionEnforce(&g_ProtData, KBUILDPROTECTIONTYPE_RECURSIVE, argv[i])) {
			return 1;
		}
	}

	/*
	 * Remove a file hierarchy.  If forcing removal (-f), or interactive
	 * (-i) or can't ask anyway (stdin_ok), don't stat the file.
	 */
	needstat = !uid || (!fflag && !iflag && stdin_ok);

	/*
	 * If the -i option is specified, the user can skip on the pre-order
	 * visit.  The fts_number field flags skipped directories.
	 */
#define	SKIPPED	1

	flags = FTS_PHYSICAL;
	if (!needstat)
		flags |= FTS_NOSTAT;
#ifdef FTS_WHITEOUT
	if (Wflag)
		flags |= FTS_WHITEOUT;
#endif
	if (!(fts = fts_open(argv, flags, NULL))) {
		return err(1, "fts_open");
	}
	while ((p = fts_read(fts)) != NULL) {
		const char *operation = "chflags";
		switch (p->fts_info) {
		case FTS_DNR:
			if (!fflag || p->fts_errno != ENOENT) {
				fprintf(stderr, "fts: %s: %s: %s" CUR_LINE() "\n",
				        argv0, p->fts_path, strerror(p->fts_errno));
				eval = 1;
			}
			continue;
		case FTS_ERR:
			fts_close(fts);
			return errx(1, "fts: %s: %s " CUR_LINE(), p->fts_path, strerror(p->fts_errno));
		case FTS_NS:
			/*
			 * Assume that since fts_read() couldn't stat the
			 * file, it can't be unlinked.
			 */
			if (!needstat)
				break;
			if (!fflag || p->fts_errno != ENOENT) {
				fprintf(stderr, "fts: %s: %s: %s " CUR_LINE() "\n",
				        argv0, p->fts_path, strerror(p->fts_errno));
				eval = 1;
			}
			continue;
		case FTS_D:
			/* Pre-order: give user chance to skip. */
			if (!fflag && !check(p->fts_path, p->fts_accpath,
			    p->fts_statp)) {
				(void)fts_set(fts, p, FTS_SKIP);
				p->fts_number = SKIPPED;
			}
#ifdef UF_APPEND
			else if (!uid &&
				 (p->fts_statp->st_flags & (UF_APPEND|UF_IMMUTABLE)) &&
				 !(p->fts_statp->st_flags & (SF_APPEND|SF_IMMUTABLE)) &&
				 chflags(p->fts_accpath,
					 p->fts_statp->st_flags &= ~(UF_APPEND|UF_IMMUTABLE)) < 0)
				goto err;
#endif
			continue;
		case FTS_DP:
			/* Post-order: see if user skipped. */
			if (p->fts_number == SKIPPED)
				continue;
			break;
		default:
			if (!fflag &&
			    !check(p->fts_path, p->fts_accpath, p->fts_statp))
				continue;
		}

		/*
		 * Protect against deleting root files and directories.
		 */
		if (kBuildProtectionEnforce(&g_ProtData, KBUILDPROTECTIONTYPE_RECURSIVE, p->fts_accpath)) {
			fts_close(fts);
			return 1;
		}

		rval = 0;
#ifdef UF_APPEND
		if (!uid &&
		    (p->fts_statp->st_flags & (UF_APPEND|UF_IMMUTABLE)) &&
		    !(p->fts_statp->st_flags & (SF_APPEND|SF_IMMUTABLE)))
			rval = chflags(p->fts_accpath,
				       p->fts_statp->st_flags &= ~(UF_APPEND|UF_IMMUTABLE));
#endif
		if (rval == 0) {
			/*
			 * If we can't read or search the directory, may still be
			 * able to remove it.  Don't print out the un{read,search}able
			 * message unless the remove fails.
			 */
			switch (p->fts_info) {
			case FTS_DP:
			case FTS_DNR:
				rval = rmdir(p->fts_accpath);
				if (rval == 0 || (fflag && errno == ENOENT)) {
					if (rval == 0 && vflag)
						(void)printf("%s\n",
						    p->fts_path);
					continue;
				}
				operation = "mkdir";
				break;

#ifdef FTS_W
			case FTS_W:
				rval = undelete(p->fts_accpath);
				if (rval == 0 && (fflag && errno == ENOENT)) {
					if (vflag)
						(void)printf("%s\n",
						    p->fts_path);
					continue;
				}
				operation = "undelete";
				break;
#endif

			case FTS_NS:
				/*
				 * Assume that since fts_read() couldn't stat
				 * the file, it can't be unlinked.
				 */
				if (fflag)
					continue;
				/* FALLTHROUGH */
			default:
				if (Pflag)
					if (!rm_overwrite(p->fts_accpath, NULL))
						continue;
				rval = unlink(p->fts_accpath);
#ifdef _MSC_VER
				if (rval != 0) {
    					chmod(p->fts_accpath, 0777);
					rval = unlink(p->fts_accpath);
				}
#endif

				if (rval == 0 || (fflag && errno == ENOENT)) {
					if (rval == 0 && vflag)
						(void)printf("%s\n",
						    p->fts_path);
					continue;
				}
				operation = "unlink";
				break;
			}
		}
#ifdef UF_APPEND
err:
#endif
		fprintf(stderr, "%s: %s: %s: %s " CUR_LINE() "\n", operation, argv0, p->fts_path, strerror(errno));
		eval = 1;
	}
	if (errno) {
		fprintf(stderr, "%s: fts_read: %s " CUR_LINE() "\n", argv0, strerror(errno));
		eval = 1;
	}
	fts_close(fts);
	return eval;
}