Changeset c4ba74d for perlglue.xs


Ignore:
Timestamp:
Aug 21, 2008, 12:52:04 AM (16 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, debian, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
38a7f22
Parents:
aef51f8
Message:
Make BarnOwl::command() accept a pre-tokenized command.

If given more than one argument, BarnOwl::command now treats the
arguments as an argv list to execute the command with. Previously it
only accepted a single argument, so this should not change the
behavior of any existing code.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • perlglue.xs

    racb13bb rc4ba74d  
    1717         *************************************************************
    1818         * These functions, when they are intended to be user-visible,
    19          * are document in perlwrap.pm. If you add functions to this
     19         * are documented in perlwrap.pm. If you add functions to this
    2020         * file, add the appropriate documentation there!
    2121         *
     
    3333
    3434char *
    35 command(cmd)
     35command(cmd, ...)
    3636        char *cmd
    3737        PREINIT:
    3838                char *rv = NULL;
    39         CODE:
    40                 rv = owl_function_command(cmd);
    41                 RETVAL = rv;   
     39                char **argv;
     40                int i;
     41        CODE:
     42        {
     43                if (items == 1) {
     44                        rv = owl_function_command(cmd);
     45                } else {
     46                        argv = owl_malloc((items + 1) * sizeof *argv);
     47                        argv[0] = cmd;
     48                        for(i = 1; i < items; i++) {
     49                                argv[i] = SvPV_nolen(ST(i));
     50                        }
     51                        rv = owl_function_command_argv(argv, items);
     52                        owl_free(argv);
     53                }
     54                RETVAL = rv;
     55        }
    4256        OUTPUT:
    4357                RETVAL
Note: See TracChangeset for help on using the changeset viewer.