2017-12-03 12:56:21 +00:00
|
|
|
/* -*-comment-start: "//";comment-end:""-*-
|
2018-07-22 12:24:36 +00:00
|
|
|
* GNU Mes --- Maxwell Equations of Software
|
2018-06-03 16:54:26 +00:00
|
|
|
* Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
2017-12-03 12:56:21 +00:00
|
|
|
*
|
2018-07-22 12:24:36 +00:00
|
|
|
* This file is part of GNU Mes.
|
2017-12-03 12:56:21 +00:00
|
|
|
*
|
2018-07-22 12:24:36 +00:00
|
|
|
* GNU Mes is free software; you can redistribute it and/or modify it
|
2017-12-03 12:56:21 +00:00
|
|
|
* under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or (at
|
|
|
|
* your option) any later version.
|
|
|
|
*
|
2018-07-22 12:24:36 +00:00
|
|
|
* GNU Mes is distributed in the hope that it will be useful, but
|
2017-12-03 12:56:21 +00:00
|
|
|
* 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
|
2018-07-22 12:24:36 +00:00
|
|
|
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
2017-12-03 12:56:21 +00:00
|
|
|
*/
|
|
|
|
|
2018-08-26 22:34:13 +00:00
|
|
|
#include <time.h>
|
|
|
|
|
2017-12-03 12:56:21 +00:00
|
|
|
int
|
2018-06-03 16:54:26 +00:00
|
|
|
close (int filedes)
|
2017-12-03 12:56:21 +00:00
|
|
|
{
|
2018-06-16 18:51:16 +00:00
|
|
|
if (_ungetc_fd == filedes)
|
|
|
|
{
|
|
|
|
_ungetc_pos = -1;
|
|
|
|
_ungetc_fd = -1;
|
|
|
|
}
|
2018-08-15 16:26:55 +00:00
|
|
|
return _sys_call1 (SYS_close, (int)filedes);
|
2018-06-03 16:54:26 +00:00
|
|
|
}
|
2017-12-03 12:56:21 +00:00
|
|
|
|
2018-06-03 16:54:26 +00:00
|
|
|
off_t
|
|
|
|
lseek (int filedes, off_t offset, int whence)
|
|
|
|
{
|
2018-08-15 16:26:55 +00:00
|
|
|
return _sys_call3 (SYS_lseek, (int)filedes, (long)offset, (int)whence);
|
2017-12-03 12:56:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
unlink (char const *file_name)
|
|
|
|
{
|
2018-08-11 09:42:30 +00:00
|
|
|
return _sys_call1 (SYS_unlink, (long)file_name);
|
2017-12-03 12:56:21 +00:00
|
|
|
}
|
|
|
|
|
2018-05-30 19:55:39 +00:00
|
|
|
int
|
|
|
|
rmdir (char const *file_name)
|
|
|
|
{
|
2018-08-11 09:42:30 +00:00
|
|
|
return _sys_call1 (SYS_rmdir, (long)file_name);
|
2018-05-30 19:55:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
stat (char const *file_name, struct stat *statbuf)
|
|
|
|
{
|
2018-08-11 09:42:30 +00:00
|
|
|
return _sys_call2 (SYS_stat, (long)file_name, (long)statbuf);
|
2017-12-03 12:56:21 +00:00
|
|
|
}
|