Bash 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 1, or (at your option) any later
+Software Foundation; either version 2, or (at your option) any later
version.
Bash is distributed in the hope that it will be useful, but WITHOUT ANY
You should have received a copy of the GNU General Public License along
with Bash; see the file COPYING. If not, write to the Free Software
-Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#include <config.h>
#include <sys/file.h>
#endif
-#include "../posixstat.h"
-#include "../filecntl.h"
+#include "posixstat.h"
+#include "filecntl.h"
#include "../bashansi.h"
#include <stdio.h>
static int is_special_builtin ();
static int is_assignment_builtin ();
+#if !defined (HAVE_RENAME)
+static int rename ();
+#endif
+
void extract_info ();
void file_error ();
#if !defined (OLDCODE)
else if (strcmp (arg, "-nodocument") == 0)
no_long_document = 1;
-#endif /* !OLDCODE */
+#endif /* !OLDCODE */
else
{
fprintf (stderr, "%s: Unknown flag %s.\n", argv[0], arg);
{
write_longdocs (structfile, saved_builtins);
fclose (structfile);
- link (temp_struct_filename, struct_filename);
- unlink (temp_struct_filename);
+ rename (temp_struct_filename, struct_filename);
}
if (externfile)
if ((nr = read (fd, buffer, file_size)) < 0)
file_error (filename);
+ /* This is needed on WIN32, and does not hurt on Unix. */
+ if (nr < file_size)
+ file_size = nr;
+
close (fd);
if (nr == 0)
if (defs->builtins)
{
for (i = 0; builtin = (BUILTIN_DESC *)defs->builtins->array[i]; i++)
- {
+ {
free_builtin (builtin);
free (builtin);
- }
+ }
array_free (defs->builtins);
}
free (defs);
new = (BUILTIN_DESC *)xmalloc (sizeof (BUILTIN_DESC));
- new->name = savestring (builtin->name);
- new->shortdoc = savestring (builtin->shortdoc);
- new->longdoc = copy_string_array (builtin->longdoc);
+ new->name = savestring (builtin->name);
+ new->shortdoc = savestring (builtin->shortdoc);
+ new->longdoc = copy_string_array (builtin->longdoc);
new->dependencies = copy_string_array (builtin->dependencies);
new->function =
"",
" Bash 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 1, or (at your option)",
+ " the Free Software Foundation; either version 2, or (at your option)",
" any later version.",
"",
" Bash is distributed in the hope that it will be useful, but WITHOUT",
"",
" You should have received a copy of the GNU General Public License",
" along with Bash; see the file COPYING. If not, write to the Free",
- " Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */",
+ " Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */",
"",
"/* The list of shell builtins. Each element is name, function, flags,",
" long-doc, short-doc. The long-doc field contains a pointer to an array",
builtin->function);
fprintf (externfile, "extern char *%s_doc[];\n",
- builtin->docname ?builtin->docname : builtin->name);
+ builtin->docname ? builtin->docname : builtin->name);
}
/* Write the structure definition. */
{
return (_find_in_table (name, assignment_builtins));
}
+
+#if !defined (HAVE_RENAME)
+static int
+rename (from, to)
+ char *from, *to;
+{
+ unlink (to);
+ if (link (from, to) < 0)
+ return (-1);
+ unlink (from);
+ return (0);
+}
+#endif /* !HAVE_RENAME */