From a09b33381ebf267690a6a2e22653b78408fa07b6 Mon Sep 17 00:00:00 2001 From: vsc Date: Sat, 15 Oct 2005 02:05:14 +0000 Subject: [PATCH] apply Takeuuchi's patch for -L git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1397 b08c6af1-5177-4d33-ba66-4b1c6b8b522a --- console/yap.c | 45 +++++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/console/yap.c b/console/yap.c index 4a1e33b50..b870f0cf0 100644 --- a/console/yap.c +++ b/console/yap.c @@ -392,24 +392,33 @@ parse_yap_arguments(int argc, char *argv[], YAP_init_args *iap) break; #endif case 'L': - p++; - while (*p != '\0' && (*p == ' ' || *p == '\t')) - p++; - /* skip zeroth argument */ - argc--; - if (argc == 0) { - fprintf(stderr," [ YAP unrecoverable error: missing file name with option 'l' ]\n"); - exit(1); - } - argv++; - if (p[0] == '-' && p[1] == '-'&& p[2] == '\0') { - /* we're done here */ - argc = 1; - } - iap->YapPrologRCFile = *argv; - argv++; - iap->HaltAfterConsult = TRUE; - break; + p++; + iap->HaltAfterConsult = TRUE; + if (*p != '\0') { + iap->YapPrologRCFile = p; + break; + } else { + if (--argc == 0) { + fprintf(stderr, + " [ YAP unrecoverable error: missing file name with option 'L' ]\n"); + exit(1); + } + p = *++argv; + if (p[0] == '-' && p[1] == '-' && p[2] == '\0') { + if (--argc == 0) { + fprintf(stderr, + " [ YAP unrecoverable error: missing filename with option 'L' ]\n"); + exit(1); + } + p = *++argv; + iap->YapPrologRCFile = p; + argc = 1; + + } else { + iap->YapPrologRCFile = p; + } + } + break; case 'l': if ((*argv)[0] == '\0') iap->YapPrologRCFile = *argv;