#include <sys/file.h>
#endif
-#ifdef HAS_GETPGRP2
-# define getpgrp getpgrp2
-#endif
-
-#ifdef HAS_SETPGRP2
-# define setpgrp setpgrp2
-#endif
-
#if !defined(HAS_MKDIR) || !defined(HAS_RMDIR)
static int dooneliner _((char *cmd, char *filename));
#endif
{
OP *result;
ENTER;
- SAVEINT(rschar);
- SAVEINT(rslen);
SAVESPTR(last_in_gv); /* We don't want this to be permanent. */
last_in_gv = (GV*)*stack_sp--;
- rslen = 1;
-#ifdef DOSISH
- rschar = 0;
-#else
-#ifdef CSH
- rschar = 0;
-#else
- rschar = '\n';
+ SAVESPTR(rs); /* This is not permanent, either. */
+ rs = sv_2mortal(newSVpv("", 1));
+#ifndef DOSISH
+#ifndef CSH
+ *SvPVX(rs) = '\n';
#endif /* !CSH */
#endif /* !MSDOS */
+
result = do_readline();
LEAVE;
return result;
DIE(no_usym, "filehandle");
gv = (GV*)POPs;
tmps = SvPV(sv, len);
- if (do_open(gv, tmps, len,Nullfp)) {
+ if (do_open(gv, tmps, len, FALSE, 0, 0, Nullfp)) {
IoLINES(GvIOp(gv)) = 0;
PUSHi( (I32)forkprocess );
}
#ifdef DOSISH
#ifdef atarist
- if (!fflush(fp) && (fp->_flag |= _IOBIN))
+ if (!Fflush(fp) && (fp->_flag |= _IOBIN))
RETPUSHYES;
else
RETPUSHUNDEF;
PUTBACK;
if (op = pp_entersub())
- run();
+ runops();
SPAGAIN;
sv = TOPs;
RETSETYES;
}
+PP(pp_tied)
+{
+ dSP;
+ SV * sv ;
+ MAGIC * mg ;
+
+ sv = POPs;
+ if (SvMAGICAL(sv)) {
+ if (SvTYPE(sv) == SVt_PVHV || SvTYPE(sv) == SVt_PVAV)
+ mg = mg_find(sv, 'P') ;
+ else
+ mg = mg_find(sv, 'q') ;
+
+ if (mg) {
+ PUSHs(sv_2mortal(newSVsv(mg->mg_obj))) ;
+ RETURN ;
+ }
+ }
+
+ RETPUSHUNDEF;
+}
+
PP(pp_dbmopen)
{
dSP;
PUTBACK;
if (op = pp_entersub())
- run();
+ runops();
SPAGAIN;
if (!sv_isobject(TOPs)) {
PUTBACK;
if (op = pp_entersub())
- run();
+ runops();
SPAGAIN;
}
j = SvLEN(sv);
if (j < growsize) {
Sv_Grow(sv, growsize);
- s = SvPVX(sv) + j;
- while (++j <= growsize) {
- *s++ = '\0';
- }
}
+ j = SvCUR(sv);
+ s = SvPVX(sv) + j;
+ while (++j <= growsize) {
+ *s++ = '\0';
+ }
+
#if BYTEORDER != 0x1234 && BYTEORDER != 0x12345678
s = SvPVX(sv);
New(403, fd_sets[i], growsize, char);
SvCUR_set(formtarget, 0);
*SvEND(formtarget) = '\0';
if (IoFLAGS(io) & IOf_FLUSH)
- (void)fflush(fp);
+ (void)Fflush(fp);
PUSHs(&sv_yes);
}
}
goto just_say_no;
if (IoFLAGS(io) & IOf_FLUSH)
- if (fflush(fp) == EOF)
+ if (Fflush(fp) == EOF)
goto just_say_no;
}
SvREFCNT_dec(sv);
RETURN;
}
+PP(pp_sysopen)
+{
+ dSP;
+ GV *gv;
+ SV *sv;
+ char *tmps;
+ STRLEN len;
+ int mode, perm;
+
+ if (MAXARG > 3)
+ perm = POPi;
+ else
+ perm = 0666;
+ mode = POPi;
+ sv = POPs;
+ gv = (GV *)POPs;
+
+ tmps = SvPV(sv, len);
+ if (do_open(gv, tmps, len, TRUE, mode, perm, Nullfp)) {
+ IoLINES(GvIOp(gv)) = 0;
+ PUSHs(&sv_yes);
+ }
+ else {
+ PUSHs(&sv_undef);
+ }
+ RETURN;
+}
+
PP(pp_sysread)
{
dSP; dMARK; dORIGMARK; dTARGET;
dSP; dTARGET;
if (result < 0)
RETPUSHUNDEF;
- PUSHn( (basetime - statcache.st_mtime) / 86400.0 );
+ PUSHn( ((I32)basetime - (I32)statcache.st_mtime) / 86400.0 );
RETURN;
}
dSP; dTARGET;
if (result < 0)
RETPUSHUNDEF;
- PUSHn( (basetime - statcache.st_atime) / 86400.0 );
+ PUSHn( ((I32)basetime - (I32)statcache.st_atime) / 86400.0 );
RETURN;
}
dSP; dTARGET;
if (result < 0)
RETPUSHUNDEF;
- PUSHn( (basetime - statcache.st_ctime) / 86400.0 );
+ PUSHn( ((I32)basetime - (I32)statcache.st_ctime) / 86400.0 );
RETURN;
}
Signal_t (*ihand)(); /* place to save signal during system() */
Signal_t (*qhand)(); /* place to save signal during system() */
-#if defined(HAS_FORK) && !defined(VMS)
+#if defined(HAS_FORK) && !defined(VMS) && !defined(OS2)
if (SP - MARK == 1) {
if (tainting) {
char *junk = SvPV(TOPs, na);
value = (I32)do_exec(SvPVx(sv_mortalcopy(*SP), na));
}
_exit(-1);
-#else /* ! FORK or VMS */
+#else /* ! FORK or VMS or OS/2 */
if (op->op_flags & OPf_STACKED) {
SV *really = *++MARK;
value = (I32)do_aspawn(really, MARK, SP);
pid = 0;
else
pid = SvIVx(POPs);
-#ifdef USE_BSDPGRP
- value = (I32)getpgrp(pid);
+#ifdef BSD_GETPGRP
+ value = (I32)BSD_GETPGRP(pid);
#else
if (pid != 0)
DIE("POSIX getpgrp can't take an argument");
}
TAINT_PROPER("setpgrp");
-#ifdef USE_BSDPGRP
- SETi( setpgrp(pid, pgrp) >= 0 );
+#ifdef BSD_SETPGRP
+ SETi( BSD_SETPGRP(pid, pgrp) >= 0 );
#else
if ((pgrp != 0) || (pid != 0)) {
DIE("POSIX setpgrp can't take an argument");