this patch include,
add logic for invalid char in notificationprovider example only.
sometimes, input variable has an incorrect value.
Change-Id: Id8fa6152a7a7f15ef5d54425daf896680d6c9447
Signed-off-by: jaesick.shin <jaesick.shin@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/12979
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
#include <stdbool.h>
#include <stdlib.h>
#include <unistd.h>
+#include <ctype.h>
#include "NSProviderInterface.h"
#include "NSCommon.h"
printf("input : ");
- if(scanf("%d", &num) > 0)
+ if(scanf("%d", &num) > 0 && isdigit(num) == 0)
{
- fflush(stdin);
if(scanf("%c", &dummy) > 0)
{
fflush(stdin);
printf("\n");
}
}
+ else
+ {
+ printf("invalid input \n");
+ num = 0;
+ }
switch (num)
{