[Frugalware-git] setup: new fw_system_interactive() function

VMiklos vmiklos at frugalware.org
Sun Jul 15 14:35:00 CEST 2007


Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=setup/.git;a=commitdiff;h=fa8f91bfa1d1b3970b750d70c5c98ca061075a7a

commit fa8f91bfa1d1b3970b750d70c5c98ca061075a7a
Author: VMiklos <vmiklos at frugalware.org>
Date:   Sun Jul 15 14:19:01 2007 +0200

new fw_system_interactive() function
if one call this, then the command (path + args) and the return code will be
logged only, ie the output is not. ideal for interactive commands

diff --git a/src/util.c b/src/util.c
index 6455356..a28f52e 100644
--- a/src/util.c
+++ b/src/util.c
@@ -348,6 +348,19 @@ int fw_system(char* cmd)
return (ret);
}

+int fw_system_interactive(char* cmd)
+{
+	char *ptr, line[PATH_MAX];
+	FILE *pp;
+	int ret;
+
+	LOG("running external command: '%s'", cmd);
+	ptr = g_strdup_printf("%s 2>&1", cmd);
+	ret = system(ptr);
+	FREE(ptr);
+	LOG("external command returned with exit code '%d'", ret);
+	return (ret);
+}
char *drop_version(char *str)
{
char *ptr;
diff --git a/src/util.h b/src/util.h
index 74bd0b4..ec1b129 100644
--- a/src/util.h
+++ b/src/util.h
@@ -43,6 +43,7 @@ int exit_confirm(void);
int exit_perform(void);
char **glist4dialog(GList *list, char *blank);
int fw_system(char* cmd);
+int fw_system_interactive(char* cmd);
int makepath(char *path);
int rmrf(char *path);
int umount_if_needed(char *sourcedir);


More information about the Frugalware-git mailing list