diff options
| author | James LewisMoss <dres@debian.org> | 2000-03-12 09:04:17 -0500 | 
|---|---|---|
| committer | Bryan Newbold <bnewbold@robocracy.org> | 2017-02-20 00:05:26 -0800 | 
| commit | 8cfce36c6a4fc2e0a0ab6ef2db66a23cbe462693 (patch) | |
| tree | 17427e4f777ca85990a449fe939fbae29770b346 /ioext.c | |
| parent | a47af30d2f0e96afcd1f14b1984575c359faa3d6 (diff) | |
| parent | 3278b75942bdbe706f7a0fba87729bb1e935b68b (diff) | |
| download | scm-8cfce36c6a4fc2e0a0ab6ef2db66a23cbe462693.tar.gz scm-8cfce36c6a4fc2e0a0ab6ef2db66a23cbe462693.zip | |
Import Debian changes 5d2-3debian/5d2-3
scm (5d2-3) unstable frozen; urgency=low
  * Fix libncurses4-dev -> libncurses5-dev build depend (Closes: #58435)
  * Fix libreadline2-dev -> libreadline4-dev build depend.
  * Fix license location in copyright file (lintian warning)
  * Add tetex-bin as a build depend (needs makeinfo) (Closes: #53197)
  * Add -isp option to dpkg-gencontrol (lintian error)
  * Move scm to section interpreters.
scm (5d2-2) unstable; urgency=low
  * Apply patch from upstream for bug in eval.c. (Picked up from
    comp.lang.scheme)
  * Add Build-Depends on slib, librx1g-dev, libncurses4-dev, libreadlineg2-dev.
  * Up standards version.
  * Correct description: this is an R5RS implementation now
  * Make sure no optimizations are done on m68k. (Closes: #52434)
scm (5d2-1) unstable; urgency=low
  * New upstream.
scm (5d1-2) unstable; urgency=low
  * Remove TAGS on clean (cut the diff back down to reasonable size).
scm (5d1-1) unstable; urgency=low
  * New upstream.
  * move stuff to /usr/share.
scm (5d0-3) unstable; urgency=low
  * Change scmlit call to ./scmlit call (missed one) (Fixes bugs #37455
    and #35545)
  * Change man file permissions to 644 (fixes lintian warning)
scm (5d0-2) unstable; urgency=low
  * Removed call to add_final in init_crs.  lendwin doesn't do anything
    and scm was crashing when quit everytime in final_scm.
  * Changed copyright to reflect new source.
scm (5d0-1) unstable; urgency=low
  * New upstream.
  * Changed (terms) to access "/usr/doc/copyright/GPL".
  * Changed regex to use -lrx
scm (5c3-6) unstable; urgency=low
  * New maintainer.
Diffstat (limited to 'ioext.c')
| -rw-r--r-- | ioext.c | 92 | 
1 files changed, 64 insertions, 28 deletions
| @@ -1,18 +1,18 @@  /* Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1997 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.   */  /* "ioext.c" code for system calls in common between PC compilers and unix. @@ -53,7 +53,7 @@  #  include <stat.h>  # else  #  include <sys/stat.h> -#endif +# endif  # ifdef __TURBOC__  #  include <io.h> @@ -67,7 +67,7 @@ SCM	stat2scm P((struct stat *stat_temp));  #ifdef __sgi__  # include <unistd.h>  #endif -#ifdef freebsd +#ifdef __FreeBSD__  # include <unistd.h>  #endif  /* added by Denys Duchier */ @@ -78,6 +78,9 @@ SCM	stat2scm P((struct stat *stat_temp));  #ifdef linux  # include <unistd.h>  #endif +#ifdef GO32 +# include <unistd.h> +#endif  #ifndef STDC_HEADERS  	int chdir P((const char *path)); @@ -211,18 +214,27 @@ SCM reopen_file(filename, modes, port)       SCM filename, modes, port;  {    FILE *f; +  char cmodes[4]; +  long flags;    ASSERT(NIMP(filename) && STRINGP(filename), filename, ARG1, s_reopen_file);    ASSERT(NIMP(modes) && STRINGP(modes), modes, ARG2, s_reopen_file); +  flags =  mode_bits(CHARS(modes), cmodes);    DEFER_INTS;    ASSERT(NIMP(port) && FPORTP(port) && OPENP(port), port, ARG3, s_reopen_file); -  SYSCALL(f = freopen(CHARS(filename), CHARS(modes), STREAM(port));); -  if (!f) port = BOOL_F; +  SCM_OPENCALL(f = freopen(CHARS(filename), cmodes, STREAM(port))); +  if (!f) { +    ALLOW_INTS; +    return BOOL_F; +  }    else {      SETSTREAM(port, f); -    if (BUF0 & (CAR(port) = tc16_fport | mode_bits(CHARS(modes)))) +    SCM_PORTFLAGS(port) = flags; +    CAR(port) = scm_port_entry(tc16_fport, flags); +    if (BUF0 & flags)        i_setbuf0(port);    }    ALLOW_INTS; +  SCM_PORTDATA(port) = filename;    return port;  } @@ -232,22 +244,26 @@ static char s_dup[]="duplicate-port";  SCM l_dup(oldpt, modes)       SCM oldpt, modes;  { +  long flags; +  char cmodes[4];    int tfd;    FILE *f;    SCM newpt; -  ASSERT(NIMP(oldpt) && OPPORTP(oldpt), oldpt, ARG1, s_dup); +  ASSERT(NIMP(oldpt) && OPFPORTP(oldpt), oldpt, ARG1, s_dup);    ASSERT(NIMP(modes) && STRINGP(modes), modes, ARG2, s_dup); +  flags = mode_bits(CHARS(modes), cmodes);    NEWCELL(newpt);    DEFER_INTS; -  SYSCALL(tfd = dup(fileno(STREAM(oldpt)));); +  SCM_OPENCALL(tfd = dup(fileno(STREAM(oldpt))));    if (-1==tfd) {ALLOW_INTS;return BOOL_F;}; -  SYSCALL(f = fdopen(tfd, CHARS(modes));); +  SYSCALL(f = fdopen(tfd, cmodes););    if (!f) {      close(tfd);      wta(MAKINUM(tfd), (char *)NALLOC, s_port_type);    }    SETSTREAM(newpt, f); -  if (BUF0 & (CAR(newpt) = tc16_fport | mode_bits(CHARS(modes)))) +  CAR(newpt) = scm_port_entry(tc16_fport, flags); +  if (BUF0 & flags)      i_setbuf0(newpt);    ALLOW_INTS;    return newpt; @@ -258,11 +274,11 @@ SCM l_dup2(into_pt, from_pt)  {    int ans, oldfd, newfd;    DEFER_INTS; -  ASSERT(NIMP(into_pt) && OPPORTP(into_pt), into_pt, ARG1, s_dup2); -  ASSERT(NIMP(from_pt) && OPPORTP(from_pt), from_pt, ARG1, s_dup2); +  ASSERT(NIMP(into_pt) && OPFPORTP(into_pt), into_pt, ARG1, s_dup2); +  ASSERT(NIMP(from_pt) && OPFPORTP(from_pt), from_pt, ARG1, s_dup2);    oldfd = fileno(STREAM(into_pt));    newfd = fileno(STREAM(from_pt)); -  SYSCALL(ans = dup2(oldfd, newfd);); +  SCM_OPENCALL(ans = dup2(oldfd, newfd));    if (-1==ans) {ALLOW_INTS;return BOOL_F;};    ALLOW_INTS;    return into_pt; @@ -281,7 +297,7 @@ SCM l_opendir(dirname)    ASSERT(NIMP(dirname) && STRINGP(dirname), dirname, ARG1, s_opendir);    NEWCELL(dir);    DEFER_INTS; -  SYSCALL(ds = opendir(CHARS(dirname));); +  SCM_OPENCALL(ds = opendir(CHARS(dirname)));    if (!ds) {ALLOW_INTS; return BOOL_F;}    CAR(dir) = tc16_dir | OPN;    SETCDR(dir, ds); @@ -573,11 +589,10 @@ SCM l_getpid()  #ifndef __IBMC__  # ifndef macintosh  #  ifndef __WATCOMC__ -#   ifndef GO32 -#    ifndef _Windows -#     ifdef __TURBOC__ -#      include <process.h> -#     endif +#   ifndef _Windows +#    ifdef __TURBOC__ +#     include <process.h> +#    endif  char s_execv[] = "execv";  char s_execvp[] = "execvp";  SCM i_execv(modes, path, args) @@ -588,7 +603,7 @@ SCM i_execv(modes, path, args)    int i = ilength(args);    ASSERT(i>0, args, WNA, s_execv);    ASSERT(NIMP(path) && STRINGP(path), path, ARG1, s_execv); -  /*  dowinds(EOL, ilength(dynwinds)); */ +  /*  dowinds(EOL); */    args = cons(path, args);    DEFER_INTS;    execargv = makargvfrmstrs(args, s_execv); @@ -626,7 +641,6 @@ SCM l_putenv(str)    ASSERT(NIMP(str) && STRINGP(str), str, ARG1, s_putenv);    return putenv(CHARS(str)) ? BOOL_F : BOOL_T;  } -#    endif  #   endif  #  endif  # endif @@ -706,18 +720,40 @@ void init_ioext()  #ifndef __IBMC__  # ifndef macintosh  #  ifndef __WATCOMC__ -#   ifndef GO32 -#    ifndef _Windows +#   ifndef _Windows  	make_subr(s_execv, tc7_subr_2, lexecv);  	make_subr(s_execvp, tc7_subr_2, lexecvp);  	make_subr("execl", tc7_lsubr_2, lexec);  	make_subr("execlp", tc7_lsubr_2, lexecp);  	make_subr(s_putenv, tc7_subr_1, l_putenv); -#    endif  #   endif  #  endif  # endif  #endif  	add_feature("i/o-extensions");  	add_feature("line-i/o"); +	scm_ldstr("\n\ +(define (directory-for-each proc dirname . args)\n\ +  (define dir (opendir (if (symbol? dirname)\n\ +			   (symbol->string dirname)\n\ +			   dirname)))\n\ +  (if dir\n\ +      (let ((selector\n\ +	     (cond ((null? args) identity)\n\ +		   ((> (length args) 1)\n\ +		    (slib:error 'directory-for-each\n\ +				'too-many-arguments\n\ +				(cdr args)))\n\ +		   ((procedure? (car args)) (car args))\n\ +		   ((string? (car args))\n\ +		    (require 'glob)\n\ +		    (filename:match?? (car args)))\n\ +		   (else (slib:error 'directory-for-each\n\ +				     'unknown-selector-type\n\ +				     (car args))))))\n\ +	(do ((filename (readdir dir) (readdir dir)))\n\ +	    ((not filename) (closedir dir))\n\ +	  (and (selector filename) (proc filename))))))\n\ +"); +	add_feature("directory-for-each");  } | 
