fix isblank warning

This commit is contained in:
Vítor Santos de Costa 2008-10-16 17:19:14 +01:00
parent 45e8b6fc8f
commit eeff5515b4

View File

@ -69,6 +69,9 @@
#if HAVE_ERRNO_H #if HAVE_ERRNO_H
#include <errno.h> #include <errno.h>
#endif #endif
#if HAVE_CTYPE_H
#include <ctype.h>
#endif
#if HAVE_STRING_H #if HAVE_STRING_H
#include <string.h> #include <string.h>
#endif #endif
@ -250,12 +253,26 @@ print_usage(void)
fprintf(stderr,"\n"); fprintf(stderr,"\n");
} }
static int
myisblank(int c)
{
switch (c) {
case ' ':
case '\t':
case '\n':
case '\r':
return TRUE;
default:
return FALSE;
}
}
static char * static char *
add_end_dot(char arg[]) add_end_dot(char arg[])
{ {
int sz = strlen(arg), i; int sz = strlen(arg), i;
i = sz; i = sz;
while (i && isblank(arg[--i])); while (i && myisblank(arg[--i]));
if (i && arg[i] != ',') { if (i && arg[i] != ',') {
char *p = (char *)malloc(sz+2); char *p = (char *)malloc(sz+2);
if (!p) if (!p)
@ -514,16 +531,20 @@ parse_yap_arguments(int argc, char *argv[], YAP_init_args *iap)
break; break;
#endif #endif
case 'L': case 'L':
if (p[1]) if (p[1] && p[1] >= '0' && p[1] <= '9') /* hack to emulate SWI's L local option */
goto stack_mode; goto stack_mode;
iap->QuietMode = TRUE; iap->QuietMode = TRUE;
iap->HaltAfterConsult = TRUE; iap->HaltAfterConsult = TRUE;
case 'l': case 'l':
p++; p++;
if (!*++argv) { if (!*++argv) {
fprintf(stderr, fprintf(stderr,"%% YAP unrecoverable error: missing load file name\n");
"%% YAP unrecoverable error: missing boot file name\n");
exit(1); exit(1);
} else if (!strcmp("--",*argv)) {
/* shell script, the next entry should be the file itself */
iap->YapPrologRCFile = argv[1];
argc = 1;
break;
} else { } else {
iap->YapPrologRCFile = *argv; iap->YapPrologRCFile = *argv;
argc--; argc--;
@ -608,6 +629,7 @@ parse_yap_arguments(int argc, char *argv[], YAP_init_args *iap)
/* End preprocessor code */ /* End preprocessor code */
case '-': case '-':
/* skip remaining arguments */ /* skip remaining arguments */
fprintf(stderr,"skipping remaining arguments\n");
argc = 1; argc = 1;
break; break;
default: default: