/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
#endif
#endif /* not lint */
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/bin/sh/options.c 296577 2016-03-09 21:00:57Z jilles $");
+__FBSDID("$FreeBSD: head/bin/sh/options.c 326025 2017-11-20 19:49:47Z pfg $");
#include <signal.h>
#include <unistd.h>
void
optschanged(void)
{
- setinteractive(iflag);
+ setinteractive();
#ifndef NO_HISTORY
histedit();
#endif
/*
* Process shell options. The global variable argptr contains a pointer
* to the argument list; we advance it past the options.
+ * If cmdline is true, process the shell's argv; otherwise, process arguments
+ * to the set special builtin.
*/
static void
while ((c = *p++) != '\0') {
if (c == 'c' && cmdline) {
char *q;
-#ifdef NOHACK /* removing this code allows sh -ce 'foo' for compat */
- if (*p == '\0')
-#endif
- q = *argptr++;
+
+ q = *argptr++;
if (q == NULL || minusc != NULL)
error("Bad -c option");
minusc = q;
-#ifdef NOHACK
- break;
-#endif
} else if (c == 'o') {
minus_o(*argptr, val);
if (*argptr)
/*
- * The set command builtin.
+ * The set builtin command.
*/
int
/*
* Standard option processing (a la getopt) for builtin routines. The
* only argument that is passed to nextopt is the option string; the
- * other arguments are unnecessary. It return the character, or '\0' on
+ * other arguments are unnecessary. It returns the option, or '\0' on
* end of input.
*/