diff --git a/cv3/program.c b/cv3/program.c index 799a97b..7fdb5d3 100644 --- a/cv3/program.c +++ b/cv3/program.c @@ -81,11 +81,15 @@ int main(int argc, char const *argv[]) { break; } - if(isalpha(buf) != 0) + for (int i = 0; i < strcspn(buf, "\n"); i++) { - printf("bad input\n"); - return 0; + if(isalpha(buf[i]) != 0) + { + printf("bad input\n"); + return 0; + } } + buf[strcspn(buf, "\n")] = '\0'; if(!check_op(buf[0])) {