mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-16 16:50:21 +02:00
1999-07-24 Gary Houston <ghouston@easynet.co.uk>
* gdbint.c (gdb_print, gdb_read): call scm_truncate_file. * ports.c (scm_truncate_file): renamed from scm_ftruncate. allow the 1st argument to be a fdes or filename as well as a port (as in the filesys.c version). * filesys.c (scm_truncate_file): removed.
This commit is contained in:
parent
eb9ef08b77
commit
69bc9ff335
7 changed files with 59 additions and 64 deletions
|
@ -513,37 +513,6 @@ scm_delete_file (str)
|
|||
return SCM_UNSPECIFIED;
|
||||
}
|
||||
|
||||
SCM_PROC (s_truncate_file, "truncate-file", 2, 0, 0, scm_truncate_file);
|
||||
SCM
|
||||
scm_truncate_file (SCM object, SCM size)
|
||||
{
|
||||
int rv;
|
||||
scm_sizet csize;
|
||||
int fdes;
|
||||
|
||||
object = SCM_COERCE_OUTPORT (object);
|
||||
|
||||
csize = (scm_sizet) scm_num2long (size, (char *) SCM_ARG2, s_truncate_file);
|
||||
if (SCM_INUMP (object) || (SCM_NIMP (object) && SCM_OPFPORTP (object)))
|
||||
{
|
||||
if (SCM_INUMP (object))
|
||||
fdes = SCM_INUM (object);
|
||||
else
|
||||
fdes = SCM_FPORT_FDES (object);
|
||||
SCM_SYSCALL (rv = ftruncate (fdes, csize));
|
||||
}
|
||||
else
|
||||
{
|
||||
SCM_ASSERT (SCM_NIMP (object) && SCM_ROSTRINGP (object),
|
||||
object, SCM_ARG1, s_chown);
|
||||
SCM_COERCE_SUBSTR (object);
|
||||
SCM_SYSCALL (rv = truncate (SCM_ROCHARS (object), csize));
|
||||
}
|
||||
if (rv == -1)
|
||||
scm_syserror (s_truncate_file);
|
||||
return SCM_UNSPECIFIED;
|
||||
}
|
||||
|
||||
SCM_PROC (s_mkdir, "mkdir", 1, 1, 0, scm_mkdir);
|
||||
|
||||
SCM
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue