From: Eric Pouech Date: Tue, 15 Mar 2011 21:26:55 +0000 (+0100) Subject: winedbg: Display a valid source file when reporting an error about a missing source... X-Git-Tag: wine-1.3.16~113 X-Git-Url: http://git.etersoft.ru/projects/?a=commitdiff_plain;h=1adbe826012f13cf0208a384adecb9afd41ed22f;p=wine%2Feterwine.git winedbg: Display a valid source file when reporting an error about a missing source file. --- diff --git a/programs/winedbg/source.c b/programs/winedbg/source.c index e341d48289..e5648158a7 100644 --- a/programs/winedbg/source.c +++ b/programs/winedbg/source.c @@ -199,31 +199,39 @@ static int source_display(const char* sourcefile, int start, int end) if (dbg_interactiveP) { char zbuf[256]; - /* - * Still couldn't find it. Ask user for path to add. - */ - snprintf(zbuf, sizeof(zbuf), "Enter path to file '%s': ", sourcefile); - input_read_line(zbuf, tmppath, sizeof(tmppath)); - if (tmppath[strlen(tmppath) - 1] != '/') + for (;;) { - strcat(tmppath, "/"); + size_t len; + /* + * Still couldn't find it. Ask user for path to add. + */ + snprintf(zbuf, sizeof(zbuf), "Enter path to file '%s' ( to end search): ", sourcefile); + input_read_line(zbuf, tmppath, sizeof(tmppath)); + if (!(len = strlen(tmppath))) break; + + /* append '/' if missing at the end */ + if (tmppath[len - 1] != '/' && tmppath[len - 1] != '\\') + tmppath[len++] = '/'; + strcpy(&tmppath[len], basename); + if (GetFileAttributesA(tmppath) != INVALID_FILE_ATTRIBUTES) + break; + dbg_printf("Unable to access file '%s'\n", tmppath); } - /* - * Now append the base file name. - */ - strcat(tmppath, basename); } - else tmppath[0] = '\0'; + else + { + dbg_printf("Unable to access file '%s'\n", sourcefile); + tmppath[0] = '\0'; + } - if (GetFileAttributesA(tmppath) == INVALID_FILE_ATTRIBUTES) + if (!tmppath[0]) { /* * OK, I guess the user doesn't really want to see it * after all. */ ol = source_add_file(sourcefile, NULL); - dbg_printf("Unable to open file '%s'\n", tmppath); return FALSE; } }