1 /* yForth? - A Forth interpreter written in ANSI C
2 * Copyright (C) 2012 Luca Padovani
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 * ------------------------------------------------------------------------
17 * Module name: filee.c
18 * Abstract: File extension word set
29 /**************************************************************************/
30 /* VARIABLES **************************************************************/
31 /**************************************************************************/
33 extern Char file_name[];
35 /**************************************************************************/
36 /* WORDS ******************************************************************/
37 /**************************************************************************/
42 f = fopen(file_name, "rb");
51 register FILE *f = (FILE *) *sp;
52 if (fflush(f)) sp[0] = errno;
57 register Char *file_name2;
59 file_name2 = (Char *) malloc(strlen(file_name) + 1);
61 strcpy(file_name2, file_name);
63 if (rename(file_name, file_name2)) *--sp = errno;