svn commit: r214737 - user/ae/usr.sbin/sade
Andrey V. Elsukov
ae at FreeBSD.org
Wed Nov 3 12:12:29 UTC 2010
Author: ae
Date: Wed Nov 3 12:12:29 2010
New Revision: 214737
URL: http://svn.freebsd.org/changeset/base/214737
Log:
Add simple commit/undo support.
Modified:
user/ae/usr.sbin/sade/ufsed.c
Modified: user/ae/usr.sbin/sade/ufsed.c
==============================================================================
--- user/ae/usr.sbin/sade/ufsed.c Wed Nov 3 10:46:39 2010 (r214736)
+++ user/ae/usr.sbin/sade/ufsed.c Wed Nov 3 12:12:29 2010 (r214737)
@@ -230,12 +230,17 @@ set_statusline(char *msg)
static int
ufsed_history_rollback(void *pentry)
{
+
+ free(pentry);
return (0);
}
static int
ufsed_history_play(void *pentry)
{
+
+ /* system(pentry); */
+ free(pentry);
return (0);
}
@@ -248,8 +253,21 @@ ufslist_reread(struct ufslist *fslist)
}
static int
+ufsed_history_add(history_t hist, const char *cmd)
+{
+ char *entry;
+
+ entry = strdup(cmd);
+ if (entry == NULL)
+ return (ENOMEM);
+
+ return (history_add_entry(hist, entry));
+}
+
+static int
tunefs_keyhndl(int key)
{
+
switch (key) {
case ' ':
case KEY_UP:
@@ -366,7 +384,7 @@ again:
}
if (flags != pfs->flags || ret != 0) { /* something changed */
snprintf(buf, sizeof(buf), "%s -L \"%s\"", PATH_TUNEFS,
- (s != NULL && *s != '\0') ? s: "");
+ (s != NULL) ? s: "");
for (i = 0; i < sizeof(checkbox) / sizeof(checkbox[0]); i++) {
snprintf(buf, sizeof(buf), "%s %s %s", buf,
checkbox[i].arg,
@@ -376,6 +394,17 @@ again:
snprintf(buf, sizeof(buf), "%s %s%s", buf, _PATH_DEV,
pfs->partname);
/* add command to history */
+ ret = ufsed_history_add(hist, buf);
+ if (ret)
+ dmenu_open_errormsg("Operation failed.");
+ else { /* do fake changes to update current view */
+ pfs->flags = flags;
+ free(pfs->volname);
+ if (s != NULL && *s != '\0')
+ pfs->volname = strndup(s, MAXVOLLEN);
+ else
+ pfs->volname = NULL;
+ }
}
done:
restorescr(win);
More information about the svn-src-user
mailing list