summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>1996-03-20 14:57:41 +0000
committerRoland McGrath <roland@redhat.com>1996-03-20 14:57:41 +0000
commit9e443adaf679b071fb3319cfc3259e322dcb6e57 (patch)
treea84a507d09be97fb0932bb661139921a59db71bd /main.c
parentdfefc77263fe835ae12b3ee27cc3ed9b084311c1 (diff)
downloadgunmake-9e443adaf679b071fb3319cfc3259e322dcb6e57.tar.gz
Tue Mar 19 20:21:34 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
Merged VMS port from Klaus Kaempf <kkaempf@didymus.rmi.de>. * make.h (PARAMS): New macro. * config.h-vms: New file. * makefile.com: New file. * makefile.vms: New file. * readme.vms: New file. * vmsdir.h: New file. * vmsfunctions.c: New file. * vmsify.c: New file. * file.h: Renamed to filedef.h to avoid conflict with VMS system hdr. * ar.c: Added prototypes and changes for VMS. * commands.c: Likewise. * commands.h: Likewise. * default.c: Likewise. * dep.h: Likewise. * dir.c: Likewise. * expand.c: Likewise. * file.c: Likewise. * function.c: Likewise. * implicit.c: Likewise. * job.c: Likewise. * job.h: Likewise. * main.c: Likewise. * make.h: Likewise. * misc.c: Likewise. * read.c: Likewise. * remake.c: Likewise. * remote-stub.c: Likewise. * rule.c: Likewise. * rule.h: Likewise. * variable.c: Likewise. * variable.h: Likewise. * vpath.c: Likewise. * compatMakefile (srcs): Rename file.h to filedef.h.
Diffstat (limited to 'main.c')
-rw-r--r--main.c49
1 files changed, 33 insertions, 16 deletions
diff --git a/main.c b/main.c
index a03397f..efbd70e 100644
--- a/main.c
+++ b/main.c
@@ -17,20 +17,23 @@ along with GNU Make; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "make.h"
-#include "commands.h"
#include "dep.h"
-#include "file.h"
+#include "filedef.h"
#include "variable.h"
#include "job.h"
+#include "commands.h"
#include "getopt.h"
#include <assert.h>
+extern void init_dir PARAMS ((void));
+extern RETSIGTYPE fatal_error_signal PARAMS ((int sig));
+extern RETSIGTYPE child_handler PARAMS ((int sig));
-extern void print_variable_data_base ();
-extern void print_dir_data_base ();
-extern void print_rule_data_base ();
-extern void print_file_data_base ();
-extern void print_vpath_data_base ();
+extern void print_variable_data_base PARAMS ((void));
+extern void print_dir_data_base PARAMS ((void));
+extern void print_rule_data_base PARAMS ((void));
+extern void print_file_data_base PARAMS ((void));
+extern void print_vpath_data_base PARAMS ((void));
#ifndef HAVE_UNISTD_H
extern int chdir ();
@@ -43,10 +46,12 @@ extern double atof ();
#endif
extern char *mktemp ();
-static void print_data_base (), print_version ();
-static void decode_switches (), decode_env_switches ();
-static void define_makeflags ();
-static char *quote_as_word ();
+static void print_data_base PARAMS((void));
+static void print_version PARAMS ((void));
+static void decode_switches PARAMS ((int argc, char **argv, int env));
+static void decode_env_switches PARAMS ((char *envar, unsigned int len));
+static void define_makeflags PARAMS ((int all, int makefile));
+static char *quote_as_word PARAMS ((char *out, char *in, int double_dollars));
/* The structure that describes an accepted command switch. */
@@ -415,7 +420,6 @@ main (argc, argv, envp)
char **argv;
char **envp;
{
- extern RETSIGTYPE fatal_error_signal (), child_handler ();
register struct file *f;
register unsigned int i;
char **p;
@@ -486,7 +490,11 @@ main (argc, argv, envp)
program = "make";
else
{
+#ifdef VMS
+ program = rindex (argv[0], ']');
+#else
program = rindex (argv[0], '/');
+#endif
#ifdef __MSDOS__
if (program == 0)
program = rindex (argv[0], '\\');
@@ -560,7 +568,7 @@ main (argc, argv, envp)
if (print_version_flag)
die (0);
-#ifndef __MSDOS__
+#if !defined(__MSDOS__) && !defined(VMS)
/* Set the "MAKE_COMMAND" variable to the name we were invoked with.
(If it is a relative pathname with a slash, prepend our directory name
so the result will run the same program regardless of the current dir.
@@ -699,7 +707,12 @@ main (argc, argv, envp)
/* Make a unique filename. */
#ifdef HAVE_MKTEMP
+
+#ifdef VMS
+ static char name[] = "sys$scratch:GmXXXXXX";
+#else
static char name[] = "/tmp/GmXXXXXX";
+#endif
(void) mktemp (name);
#else
static char name[L_tmpnam];
@@ -1101,15 +1114,15 @@ main (argc, argv, envp)
/* Nothing happened. */
case 0:
/* Updated successfully. */
- status = 0;
+ status = EXIT_SUCCESS;
break;
case 2:
/* Updating failed. */
- status = 2;
+ status = EXIT_FAILURE;
break;
case 1:
/* We are under -q and would run some commands. */
- status = 1;
+ status = EXIT_FAILURE;
break;
default:
abort ();
@@ -1589,7 +1602,11 @@ quote_as_word (out, in, double_dollars)
{
while (*in != '\0')
{
+#ifdef VMS
+ if (index ("^;'\"*?$<>(){}|&~`\\ \t\r\n\f\v", *in) != 0)
+#else
if (index ("^;'\"*?[]$<>(){}|&~`\\ \t\r\n\f\v", *in) != 0)
+#endif
*out++ = '\\';
if (double_dollars && *in == '$')
*out++ = '$';