aboutsummaryrefslogtreecommitdiffstats
path: root/posix.c
diff options
context:
space:
mode:
Diffstat (limited to 'posix.c')
-rw-r--r--posix.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/posix.c b/posix.c
index 1ed5f1c..cf3a0fa 100644
--- a/posix.c
+++ b/posix.c
@@ -1,18 +1,18 @@
/* Copyright (C) 1994, 1995, 1998 Free Software Foundation, Inc.
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111, USA.
*
* As a special exception, the Free Software Foundation gives permission
* for additional uses of the text contained in its release of GUILE.
@@ -36,7 +36,7 @@
*
* If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications.
- * If you do not wish that, delete this exception notice.
+ * If you do not wish that, delete this exception notice.
*/
/* "posix.c" functions only in Posix (unix).
@@ -101,15 +101,15 @@ SCM l_pipe()
close(fd[0]);
goto errout;
}
- SYSCALL(f_wt = fdopen(fd[1], "w"););
+ SCM_OPENCALL(f_wt = fdopen(fd[1], "w"));
if (!f_wt) {
fclose(f_rd);
errout:
close(fd[1]);
wta(UNDEFINED, (char *)NALLOC, s_port_type);
}
- CAR(p_rd) = tc16_fport | mode_bits("r");
- CAR(p_wt) = tc16_fport | mode_bits("w");
+ CAR(p_rd) = scm_port_entry(tc16_fport, mode_bits("r", (char *)0));
+ CAR(p_wt) = scm_port_entry(tc16_fport, mode_bits("w", (char *)0));
SETSTREAM(p_rd, f_rd);
SETSTREAM(p_wt, f_wt);
ALLOW_INTS;
@@ -128,22 +128,21 @@ SCM open_pipe(pipestr, modes)
/* DEFER_INTS, SYSCALL, and ALLOW_INTS are probably paranoid here*/
DEFER_INTS;
ignore_signals();
- SYSCALL(f = popen(CHARS(pipestr), CHARS(modes)););
+ SCM_OPENCALL(f = popen(CHARS(pipestr), CHARS(modes)));
unignore_signals();
- if (!f) z = BOOL_F;
+ if (!f) {
+ ALLOW_INTS;
+ return BOOL_F;
+ }
else {
- CAR(z) = tc16_pipe | OPN | (strchr(CHARS(modes), 'r') ? RDNG : WRTNG);
+ CAR(z) = scm_port_entry(tc16_pipe,
+ OPN | (strchr(CHARS(modes), 'r') ? RDNG : WRTNG));
SETSTREAM(z, f);
}
ALLOW_INTS;
+ SCM_PORTDATA(z) = pipestr;
return z;
}
-static int prinpipe(exp, port, writing)
- SCM exp; SCM port; int writing;
-{
- prinport(exp, port, s_pipe);
- return !0;
-}
static char scm_s_getgroups[] = "getgroups";
SCM scm_getgroups()
@@ -151,13 +150,14 @@ SCM scm_getgroups()
SCM grps, ans;
int ngroups = getgroups(0, 0);
if (!ngroups) return BOOL_F;
- NEWCELL(grps);
+ scm_protect_temp(&grps);
DEFER_INTS;
/* grps is used as a gc protect, its type used to be tc7_string, but
- strings are now checked for null termination during gc. */
- grps = must_malloc_cell(ngroups * sizeof(gid_t), scm_s_getgroups);
- /* length need not be exactly right */
- SETLENGTH(grps, (0L + ngroups * sizeof(gid_t))/sizeof(long), tc7_uvect);
+ strings are now checked for null termination during gc.
+ The length needs not be exactly right */
+ grps = must_malloc_cell((0L + ngroups) * sizeof(gid_t),
+ MAKE_LENGTH(((0L + ngroups) * sizeof(gid_t))/sizeof(long), tc7_uvect),
+ scm_s_getgroups);
ALLOW_INTS;
{
gid_t *groups = (gid_t *)CHARS(grps);
@@ -167,7 +167,7 @@ SCM scm_getgroups()
while (--ngroups >= 0) VELTS(ans)[ngroups] = MAKINUM(groups[ngroups]);
return ans;
}
-}
+}
/* These 2 routines are not protected against `entry' being reused
before access to that structure is completed */
@@ -396,9 +396,9 @@ void init_posix()
init_iprocs(subr2s, tc7_subr_2);
init_iprocs(subr3s, tc7_subr_3);
add_feature("posix");
+ ptobs[0x0ff & (tc16_pipe>>8)].name = s_pipe;
ptobs[0x0ff & (tc16_pipe>>8)].fclose = pclose;
ptobs[0x0ff & (tc16_pipe>>8)].free = pclose;
- ptobs[0x0ff & (tc16_pipe>>8)].print = prinpipe;
add_feature(s_pipe);
scm_ldstr("\n\
(define (open-input-pipe cmd) (open-pipe cmd \"r\"))\n\