Modify the DoParseCommand() to work on (const char *) instead of just
(char *). This is a slightly simplified version of the patch in the PR. It fixes compilitation issues with -O3. PR: misc/124385
This commit is contained in:
parent
aa219554e0
commit
48b5fd636e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=180076
@ -69,7 +69,7 @@
|
|||||||
/* Internal functions */
|
/* Internal functions */
|
||||||
static int ReadFile(FILE *fp);
|
static int ReadFile(FILE *fp);
|
||||||
static void ReadSockets(fd_set *);
|
static void ReadSockets(fd_set *);
|
||||||
static int DoParseCommand(char *line);
|
static int DoParseCommand(const char *line);
|
||||||
static int DoCommand(int ac, char **av);
|
static int DoCommand(int ac, char **av);
|
||||||
static int DoInteractive(void);
|
static int DoInteractive(void);
|
||||||
static const struct ngcmd *FindCommand(const char *string);
|
static const struct ngcmd *FindCommand(const char *string);
|
||||||
@ -322,7 +322,7 @@ DoInteractive(void)
|
|||||||
history(hist, &hev, H_ENTER, buf);
|
history(hist, &hev, H_ENTER, buf);
|
||||||
pthread_kill(monitor, SIGUSR1);
|
pthread_kill(monitor, SIGUSR1);
|
||||||
pthread_mutex_lock(&mutex);
|
pthread_mutex_lock(&mutex);
|
||||||
if (DoParseCommand((char *)buf) == CMDRTN_QUIT)
|
if (DoParseCommand(buf) == CMDRTN_QUIT)
|
||||||
break;
|
break;
|
||||||
pthread_cond_signal(&cond);
|
pthread_cond_signal(&cond);
|
||||||
pthread_mutex_unlock(&mutex);
|
pthread_mutex_unlock(&mutex);
|
||||||
@ -423,13 +423,13 @@ ReadSockets(fd_set *rfds)
|
|||||||
* Parse a command line and execute the command
|
* Parse a command line and execute the command
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
DoParseCommand(char *line)
|
DoParseCommand(const char *line)
|
||||||
{
|
{
|
||||||
char *av[MAX_ARGS];
|
char *av[MAX_ARGS];
|
||||||
int ac;
|
int ac;
|
||||||
|
|
||||||
/* Parse line */
|
/* Parse line */
|
||||||
for (ac = 0, av[0] = strtok(line, WHITESPACE);
|
for (ac = 0, av[0] = strtok((char *)line, WHITESPACE);
|
||||||
ac < MAX_ARGS - 1 && av[ac];
|
ac < MAX_ARGS - 1 && av[ac];
|
||||||
av[++ac] = strtok(NULL, WHITESPACE));
|
av[++ac] = strtok(NULL, WHITESPACE));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user