home *** CD-ROM | disk | FTP | other *** search
- #include "EXTERN.h"
- #include "perl.h"
-
- int link()
- {
- if (dowarn)
- warn("MacPerl: link always fails");
-
- return -1;
- }
-
- unsigned short umask(unsigned short arg)
- {
- if (dowarn && arg)
- warn("MacPerl: nonzero argument to umask() ignored");
-
- return 0;
- }
-
- static void
- setup_argstr(SV *really, SV **mark, SV **sp, char **argstr)
- {
- char *tmps, *junk;
- register size_t cmdlen = 0;
- size_t rlen;
- register SV **idx;
-
- idx = mark;
- if (really && *(tmps = SvPV(really,rlen))) {
- cmdlen += rlen + 1;
- idx++;
- }
-
- for (idx++; idx <= sp; idx++) {
- if (*idx) {
- junk = SvPVx(*idx,rlen);
- cmdlen += rlen ? rlen + 1 : 0;
- }
- }
- New(401,*argstr,cmdlen, char);
-
- if (*tmps) {
- strcpy(*argstr,tmps);
- mark++;
- }
- else **argstr = '\0';
- while (++mark <= sp) {
- if (*mark) {
- strcat(*argstr," ");
- strcat(*argstr,SvPVx(*mark,na));
- }
- }
-
- } /* end of setup_argstr() */
-
- int do_spawn(char * command)
- {
- int ch;
- FILE * temp = my_popen(command, "r");
-
- while ((ch = getc(temp)) != EOF)
- putc(ch, stdout);
-
- my_pclose(temp);
- }
-
- int do_aspawn(SV *really,SV **mark,SV **sp)
- {
- if (sp > mark) {
- setup_argstr(really,mark,sp,&Cmd);
- return do_spawn(Cmd);
- }
-
- return -1;
- } /* end of do_aspawn() */
-