From 6a1de54fc3ff3e21e3c3b49aa1d59060f5ce2361 Mon Sep 17 00:00:00 2001 From: harti Date: Tue, 30 Nov 2004 15:35:51 +0000 Subject: Constify the array of predefined shells. It turns out that we need two versions of the structure definition for this: one with const char pointers, because otherwise gcc won't let us initialize the fields with constant strings, and one without the const, because we need to work with the structure. --- usr.bin/make/job.h | 51 +++++++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 24 deletions(-) (limited to 'usr.bin/make/job.h') diff --git a/usr.bin/make/job.h b/usr.bin/make/job.h index 25aa511..fbcd56e 100644 --- a/usr.bin/make/job.h +++ b/usr.bin/make/job.h @@ -175,30 +175,33 @@ typedef struct Job { * strings is empty when hasErrCtl is FALSE, the command will be executed * anyway as is and if it causes an error, so be it. */ -typedef struct Shell { - char *name; /* the name of the shell. For Bourne and C - * shells, this is used only to find the - * shell description when used as the single - * source of a .SHELL target. For user-defined - * shells, this is the full path of the shell. - */ - Boolean hasEchoCtl; /* True if both echoOff and echoOn defined */ - char *echoOff; /* command to turn off echo */ - char *echoOn; /* command to turn it back on again */ - char *noPrint; /* command to skip when printing output from - * shell. This is usually the command which - * was executed to turn off echoing */ - int noPLen; /* length of noPrint command */ - Boolean hasErrCtl; /* set if can control error checking for - * individual commands */ - char *errCheck; /* string to turn error checking on */ - char *ignErr; /* string to turn off error checking */ - /* - * command-line flags - */ - char *echo; /* echo commands */ - char *exit; /* exit on error */ -} Shell; +#define DEF_SHELL_STRUCT(TAG, CONST) \ +struct TAG { \ + CONST char *name; /* the name of the shell. For Bourne and C \ + * shells, this is used only to find the \ + * shell description when used as the single \ + * source of a .SHELL target. For user-defined \ + * shells, this is the full path of the shell. \ + */ \ + Boolean hasEchoCtl; /* True if both echoOff and echoOn defined */ \ + CONST char *echoOff; /* command to turn off echo */ \ + CONST char *echoOn; /* command to turn it back on again */ \ + CONST char *noPrint; /* command to skip when printing output from \ + * shell. This is usually the command which \ + * was executed to turn off echoing */ \ + int noPLen; /* length of noPrint command */ \ + Boolean hasErrCtl; /* set if can control error checking for \ + * individual commands */ \ + CONST char *errCheck; /* string to turn error checking on */ \ + CONST char *ignErr; /* string to turn off error checking */ \ + /* \ + * command-line flags \ + */ \ + CONST char *echo; /* echo commands */ \ + CONST char *exit; /* exit on error */ \ +} + +typedef DEF_SHELL_STRUCT(Shell,) Shell; extern char *shellPath; extern char *shellName; -- cgit v1.1