Fix handling of questionmark handling in the bird light client. The
questionmark should display help when it is the last non-blank character on
command line. Otherwise the questionmark does not have any special meaning
and it could be a part of a pattern.
#include <sys/types.h>
#include <sys/ioctl.h>
#include <signal.h>
+#include <ctype.h>
#include "nest/bird.h"
#include "lib/resource.h"
}
+static int lastnb(char *str)
+{
+ int i;
+ for (i=strlen(str)-1; i>0; i--)
+ {
+ if(!isblank(str[i]))
+ return i;
+ }
+
+ return 0;
+}
+
static void
term_read(void)
{
printf("%s\n",buf);
}
- if (strchr(buf, '?'))
+ if (buf[lastnb(buf)] == '?')
{
printf("\n");
cmd_help(buf, strlen(buf));