[svn:parrot] r42964 - in trunk/config/gen/platform: . ansi generic win32

darbelo at svn.parrot.org darbelo at svn.parrot.org
Wed Dec 9 21:32:53 UTC 2009


Author: darbelo
Date: Wed Dec  9 21:32:53 2009
New Revision: 42964
URL: https://trac.parrot.org/parrot/changeset/42964

Log:
Kill Parrot_OS_Exec_Command, Parrot_OS_Exec_Command_Argv and their misspelt cousins.
They were unused, untested and simple enough to add back if we ever decide we want them.
plobsing++ for noticing this.

Modified:
   trunk/config/gen/platform/ansi/exec.c
   trunk/config/gen/platform/generic/exec.c
   trunk/config/gen/platform/platform_interface.h
   trunk/config/gen/platform/win32/exec.c

Modified: trunk/config/gen/platform/ansi/exec.c
==============================================================================
--- trunk/config/gen/platform/ansi/exec.c	Wed Dec  9 20:57:35 2009	(r42963)
+++ trunk/config/gen/platform/ansi/exec.c	Wed Dec  9 21:32:53 2009	(r42964)
@@ -57,21 +57,6 @@
 
 /*
 
-=item C<void Parrot_Exec_OS_Comman(PARROT_INTERP, STRING *command)>
-
-=cut
-
-*/
-
-void
-Parrot_Exec_OS_Comman(PARROT_INTERP, STRING *command)
-{
-    Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_NOSPAWN,
-            "Exec not implemented");
-}
-
-/*
-
 =back
 
 =cut

Modified: trunk/config/gen/platform/generic/exec.c
==============================================================================
--- trunk/config/gen/platform/generic/exec.c	Wed Dec  9 20:57:35 2009	(r42963)
+++ trunk/config/gen/platform/generic/exec.c	Wed Dec  9 21:32:53 2009	(r42964)
@@ -127,28 +127,6 @@
 }
 
 /*
-
-=item C<void Parrot_Exec_OS_Command(PARROT_INTERP, STRING *command)>
-
-=cut
-
-*/
-
-void
-Parrot_Exec_OS_Command(PARROT_INTERP, STRING *command)
-{
-    /* Be horribly profligate with memory, since we're
-       about to be something else */
-    char *cmd  = Parrot_str_to_cstring(interp, command);
-    int status = execlp("sh", "sh", "-c", cmd, (void *)NULL);
-
-    /* if we get here, something's horribly wrong... */
-    if (status)
-        Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_NOSPAWN,
-            "Exec failed, code %i", status);
-}
-
-/*
  * Local variables:
  *   c-file-style: "parrot"
  * End:

Modified: trunk/config/gen/platform/platform_interface.h
==============================================================================
--- trunk/config/gen/platform/platform_interface.h	Wed Dec  9 20:57:35 2009	(r42963)
+++ trunk/config/gen/platform/platform_interface.h	Wed Dec  9 21:32:53 2009	(r42964)
@@ -135,9 +135,7 @@
 
 struct parrot_string_t;
 INTVAL Parrot_Run_OS_Command(Interp*, struct parrot_string_t *);
-void Parrot_Exec_OS_Command(Interp*, struct parrot_string_t *);
 INTVAL Parrot_Run_OS_Command_Argv(Interp*, struct PMC *);
-void Parrot_Exec_OS_Command_Argv(Interp*, struct PMC *);
 
 #endif /* PARROT_PLATFORM_INTERFACE_H_GUARD */
 

Modified: trunk/config/gen/platform/win32/exec.c
==============================================================================
--- trunk/config/gen/platform/win32/exec.c	Wed Dec  9 20:57:35 2009	(r42963)
+++ trunk/config/gen/platform/win32/exec.c	Wed Dec  9 21:32:53 2009	(r42964)
@@ -147,94 +147,6 @@
 
 /*
 
-=item C<void Parrot_Exec_OS_Command(PARROT_INTERP, STRING *command)>
-
-Exits parrot and passes control to the specified process. Does not return. Raises an exception
-if the exec fails.
-
-=cut
-
-*/
-
-void
-Parrot_Exec_OS_Command(PARROT_INTERP, STRING *command)
-{
-    int status;
-    char *in = Parrot_str_to_cstring(interp, command);
-    char *cmd = NULL;
-    const char **argv = (const char **)mem_sys_allocate_zeroed(2 * sizeof (int));
-
-    /* Grab string, extract command and parameters. */
-    char *curPos  = in;
-    char *lastCommandStart = in;
-    char seekChar = 0;
-    int argc      = 1;
-    while (*curPos)
-    {
-        /* If we don't have a seek character and this is a quote... */
-        if (seekChar == 0 && (*curPos == '\'' || *curPos == '"'))
-        {
-            seekChar = *curPos;
-            lastCommandStart = curPos;
-        }
-
-        /* If we don't have a seek character and this is not a space... */
-        else if (seekChar == 0 && *curPos != ' ')
-        {
-            if (!seekChar)
-                seekChar = ' ';
-            lastCommandStart = curPos;
-        }
-
-        /* If we seek the seek character... */
-        else if (*curPos == seekChar || (*(curPos + 1) == 0 && seekChar == ' '))
-        {
-            /* Copy what we found to a temporary string. */
-            char *tmp;
-            int lenFound = curPos - lastCommandStart;
-            if (*(curPos + 1) == 0)
-                lenFound++;
-            tmp = (char *)mem_sys_allocate(1 + lenFound);
-            memcpy(tmp, lastCommandStart, lenFound);
-            *(tmp + lenFound) = 0;
-
-            /* Is it command or argument? */
-            if (cmd == NULL)
-            {
-                cmd   = tmp;
-                *argv = tmp;
-            }
-            else
-            {
-                /* Allocate space for another pointer in **argv. */
-                argc++;
-                argv = (const char **)mem_sys_realloc(argv, (argc + 1) * sizeof (int));
-                *(argv + (argc - 1)) = tmp;
-                *(argv + argc) = NULL;
-            }
-
-            /* Clear seek character. */
-            seekChar = 0;
-        }
-
-        /* Move to next character. */
-        curPos ++;
-    }
-
-    /* If we still have a seek char, then the input was improper. */
-    if (seekChar)
-        Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_NOSPAWN,
-            "Exec failed, invalid command string");
-
-    /* Now do the exec. */
-    status = _execvp(cmd, argv);
-    if (status)
-        Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_NOSPAWN,
-            "Exec failed, code %i", status);
-}
-
-/*
-
 =back
 
 =cut


More information about the parrot-commits mailing list