/* The descrip member of this structure is only used to make debugging
* output pretty */
-static struct {int mode; int default_fd; char *descrip;} redir_table[] = {
+static const struct {int mode; int default_fd; const char *descrip;} redir_table[] = {
{ 0, 0, "()" },
{ O_RDONLY, 0, "<" },
{ O_CREAT|O_TRUNC|O_WRONLY, 1, ">" },
#define JOB_STATUS_FORMAT "[%d] %-22s %.40s\n"
struct built_in_command {
- char *cmd; /* name */
- char *descr; /* description */
+ const char *cmd; /* name */
+ const char *descr; /* description */
int (*function) (struct child_prog *); /* function ptr */
};
* in the parent shell process. If forked, of course they can not.
* For example, 'unset foo | whatever' will parse and run, but foo will
* still be set at the end. */
-static struct built_in_command bltins[] = {
+static const struct built_in_command bltins[] = {
{"bg", "Resume a job in the background", builtin_fg_bg},
{"break", "Exit for, while or until loop", builtin_not_written},
{"cd", "Change working directory", builtin_cd},
/* built-in 'help' handler */
static int builtin_help(struct child_prog *dummy)
{
- struct built_in_command *x;
+ const struct built_in_command *x;
printf("\nBuilt-in commands:\n");
printf("-------------------\n");
{
int i, rcode;
char *p;
- struct built_in_command *x;
+ const struct built_in_command *x;
if (child->argv) {
for (i=0; is_assignment(child->argv[i]); i++) {
debug_printf("pid %d environment modification: %s\n",getpid(),child->argv[i]);
int nextin, nextout;
int pipefds[2]; /* pipefds[0] is for reading */
struct child_prog *child;
- struct built_in_command *x;
+ const struct built_in_command *x;
char *p;
nextin = 0;
static int readc(void);
static void unget(int c);
static void ioecho(int c);
-static void prs(char *s);
+static void prs(const char *s);
static void prn(unsigned u);
static void closef(int i);
static void closeall(void);
struct here *h_next;
};
-static char *signame[] = {
+static const char * const signame[] = {
"Signal 0",
"Hangup",
(char *) NULL, /* interrupt */
#define NSIGNAL (sizeof(signame)/sizeof(signame[0]))
struct res {
- char *r_name;
+ const char *r_name;
int r_val;
};
-static struct res restab[] = {
+static const struct res restab[] = {
{"for", FOR},
{"case", CASE},
{"esac", ESAC},
static int dolc;
static int exstat;
static char gflg;
-static int interactive = 0; /* Is this an interactive shell */
+static int interactive; /* Is this an interactive shell */
static int execflg;
static int multiline; /* \n changed to ; */
static struct op *outtree; /* result from parser */
static int rlookup(n)
REGISTER char *n;
{
- REGISTER struct res *rp;
+ REGISTER const struct res *rp;
DBGPRINTF7(("RLOOKUP: enter, n is %s\n", n));
}
static void prs(s)
-REGISTER char *s;
+REGISTER const char *s;
{
if (*s)
write(2, s, strlen(s));