summaryrefslogtreecommitdiffstats
path: root/posix.c
diff options
context:
space:
mode:
authorSteve Langasek <vorlon@debian.org>2004-12-07 23:23:48 -0800
committerBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:28 -0800
commit37f2f5e0bb11a18deecf48c7ad6bcbf7bd932db2 (patch)
tree692caebb60ec5f80ce528a403b69351ca756d530 /posix.c
parente21d47d7813159bb71e0671df9b52ec0470c358d (diff)
parentc7d035ae1a729232579a0fe41ed5affa131d3623 (diff)
downloadscm-37f2f5e0bb11a18deecf48c7ad6bcbf7bd932db2.tar.gz
scm-37f2f5e0bb11a18deecf48c7ad6bcbf7bd932db2.zip
Import Debian changes 5d9-4.1debian/5d9-4.1
scm (5d9-4.1) unstable; urgency=high * Non-maintainer upload. * High-urgency upload for sarge-targetted RC bugfix. * Revert upstream "CAUTIOUS" define, which causes the scm build to fail its test suite on alpha (and, it appears, powerpc as well). Closes: #245810. scm (5d9-4) unstable; urgency=low * Apply patch from 144062 to fix hppa build (Closes: #144062) * Change scm.1 section from Jan 4 200 to 1. (lintian) scm (5d9-3) unstable; urgency=low * Properly clean up info files. * Make and install Xlibscm.info. scm (5d9-2) unstable; urgency=low * Fix path problem in slibcat. Hack at mklibcat.scm. (Closes: #241510) scm (5d9-1) unstable; urgency=low * New upstream release * Merge NMU sparc changes (Closes: #191171, #191356) * SHORT_INT is defined for ia64 upstream (Closes: #141928) * Scheme imps now grouped in info file (has been for a while) (Closes: #115452)
Diffstat (limited to 'posix.c')
-rw-r--r--posix.c67
1 files changed, 33 insertions, 34 deletions
diff --git a/posix.c b/posix.c
index 8af5c0b..229384a 100644
--- a/posix.c
+++ b/posix.c
@@ -57,14 +57,15 @@
#else /* added by Denys Duchier */
# ifdef SVR4
# include <unistd.h>
-# else
-# ifdef linux
-# include <unistd.h>
-# else
-# ifdef __OpenBSD__
-# include <unistd.h>
-# endif
-# endif
+# endif
+# ifdef linux
+# include <unistd.h>
+# endif
+# ifdef __OpenBSD__
+# include <unistd.h>
+# endif
+# ifdef __NetBSD__
+# include <unistd.h>
# endif
#endif
@@ -73,9 +74,9 @@ SCM l_chown(path, owner, group)
SCM path, owner, group;
{
int val;
- ASSERT(NIMP(path) && STRINGP(path), path, ARG1, s_chown);
- ASSERT(INUMP(owner), owner, ARG2, s_chown);
- ASSERT(INUMP(group), group, ARG3, s_chown);
+ ASRTER(NIMP(path) && STRINGP(path), path, ARG1, s_chown);
+ ASRTER(INUMP(owner), owner, ARG2, s_chown);
+ ASRTER(INUMP(group), group, ARG3, s_chown);
SYSCALL(val = chown(CHARS(path), INUM(owner), INUM(group)););
return val ? BOOL_F : BOOL_T;
}
@@ -85,8 +86,8 @@ SCM l_link(oldpath, newpath)
SCM oldpath, newpath;
{
int val;
- ASSERT(NIMP(oldpath) && STRINGP(oldpath), oldpath, ARG1, s_link);
- ASSERT(NIMP(newpath) && STRINGP(newpath), newpath, ARG2, s_link);
+ ASRTER(NIMP(oldpath) && STRINGP(oldpath), oldpath, ARG1, s_link);
+ ASRTER(NIMP(newpath) && STRINGP(newpath), newpath, ARG2, s_link);
SYSCALL(val = link(CHARS(oldpath), CHARS(newpath)););
return val ? BOOL_F : BOOL_T;
}
@@ -124,8 +125,8 @@ SCM open_pipe(pipestr, modes)
{
FILE *f;
register SCM z;
- ASSERT(NIMP(pipestr) && STRINGP(pipestr), pipestr, ARG1, s_op_pipe);
- ASSERT(NIMP(modes) && (STRINGP(modes) || SYMBOLP(modes)), modes, ARG2, s_op_pipe);
+ ASRTER(NIMP(pipestr) && STRINGP(pipestr), pipestr, ARG1, s_op_pipe);
+ ASRTER(NIMP(modes) && (STRINGP(modes) || SYMBOLP(modes)), modes, ARG2, s_op_pipe);
NEWCELL(z);
/* DEFER_INTS, SYSCALL, and ALLOW_INTS are probably paranoid here*/
DEFER_INTS;
@@ -180,7 +181,7 @@ SCM l_pwinfo(user)
if UNBNDP(user) SYSCALL(entry = getpwent(););
else if INUMP(user) SYSCALL(entry = getpwuid(INUM(user)););
else {
- ASSERT(NIMP(user) && STRINGP(user), user, ARG1, s_pwinfo);
+ ASRTER(NIMP(user) && STRINGP(user), user, ARG1, s_pwinfo);
SYSCALL(entry = getpwnam(CHARS(user)););
}
ALLOW_INTS;
@@ -206,7 +207,7 @@ SCM l_grinfo(name)
if UNBNDP(name) SYSCALL(entry = getgrent(););
else if INUMP(name) SYSCALL(entry = getgrgid(INUM(name)););
else {
- ASSERT(NIMP(name) && STRINGP(name), name, ARG1, s_grinfo);
+ ASRTER(NIMP(name) && STRINGP(name), name, ARG1, s_grinfo);
SYSCALL(entry = getgrnam(CHARS(name)););
}
ALLOW_INTS;
@@ -237,8 +238,8 @@ SCM l_kill(pid, sig)
SCM pid, sig;
{
int i;
- ASSERT(INUMP(pid), pid, ARG1, s_kill);
- ASSERT(INUMP(sig), sig, ARG2, s_kill);
+ ASRTER(INUMP(pid), pid, ARG1, s_kill);
+ ASRTER(INUMP(sig), sig, ARG2, s_kill);
SYSCALL(i = kill((int)INUM(pid), (int)INUM(sig)););
return MAKINUM(0L+i);
}
@@ -247,8 +248,8 @@ SCM l_waitpid(pid, options)
SCM pid, options;
{
int i, status;
- ASSERT(INUMP(pid), pid, ARG1, s_waitpid);
- ASSERT(INUMP(options), options, ARG2, s_waitpid);
+ ASRTER(INUMP(pid), pid, ARG1, s_waitpid);
+ ASRTER(INUMP(options), options, ARG2, s_waitpid);
SYSCALL(i = waitpid(INUM(pid), &status, INUM(options)););
return i < 0 ? BOOL_F : MAKINUM(0L+status);
}
@@ -258,10 +259,6 @@ SCM l_getppid()
return MAKINUM(0L+getppid());
}
-SCM scm_getlogin()
-{
- return makfrom0str(getlogin());
-}
SCM l_getuid()
{
return MAKINUM(0L+getuid());
@@ -285,14 +282,14 @@ static char s_setuid[] = "setuid";
SCM l_setuid(id)
SCM id;
{
- ASSERT(INUMP(id), id, ARG1, s_setuid);
+ ASRTER(INUMP(id), id, ARG1, s_setuid);
return setuid(INUM(id)) ? BOOL_F : BOOL_T;
}
static char s_setgid[] = "setgid";
SCM l_setgid(id)
SCM id;
{
- ASSERT(INUMP(id), id, ARG1, s_setgid);
+ ASRTER(INUMP(id), id, ARG1, s_setgid);
return setgid(INUM(id)) ? BOOL_F : BOOL_T;
}
@@ -301,14 +298,14 @@ static char s_seteuid[] = "seteuid";
SCM l_seteuid(id)
SCM id;
{
- ASSERT(INUMP(id), id, ARG1, s_seteuid);
+ ASRTER(INUMP(id), id, ARG1, s_seteuid);
return seteuid(INUM(id)) ? BOOL_F : BOOL_T;
}
static char s_setegid[] = "setegid";
SCM l_setegid(id)
SCM id;
{
- ASSERT(INUMP(id), id, ARG1, s_setegid);
+ ASRTER(INUMP(id), id, ARG1, s_setegid);
return setegid(INUM(id)) ? BOOL_F : BOOL_T;
}
#endif
@@ -318,7 +315,7 @@ SCM l_ttyname(port)
SCM port;
{
char *ans;
- ASSERT(NIMP(port) && OPPORTP(port), port, ARG1, s_ttyname);
+ ASRTER(NIMP(port) && OPPORTP(port), port, ARG1, s_ttyname);
if (tc16_fport != TYP16(port)) return BOOL_F;
SYSCALL(ans = ttyname(fileno(STREAM(port))););
/* ans could be overwritten by another call to ttyname */
@@ -351,7 +348,6 @@ static iproc subr0s[] = {
{"pipe", l_pipe},
{scm_s_getgroups, scm_getgroups},
{"getppid", l_getppid},
- {"getlogin", scm_getlogin},
{"getuid", l_getuid},
{"getgid", l_getgid},
#ifndef LACK_E_IDs
@@ -405,8 +401,11 @@ void init_posix()
scm_ldstr("\n\
(define (open-input-pipe cmd) (open-pipe cmd \"r\"))\n\
(define (open-output-pipe cmd) (open-pipe cmd \"w\"))\n\
-(define getlogin\n\
- (let ((getlogin getlogin))\n\
- (lambda () (or (getlogin) (getenv \"USER\") (getenv \"LOGNAME\")))))\n\
+(define (system->line command . tmp)\n\
+ (define line\n\
+ (call-with-open-ports\n\
+ read-line\n\
+ (open-input-pipe command)))\n\
+ (if (eof-object? line) \"\" line))\n\
");
}