oc::result<void> SonyElfFormatWriter::get_entry(File &file, Entry &entry) { OUTCOME_TRYV(m_seg->get_entry(file, entry, m_writer)); auto swentry = m_seg->entry(); // Silently handle cmdline entry if (swentry->type == SONY_ELF_ENTRY_CMDLINE) { entry.clear(); entry.set_size(m_cmdline.size()); auto set_as_fatal = finally([&] { m_writer.set_fatal(); }); OUTCOME_TRYV(write_entry(file, entry)); OUTCOME_TRYV(write_data(file, m_cmdline.data(), m_cmdline.size())); OUTCOME_TRYV(finish_entry(file)); OUTCOME_TRYV(get_entry(file, entry)); set_as_fatal.dismiss(); } return oc::success(); }
void operator()(boost::asio::yield_context yield) { // set coroutine specific log string to parentLogString stack.get() = std::move(parentLogStrings); auto f = finally([](){ stack.erase(); }); function(yield); }
/*! * \brief Get first line from file * * The trailing newline (if exists) will be stripped from the result. * * \param path File to read * * \return Nothing on success or the error code on failure. Returns * FileError::UnexpectedEof if the file is empty. */ oc::result<std::string> file_first_line(const std::string &path) { ScopedFILE fp(fopen(path.c_str(), "rbe"), fclose); if (!fp) { return ec_from_errno(); } char *line = nullptr; size_t len = 0; ssize_t read; auto free_line = finally([&] { free(line); }); if ((read = getline(&line, &len, fp.get())) < 0) { if (ferror(fp.get())) { return ec_from_errno(); } else { return FileError::UnexpectedEof; } } if (read > 0 && line[read - 1] == '\n') { line[read - 1] = '\0'; --read; } return line; }
static bool audit_mainloop() { int fd = audit_open(); if (fd < 0) { LOGE("Failed to open audit socket: %s", strerror(errno)); return false; } auto close_fd = finally([&]{ audit_close(fd); }); if (audit_setup(fd, static_cast<uint32_t>(getpid())) < 0) { return false; } while (true) { struct audit_message reply; reply.nlh.nlmsg_type = 0; reply.nlh.nlmsg_len = 0; reply.data[0] = '\0'; if (audit_get_reply(fd, &reply, GET_REPLY_BLOCKING, 0) < 0) { LOGE("Failed to get reply from audit socket: %s", strerror(errno)); return false; } LOGV("type=%d %.*s", reply.nlh.nlmsg_type, reply.nlh.nlmsg_len, reply.data); } // unreachable }
value_t IO::rb_readlines(String *path) { Stream *file; Platform::wrap([&] { file = Platform::open(path->string, Platform::Read, Platform::Open); }); Finally finally([&] { delete file; }); auto result = Array::allocate(); while(true) { CharArray line = file->gets(); if(line.size()) result->vector.push(line.to_string()); else break; } return result; }
bool blkid_get_fs_type(const char *path, const char **type) { std::vector<unsigned char> buf(1024 * 1024); int fd = open(path, O_RDONLY | O_CLOEXEC); if (fd < 0) { return false; } auto close_fd = finally([&]{ int saved_errno = errno; close(fd); errno = saved_errno; }); ssize_t n = read_all(fd, buf.data(), buf.size()); if (n < 0) { return false; } for (auto it = probe_funcs; it->name; ++it) { if (it->func(buf.data(), n)) { *type = it->name; return true; } } *type = nullptr; return true; }
bool TrackList::ApplyPendingTracks() { bool result = false; ListOfTracks additions; ListOfTracks updates; { // Always clear, even if one of the update functions throws auto cleanup = finally( [&] { ClearPendingTracks( &additions ); } ); UpdatePendingTracks(); updates.swap( mPendingUpdates ); } // Remaining steps must be NOFAIL-GUARANTEE so that this function // gives STRONG-GUARANTEE std::vector< std::shared_ptr<Track> > reinstated; for (auto &pendingTrack : updates) { if (pendingTrack) { auto src = FindById( pendingTrack->GetId() ); if (src) this->Replace(src, pendingTrack), result = true; else // Perhaps a track marked for pending changes got deleted by // some other action. Recreate it so we don't lose the // accumulated changes. reinstated.push_back(pendingTrack); } } // If there are tracks to reinstate, append them to the list. for (auto &pendingTrack : reinstated) if (pendingTrack) this->Add( pendingTrack ), result = true; // Put the pending added tracks back into the list, preserving their // positions. bool inserted = false; ListOfTracks::iterator first; for (auto &pendingTrack : additions) { if (pendingTrack) { auto iter = ListOfTracks::begin(); std::advance( iter, pendingTrack->GetIndex() ); iter = ListOfTracks::insert( iter, pendingTrack ); pendingTrack->SetOwner( shared_from_this(), {iter, this} ); pendingTrack->SetId( TrackId{ ++sCounter } ); if (!inserted) { first = iter; inserted = true; } } } if (inserted) { RecalcPositions({first, this}); result = true; } return result; }
oc::result<void> selinux_set_process_attr(pid_t pid, SELinuxAttr attr, const std::string &context) { OUTCOME_TRY(fd, open_attr(pid, attr, O_WRONLY | O_CLOEXEC)); auto close_fd = finally([&] { close(fd); }); ssize_t n; if (context.empty()) { // Clear context in the attr file if context is empty do { n = write(fd, nullptr, 0); } while (n < 0 && errno == EINTR); } else { // Otherwise, write the new context. The written string must be // NULL-terminated do { n = write(fd, context.c_str(), context.size() + 1); } while (n < 0 && errno == EINTR); } if (n < 0) { return ec_from_errno(); } return oc::success(); }
void TStrings::SetTextStr(const UnicodeString & Text) { BeginUpdate(); auto cleanup = finally([&]() { EndUpdate(); }); { Clear(); const wchar_t * P = Text.c_str(); if (P != nullptr) { while (*P != 0x00) { const wchar_t * Start = P; while (!((*P == 0x00) || (*P == 0x0A) || (*P == 0x0D))) { P++; } UnicodeString S; S.SetLength(P - Start); memmove(const_cast<wchar_t *>(S.c_str()), Start, (P - Start) * sizeof(wchar_t)); Add(S); if (*P == 0x0D) { P++; } if (*P == 0x0A) { P++; } } } } }
/* Thread that connects to the database, on success it continues to handle queries in the run method. */ void Database::connectRun() { LOG_CURRENT_FUNCTIONCALL mysql_thread_init(); auto threadEnd = finally([&] { mysql_thread_end(); }); { auto connectionSignaliser = finally([&] { m_connectWakeupVariable.notify_one(); }); std::lock_guard<std::mutex>(this->m_connectMutex); this->m_sql = mysql_init(nullptr); if (this->m_sql == nullptr) { m_success = false; m_connection_err = "Out of memory"; m_connectionDone = true; m_status = DATABASE_CONNECTION_FAILED; return; } if (this->shouldAutoReconnect) { my_bool reconnect = 1; mysql_options(this->m_sql, MYSQL_OPT_RECONNECT, &reconnect); } const char* socket = (this->socket.length() == 0) ? nullptr : this->socket.c_str(); unsigned long clientFlag = (this->useMultiStatements) ? CLIENT_MULTI_STATEMENTS : 0; if (mysql_real_connect(this->m_sql, this->host.c_str(), this->username.c_str(), this->pw.c_str(), this->database.c_str(), this->port, socket, clientFlag) != this->m_sql) { m_success = false; m_connection_err = mysql_error(this->m_sql); m_connectionDone = true; m_status = DATABASE_CONNECTION_FAILED; return; } m_success = true; m_connection_err = ""; m_connectionDone = true; m_status = DATABASE_CONNECTED; m_serverVersion = mysql_get_server_version(this->m_sql); m_serverInfo = mysql_get_server_info(this->m_sql); m_hostInfo = mysql_get_host_info(this->m_sql); } auto closeConnection = finally([&] { mysql_close(this->m_sql); this->m_sql = nullptr; }); if (m_success) { run(); } }
std::vector<std::string> Base::getVarname( std::string &s) { // There might be a varname specification or not. // no varname found: return true std::vector<std::string> names; std::string list; std::vector<std::string> tokens; tokens.push_back( ":v=" ) ; tokens.push_back( ":varname=" ) ; tokens.push_back( ":vname=" ) ; tokens.push_back( ":variable" ) ; bool isEmpty=true; size_t pos0=0; for( size_t i=0 ; i < tokens.size() ; ++i ) { if( (pos0 = s.find( tokens[i] ) ) < std::string::npos ) // e.g.: s: "...:vname=...:..." and tokens: ":vname=..." isEmpty=false; else if( s.substr(0,tokens[i].size()-1) == tokens[i].substr(1) ) // e.g.: s: "vname=..." and tokens: "vname=..." isEmpty=false; } if( isEmpty ) return names; // the assignment sign size_t pos1=s.find("=",pos0); if( pos1 == std::string::npos ) { std::ostringstream ostr(std::ios::app); ostr << "Base::getVarname(): invalid assignment"; exceptionError( ostr.str() ); std::string note("E8: no rules for finding a variable name."); finally(8, note); } else ++pos1 ; // the end of the assignment size_t pos2=s.find(":",pos1); if( pos2 == std::string::npos ) // the end of the string pos2=s.size(); list=s.substr(pos1, pos2-pos1); // expand the list Split spl(list, ","); for( size_t i=0 ; i < spl.size() ; ++i) names.push_back( spl[i] ) ; return names; }
typename aux_::try_finally_result<F>::void_type except_try_finally(F&& f, Finally && finally) { if (noexcept(finally())) { finally<Finally&> d{finally}; return f(); } try { f(); } catch(...) { finally(); throw; } finally(); }
void TagsEditor::OnSave(wxCommandEvent & WXUNUSED(event)) { wxString fn; // Refresh tags TransferDataFromWindow(); // Ask the user for the real name fn = FileNames::SelectFile(FileNames::Operation::_None, _("Save Metadata As:"), FileNames::DataDir(), wxT("Tags.xml"), wxT("xml"), wxT("*.xml"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER, this); // User canceled... if (fn.empty()) { return; } GuardedCall( [&] { // Create/Open the file XMLFileWriter writer{ fn, _("Error Saving Tags File") }; // Remember title and track in case they're read only wxString title = mLocal.GetTag(TAG_TITLE); wxString track = mLocal.GetTag(TAG_TRACK); // Clear title if (!mEditTitle) { mLocal.SetTag(TAG_TITLE, wxEmptyString); } // Clear track if (!mEditTrack) { mLocal.SetTag(TAG_TRACK, wxEmptyString); } auto cleanup = finally( [&] { // Restore title if (!mEditTitle) { mLocal.SetTag(TAG_TITLE, title); } // Restore track if (!mEditTrack) { mLocal.SetTag(TAG_TRACK, track); } } ); // Write the metadata mLocal.WriteXML(writer); writer.Commit(); } ); }
bool selinux_read_policy(const std::string &path, policydb_t *pdb) { struct policy_file pf; struct stat sb; void *map; int fd; fd = open(path.c_str(), O_RDONLY); if (fd < 0) { LOGE("Failed to open %s: %s", path.c_str(), strerror(errno)); return false; } auto close_fd = finally([&] { close(fd); }); if (fstat(fd, &sb) < 0) { LOGE("Failed to stat %s: %s", path.c_str(), strerror(errno)); return false; } map = mmap(nullptr, sb.st_size, PROT_READ, MAP_PRIVATE, fd, 0); if (map == MAP_FAILED) { LOGE("Failed to mmap %s: %s", path.c_str(), strerror(errno)); return false; } auto unmap_map = finally([&] { munmap(map, sb.st_size); }); policy_file_init(&pf); pf.type = PF_USE_MEMORY; pf.data = (char *) map; pf.len = sb.st_size; auto destroy_pf = finally([&] { sepol_handle_destroy(pf.handle); }); return policydb_read(pdb, &pf, 0) == 0; }
typename aux_::try_finally_result<F>::no_void_type except_try_finally(F&& f, Finally && finally) { if (noexcept(finally())) { finally<Finally&> d{finally}; return f(); } decltype(f()) ret; try { ret = f(); } catch(...) { finally(); throw; } finally(); return ret; }
bool extract_archive(const std::string &filename, const std::string &target) { autoclose::archive in(archive_read_new(), archive_read_free); autoclose::archive out(archive_write_disk_new(), archive_write_free); if (!in || !out) { LOGE("Out of memory"); return false; } archive_entry *entry; int ret; std::string cwd = get_cwd(); if (cwd.empty()) { return false; } if (!set_up_input(in.get(), filename)) { return false; } set_up_output(out.get()); if (!mkdir_recursive(target, S_IRWXU | S_IRWXG | S_IRWXO)) { LOGE("%s: Failed to create directory: %s", target.c_str(), strerror(errno)); return false; } if (chdir(target.c_str()) < 0) { LOGE("%s: Failed to change to target directory: %s", target.c_str(), strerror(errno)); return false; } auto chdir_back = finally([&] { chdir(cwd.c_str()); }); while ((ret = archive_read_next_header(in.get(), &entry)) == ARCHIVE_OK) { if (libarchive_copy_header_and_data(in.get(), out.get(), entry) != ARCHIVE_OK) { return false; } } if (ret != ARCHIVE_EOF) { LOGE("Archive extraction ended without reaching EOF: %s", archive_error_string(in.get())); return false; } return true; }
// /sys/fs/selinux/load requires the entire policy to be written in a single // write(2) call. // See: http://marc.info/?l=selinux&m=141882521027239&w=2 bool selinux_write_policy(const std::string &path, policydb_t *pdb) { void *data; size_t len; sepol_handle_t *handle; int fd; // Don't print warnings to stderr handle = sepol_handle_create(); sepol_msg_set_callback(handle, nullptr, nullptr); auto destroy_handle = finally([&] { sepol_handle_destroy(handle); }); if (policydb_to_image(handle, pdb, &data, &len) < 0) { LOGE("Failed to write policydb to memory"); return false; } auto free_data = finally([&] { free(data); }); fd = open(path.c_str(), O_CREAT | O_TRUNC | O_RDWR, 0644); if (fd < 0) { LOGE("Failed to open %s: %s", path.c_str(), strerror(errno)); return false; } auto close_fd = finally([&] { close(fd); }); if (write(fd, data, len) < 0) { LOGE("Failed to write to %s: %s", path.c_str(), strerror(errno)); return false; } return true; }
static PyObject *t_regexmatcher_split(t_regexmatcher *self, PyObject *args) { UnicodeString *u, _u; int capacity, count; if (!parseArgs(args, "Si", &u, &_u, &capacity)) { if (capacity < 32) { UnicodeString array[31]; PyObject *tuple; STATUS_CALL(count = self->object->split(*u, array, capacity, status)); tuple = PyTuple_New(count); for (int i = 0; i < count; i++) PyTuple_SET_ITEM(tuple, i, PyUnicode_FromUnicodeString(&array[i])); return tuple; } else { class finalizer { public: UnicodeString *array; finalizer(int size) { array = new UnicodeString[size]; } ~finalizer() { delete[] array; } }; finalizer finally(capacity); PyObject *tuple; if (!finally.array) return PyErr_NoMemory(); STATUS_CALL(count = self->object->split(*u, finally.array, capacity, status)); tuple = PyTuple_New(count); for (int i = 0; i < count; i++) PyTuple_SET_ITEM(tuple, i, PyUnicode_FromUnicodeString(&finally.array[i])); return tuple; } } return PyErr_SetArgsError((PyObject *) self, "split", args); }
void rice::pastry::testing::PastryNetworkTest_fetchLeafSets_1::run() { auto gotResponse = false; { auto finally0 = finally([&] { if(!gotResponse) { npc(::java::lang::System::out())->println(::java::lang::StringBuilder().append(u"Did not hear from "_j)->append(static_cast< ::java::lang::Object* >(handle))->toString()); } { synchronized synchronized_0(unseen); { PastryNetworkTest_this->numThreads--; npc(unseen)->notifyAll(); } } }); try { ::rice::pastry::leafset::LeafSet* ls = nullptr; if(false) throw new ::java::io::IOException(); npc(::java::lang::System::out())->println(::java::lang::StringBuilder().append(u"Response:"_j)->append(static_cast< ::java::lang::Object* >(handle)) ->append(u" "_j) ->append(static_cast< ::java::lang::Object* >(ls))->toString()); gotResponse = true; npc(ps)->println(::java::lang::StringBuilder().append(npc(npc(npc(handle)->getInetSocketAddress())->getAddress())->getHostAddress())->append(u":"_j) ->append(npc(npc(handle)->getInetSocketAddress())->getPort())->toString()); npc(leafsets)->put(static_cast< ::java::lang::Object* >(handle), static_cast< ::java::lang::Object* >(ls)); auto ns = npc(ls)->neighborSet(::java::lang::Integer::MAX_VALUE); if(!npc(npc(ns)->get(int32_t(0)))->equals(static_cast< ::java::lang::Object* >(handle))) { npc(PastryNetworkTest_this->dead)->add(static_cast< ::java::lang::Object* >(handle)); npc(PastryNetworkTest_this->nodes)->remove(static_cast< ::java::lang::Object* >(handle)); npc(leafsets)->remove(static_cast< ::java::lang::Object* >(handle)); npc(leafsets)->put(static_cast< ::java::lang::Object* >(npc(ns)->get(int32_t(0))), static_cast< ::java::lang::Object* >(ls)); } for (auto i = int32_t(1); i < npc(ns)->size(); i++) if((!npc(PastryNetworkTest_this->nodes)->contains(static_cast< ::java::lang::Object* >(npc(ns)->get(i)))) && (!npc(PastryNetworkTest_this->dead)->contains(static_cast< ::java::lang::Object* >(npc(ns)->get(i))))) npc(unseen)->add(static_cast< ::java::lang::Object* >(npc(ns)->get(i))); } catch (::java::net::ConnectException* e) { npc(PastryNetworkTest_this->dead)->add(static_cast< ::java::lang::Object* >(handle)); } catch (::java::net::SocketTimeoutException* e) { npc(PastryNetworkTest_this->unknown)->add(static_cast< ::java::lang::Object* >(handle)); } catch (::java::io::IOException* e) { npc(::java::lang::System::out())->println(::java::lang::StringBuilder().append(u"GOT OTHER ERROR CONNECTING TO "_j)->append(static_cast< ::java::lang::Object* >(handle)) ->append(u" - "_j) ->append(static_cast< ::java::lang::Object* >(e))->toString()); } } }
bool loopdev_set_up_device(const std::string &loopdev, const std::string &file, uint64_t offset, bool ro) { int ffd = -1; int lfd = -1; struct loop_info64 loopinfo; if ((ffd = open(file.c_str(), ro ? O_RDONLY : O_RDWR)) < 0) { return false; } auto close_ffd = finally([&] { close(ffd); }); if ((lfd = open(loopdev.c_str(), ro ? O_RDONLY : O_RDWR)) < 0) { return false; } auto close_lfd = finally([&] { close(lfd); }); memset(&loopinfo, 0, sizeof(struct loop_info64)); loopinfo.lo_offset = offset; if (ioctl(lfd, LOOP_SET_FD, ffd) < 0) { return false; } if (ioctl(lfd, LOOP_SET_STATUS64, &loopinfo) < 0) { ioctl(lfd, LOOP_CLR_FD, 0); return false; } return true; }
oc::result<bool> file_find_one_of(const std::string &path, const std::vector<std::string> &items) { struct stat sb; void *map = MAP_FAILED; int fd = -1; if ((fd = open(path.c_str(), O_RDONLY | O_CLOEXEC)) < 0) { return ec_from_errno(); } auto close_fd = finally([&] { close(fd); }); if (fstat(fd, &sb) < 0) { return ec_from_errno(); } map = mmap(nullptr, static_cast<size_t>(sb.st_size), PROT_READ, MAP_PRIVATE, fd, 0); if (map == MAP_FAILED) { return ec_from_errno(); } auto unmap_map = finally([&] { munmap(map, static_cast<size_t>(sb.st_size)); }); for (auto const &item : items) { if (memmem(map, static_cast<size_t>(sb.st_size), item.data(), item.size())) { return true; } } return false; }
void TStrings::AddStrings(const TStrings * Strings) { BeginUpdate(); auto cleanup = finally([&]() { EndUpdate(); }); { for (intptr_t I = 0; I < Strings->GetCount(); I++) { AddObject(Strings->GetString(I), Strings->GetObject(I)); } } }
bool file_get_property(const std::string &path, const std::string &key, std::string *out, const std::string &default_value) { file_ptr fp(std::fopen(path.c_str(), "r"), std::fclose); if (!fp) { return false; } char *line = nullptr; size_t len = 0; ssize_t read; auto free_line = finally([&] { free(line); }); while ((read = getline(&line, &len, fp.get())) >= 0) { if (line[0] == '\0' || line[0] == '#') { // Skip empty and comment lines continue; } char *equals = strchr(line, '='); if (!equals) { // No equals in line continue; } if ((size_t)(equals - line) != key.size()) { // Key is not the same length continue; } if (starts_with(line, key)) { // Strip newline if (line[read - 1] == '\n') { line[read - 1] = '\0'; --read; } out->assign(equals + 1); return true; } } *out = default_value; return true; }
void EditToolBar::OnButton(wxCommandEvent &event) { int id = event.GetId()-first_ETB_ID; // Be sure the pop-up happens even if there are exceptions, except for buttons which toggle. auto cleanup = finally( [&] { mButtons[id]->InteractionOver();}); AudacityProject *p = GetActiveProject(); if (!p) return; CommandManager* cm = p->GetCommandManager(); if (!cm) return; auto flags = GetMenuManager(*p).GetUpdateFlags(*p); const CommandContext context( *GetActiveProject() ); cm->HandleTextualCommand(EditToolbarButtonList[id].commandName, context, flags, NoFlagsSpecified); }
void TStrings::Move(intptr_t CurIndex, intptr_t NewIndex) { if (CurIndex != NewIndex) { BeginUpdate(); auto cleanup = finally([&]() { EndUpdate(); }); { UnicodeString TempString = GetString(CurIndex); TObject * TempObject = GetObject(CurIndex); Delete(CurIndex); InsertObject(NewIndex, TempString, TempObject); } } }
UnicodeString TStrings::GetCommaText() const { wchar_t LOldDelimiter = GetDelimiter(); wchar_t LOldQuoteChar = GetQuoteChar(); FDelimiter = L','; FQuoteChar = L'"'; UnicodeString Result; auto cleanup = finally([&]() { FDelimiter = LOldDelimiter; FQuoteChar = LOldQuoteChar; }); { Result = GetDelimitedText(); } return Result; }
value_t chdir(String *path, value_t block) { CharArray old = thread_context->current_directory; if(!Platform::is_directory(path->string)) raise(context->system_call_error, "'"+ path->string + "' in not a directory"); thread_context->current_directory = path->string; OnStackString<1> os(old); Finally finally([&] { thread_context->current_directory = old; }); return yield(block); }
oc::result<void> selinux_set_enforcing(bool value) { int fd = open(SELINUX_ENFORCE_FILE, O_RDWR | O_CLOEXEC); if (fd < 0) { return ec_from_errno(); } auto close_fd = finally([&] { close(fd); }); if (write(fd, value ? "1" : "0", 1) < 0) { return ec_from_errno(); } return oc::success(); }
bool get_mount_entry(std::FILE *fp, MountEntry &entry_out) { char *line = nullptr; size_t size = 0; auto free_line = finally([&] { free(line); }); if (getline(&line, &size, fp) < 0) { return false; } int pos[8]; int count = std::sscanf(line, " %n%*s%n %n%*s%n %n%*s%n %n%*s%n %d %d", pos, pos + 1, // fsname pos + 2, pos + 3, // dir pos + 4, pos + 5, // type pos + 6, pos + 7, // opts &entry_out.freq, // freq &entry_out.passno); // passno if (count != 2) { return false; } // NULL terminate entries line[pos[1]] = '\0'; line[pos[3]] = '\0'; line[pos[5]] = '\0'; line[pos[7]] = '\0'; entry_out.fsname = unescape_octals(line + pos[0]); entry_out.dir = unescape_octals(line + pos[2]); entry_out.type = unescape_octals(line + pos[4]); entry_out.opts = unescape_octals(line + pos[6]); struct stat sb; if (lstat(entry_out.dir.c_str(), &sb) < 0 && errno == ENOENT && mb::ends_with(entry_out.dir, DELETED_SUFFIX)) { entry_out.dir.erase(entry_out.dir.size() - strlen(DELETED_SUFFIX)); } return true; }
std::vector<std::string> Base::getVarname( std::string &s, std::vector<std::string> &alias) { // There might be a varname specification or not. // no varname found: return true // The reference 'alias' is special for operations, // e.g. v=x=var1,y=var2,... . If given, then var1 is the // variable returned via the vector and x,y,... are members // stored in alias. std::vector<std::string> list; std::vector<std::string> names; list = getVarname( s ) ; // expand the list for( size_t i=0 ; i < list.size() ; ++i) { Split spl(list[i], "="); if( spl.size() == 2 ) { alias.push_back( spl[0] ) ; names.push_back( spl[1] ) ; } else if( spl.size() == 1 ) { alias.push_back( "" ) ; names.push_back( spl[0] ) ; } else { std::ostringstream ostr(std::ios::app); ostr << "Base::getVarname(): invalid assignment\n"; ostr << " of variable names." ; exceptionError( ostr.str() ); std::string note("E9: invalid assignment of variable names."); finally(9, note); } } return names; }