OSDN Git Service

Replace inclusion of <stdio.h> with "system.h"
[pf3gnuchains/gcc-fork.git] / gcc / protoize.c
index b508a5d..7a58df2 100644 (file)
@@ -1,5 +1,6 @@
 /* Protoize program - Original version by Ron Guilmette (rfg@segfault.us.com).
-   Copyright (C) 1989, 92-99, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+   1999, 2000 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -28,6 +29,7 @@ Boston, MA 02111-1307, USA.  */
 #include <unistd.h>
 #endif
 #undef abort
+#include "version.h"
 
 /* Include getopt.h for the sake of getopt_long. */
 #include "getopt.h"
@@ -46,6 +48,20 @@ Boston, MA 02111-1307, USA.  */
 #define IS_SAME_PATH(a,b) (strcmp (a, b) == 0)
 #endif
 
+/* Suffix for aux-info files.  */
+#ifdef __MSDOS__
+#define AUX_INFO_SUFFIX "X"
+#else
+#define AUX_INFO_SUFFIX ".X"
+#endif
+
+/* Suffix for saved files.  */
+#ifdef __MSDOS__
+#define SAVE_SUFFIX "sav"
+#else
+#define SAVE_SUFFIX ".save"
+#endif
+
 /* Suffix for renamed C++ files.  */
 #ifdef HAVE_DOS_BASED_FILE_SYSTEM
 #define CPLUS_FILE_SUFFIX "cc"
@@ -53,8 +69,6 @@ Boston, MA 02111-1307, USA.  */
 #define CPLUS_FILE_SUFFIX "C"
 #endif
 
-extern char *version_string;
-
 static void usage PARAMS ((void)) ATTRIBUTE_NORETURN;
 static void aux_info_corrupted PARAMS ((void)) ATTRIBUTE_NORETURN;
 static void declare_source_confusing PARAMS ((const char *)) ATTRIBUTE_NORETURN;
@@ -118,11 +132,11 @@ static const char * const target_version = DEFAULT_TARGET_VERSION;
 
 /* Suffix of aux_info files.  */
 
-static const char * const aux_info_suffix = ".X";
+static const char * const aux_info_suffix = AUX_INFO_SUFFIX;
 
 /* String to attach to filenames for saved versions of original files.  */
 
-static const char * const save_suffix = ".save";
+static const char * const save_suffix = SAVE_SUFFIX;
 
 /* String to attach to C filenames renamed to C++.  */
 
@@ -178,7 +192,7 @@ static const unexpansion unexpansions[] = {
 static const int hash_mask = (HASH_TABLE_SIZE - 1);
 
 /* Make a table of default system include directories
-   just as it is done in cccp.c.  */
+   just as it is done in cpp.  */
 
 #ifndef STANDARD_INCLUDE_DIR
 #define STANDARD_INCLUDE_DIR "/usr/include"
@@ -1984,8 +1998,8 @@ munge_compile_params (params_list)
 
   temp_params[param_count++] = "-S";
   temp_params[param_count++] = "-o";
-#if defined (__MSDOS__) || (defined (_WIN32) && ! defined (__CYGWIN__) && ! defined (_UWIN))
-  temp_params[param_count++] = "NUL:";
+#if defined (_WIN32) && ! defined (__CYGWIN__) && ! defined (_UWIN)
+  temp_params[param_count++] = "NUL";
 #else
   temp_params[param_count++] = "/dev/null";
 #endif
@@ -2019,7 +2033,7 @@ gen_aux_info_file (base_filename)
   compile_params[input_file_name_index] = shortpath (NULL, base_filename);
   /* Add .X to source file name to get aux-info file name.  */
   compile_params[aux_info_file_name_index] =
-    concat (compile_params[input_file_name_index], ".X", NULL);
+    concat (compile_params[input_file_name_index], aux_info_suffix, NULL);
   
   if (!quiet_flag)
     notice ("%s: compiling `%s'\n",
@@ -4317,6 +4331,11 @@ edit_file (hp)
        = (char *) xmalloc (strlen (convert_filename) + strlen (save_suffix) + 2);
   
       strcpy (new_filename, convert_filename);
+#ifdef __MSDOS__
+      /* MSDOS filenames are restricted to 8.3 format, so we save `foo.c'
+         as `foo.<save_suffix>'.  */
+      new_filename[(strlen (convert_filename) - 1] = '\0';
+#endif
       strcat (new_filename, save_suffix);
 
       /* Don't overwrite existing file.  */