[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Antiright-devel] antiright/libantiright system.c
From: |
Jeffrey Bedard |
Subject: |
[Antiright-devel] antiright/libantiright system.c |
Date: |
Fri, 23 Feb 2007 15:30:45 +0000 |
CVSROOT: /sources/antiright
Module name: antiright
Changes by: Jeffrey Bedard <jefbed> 07/02/23 15:30:45
Modified files:
libantiright : system.c
Log message:
Reimplemented antiright_system using glib_spawn_command_line_asyncc().
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/antiright/libantiright/system.c?cvsroot=antiright&r1=1.4&r2=1.5
Patches:
Index: system.c
===================================================================
RCS file: /sources/antiright/antiright/libantiright/system.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- system.c 20 Feb 2007 04:29:43 -0000 1.4
+++ system.c 23 Feb 2007 15:30:45 -0000 1.5
@@ -26,46 +26,23 @@
antiright_system (char *field_string)
{
/* Ensure that FIELD_STRING is not empty. */
- if ((field_string != NULL) & (strlen (field_string) > 0))
+ ARIFP(field_string)
{
- int system_return_value = 0;
-
- if (field_string[strlen (field_string) - 1] != '&')
+ GError *error;
+ ARIFNB(g_spawn_command_line_async(field_string, &error))
{
- /* Do the following if there is no ampersand at the end of
- FIELD_STRING. */
-
- char *system_string;
-
- /* Append an ampersand to FIELD_STRING. Place the resulting string in
- SYSTEM_STRING. */
- asprintf (&system_string, "%s &", field_string);
-
- /* Ensure that SYSTEM_STRING was correctly allocated. */
- assert (system_string != NULL);
-
- /* Execute SYSTEM_STRING. */
- system_return_value = system (system_string);
-
- /* Clean up. */
- free (system_string);
+ ARWARN(error->message);
+ g_clear_error(&error);
+ return EXIT_FAILURE;
}
else
- {
- /* The input command already includes an ampersand and will become a
- background operation. */
- /* Execute raw FIELD_STRING. */
- system_return_value = system (field_string);
- }
-
- /* Return result of system call. */
- return (system_return_value);
+ return EXIT_SUCCESS;
}
else
{
/* The user input is empty, so generate an error. */
- perror ("FIELD_STRING is empty");
- return (-1);
+ ARWARN ("FIELD_STRING is empty");
+ return (EXIT_FAILURE);
}
}
@@ -75,6 +52,9 @@
char *command;
int return_value;
+ ARIFNP(format)
+ format="\n";
+
vasprintf (&command, format, list);
return_value = antiright_system (command);
free (command);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Antiright-devel] antiright/libantiright system.c,
Jeffrey Bedard <=