From 771b12eab84dc1b43c67672c7b7e5bd3c88cc6ab Mon Sep 17 00:00:00 2001 From: Dr-Carlos Date: Tue, 19 Apr 2022 21:21:21 +0930 Subject: [PATCH] _isc: resolve vspace when parsing and misc fixes --- shell/i.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/shell/i.cpp b/shell/i.cpp index a17412d..0d53f73 100644 --- a/shell/i.cpp +++ b/shell/i.cpp @@ -151,8 +151,21 @@ static struct _isc_args parse_isc(Session &session, Parser &parser) parser.accept_options(); + VirtualSpace *space = session.current_space; + if(!args.vspace_name.empty()) { + space = session.get_space(args.vspace_name); + if(!space) { + std::string msg + = format("virtual space '%s' does not exist", args.vspace_name); + if(parser.completing()) + throw Parser::CompletionRequest("_error", msg); + else + FxOS_log(ERR, "%s", msg); + } + } + while(!parser.at_end()) - args.addresses.push_back(parser.expr(session.current_space)); + args.addresses.push_back(parser.expr(space)); parser.end(); return args; @@ -173,6 +186,11 @@ void _isc(Session &session, std::string vspace_name, bool sort, std::vector addresses) { VirtualSpace *space = session.current_space; + if(!space) { + FxOS_log(ERR, "no virtual space selected"); + return; + } + if(!vspace_name.empty()) space = session.get_space(vspace_name); @@ -185,7 +203,8 @@ void _isc(Session &session, std::string vspace_name, bool sort, if(!os) { if(!vspace_name.empty()) FxOS_log(ERR, "OS analysis on '%s' failed", vspace_name); - FxOS_log(ERR, "OS analysis failed"); + else + FxOS_log(ERR, "OS analysis failed"); return; }