xd-5.00.02/alternatives/0000755000175000017500000000000014740701373013764 5ustar frankfrankxd-5.00.02/alternatives/separateat.cc0000644000175000017500000000035514531604165016426 0ustar frankfrank#include "alternatives.ih" size_t Alternatives::separateAt() const { if (not d_options.separate() || d_nInHistory == size()) return UINT_MAX; return d_history.position() == TOP ? d_nInHistory : size() - d_nInHistory; } xd-5.00.02/alternatives/getcwd.cc0000644000175000017500000000064614531604165015555 0ustar frankfrank#include "alternatives.ih" // realpath shoyld return a string, not a char *, so the responsibility // of allocated memory isn't xd's responsibility anymore. // static string Alternatives::getCwd() { char *currentPath = realpath(".", 0); if (currentPath == 0) fmsg << "Can't determine the current working dir." << endl; string ret{ currentPath }; free(currentPath); return ret; } xd-5.00.02/alternatives/globalternatives.cc0000644000175000017500000000107414531604165017641 0ustar frankfrank#include "alternatives.ih" void Alternatives::globAlternatives(size_t idx, string const &searchCmd, string const &dir) { Glob glob(Glob::DIRECTORY, dir, Glob::NOSORT, Glob::DEFAULT); imsg << "Pattern `" << dir << "', " << glob.size() << " matches" << endl; if (idx != searchCmd.length()) { string tail = searchCmd.substr(idx); if (tail[0] == '/') tail.erase(0,1); generalizedAlternatives(dir, tail); return; } for (auto entry: glob) inspect(entry); } xd-5.00.02/alternatives/trailingdots.cc0000644000175000017500000000061214531604165016774 0ustar frankfrank#include "alternatives.ih" // static returns true if spec has trailing dots bool Alternatives::trailingDots(string const &spec) { if // ignore trailing . and .. directories ( spec.rfind("/.") == spec.length() - 2 or spec.rfind("/..") == spec.length() - 3 ) { imsg << "dot-directory" << endl; return true; } return false; } xd-5.00.02/alternatives/operatorindex.cc0000644000175000017500000000033014531604165017151 0ustar frankfrank#include "alternatives.ih" string const &Alternatives::operator[](size_t index) const { return d_result == DIRECT ? d_initialDir : deque::operator[](index); } xd-5.00.02/alternatives/addalternatives.cc0000644000175000017500000000174414531604165017452 0ustar frankfrank#include "alternatives.ih" // abcd is handled as: // // 1. a*/ if existing: test bcd else leave. // // 1.1. a*/b* if existing: test cd else leave (etc). // // 2. ab*/ test cd (etc). // // but if a/bcd is entered: // // 1. a*/ if existing: test /bcd, else leave // // 1.1 a*/b* if existing: test cd, else leave (etc) // // 2. a/b: not tested // 3. a/bc: not tested // 4. a/bcd: not tested // // So: if the head contains a / it is not tested. // If the tail starts with /, that char is ignored. // add alternatives found with generalized directory searching // dir: starting directory void Alternatives::addAlternatives(size_t *idx, string &searchCmd, string dir) try { prepareDir(dir, idx, searchCmd); // prepare dir for globbing globAlternatives(*idx, searchCmd, dir); } catch (exception const &err) // exception by Glob { imsg << "No pattern matching `" << dir << "', pruning this branch" << endl; throw false; } xd-5.00.02/alternatives/setignored.cc0000644000175000017500000000057614531604165016445 0ustar frankfrank#include "alternatives.ih" void Alternatives::setIgnored() { for // add all ignored dirs in the ( // config file auto iters = Options::instance().ignore(); string const &line: ranger(iters.first, iters.second) ) addIgnored(line); // add line's path to d_ignored } xd-5.00.02/alternatives/alternatives1.cc0000644000175000017500000000051114531604165017051 0ustar frankfrank#include "alternatives.ih" Alternatives::Alternatives() : d_options(Options::instance()), d_nInHistory(0), d_fromHome(d_options.fromHome()), // true unless 'start-at home' d_allDirs(d_options.allDirs()), d_addRoot(d_options.addRoot()), d_result(NONE) { imsg << "\n" "Alternatives\n"; } xd-5.00.02/alternatives/finddirs.cc0000644000175000017500000000233714531604165016101 0ustar frankfrank#include "alternatives.ih" void Alternatives::findDirs() { bool generalized = d_options.generalized() and not d_options.traditional(); Result (Alternatives::*find)(string const &dir) = ( generalized ? &Alternatives::generalizedDirs : &Alternatives::traditionalDirs ); // first try to find alternatives from the initial dir. d_result = (this->*find)(d_initialDir); imsg << "# matches using " << (generalized ? "generalized" : "traditional") << " searching: " << size() << endl; // if that doesn't work, and searching from / is OK (IF_EMPTY) // or searching fm / should always be performed then also search // fm /. No need to do that if initialDir == '/' if ( d_initialDir != "/" and ( d_addRoot == ALWAYS or (size() == 0 && d_addRoot == IF_EMPTY) ) ) { imsg << "Searching again from the root-dir" << endl; d_result = (this->*find)("/"); } // if (d_result == NONE) // { // imsg << "No matches..." << endl; // throw NONE; // } } xd-5.00.02/alternatives/matchignore.cc0000644000175000017500000000065714531604165016602 0ustar frankfrank#include "alternatives.ih" // static bool Alternatives::matchIgnore(string const &ignore, string const &entry) { // returns true if entry matches an ignore string return ignore.back() != '*' ? // literal match required ignore == entry : // wildcard match of final * OK entry.find(ignore.substr(0, ignore.length() - 1)) == 0; } xd-5.00.02/alternatives/embeddeddot.cc0000644000175000017500000000107214531604165016532 0ustar frankfrank#include "alternatives.ih" // true: dirEntry has a /./ pattern bool Alternatives::embeddedDot(string const &dirEntry) const { if ( dirEntry.find("/./") != string::npos // ignore */./* patterns or find_if( d_ignore.begin(), d_ignore.end(), [&](string const &ignore) { return matchIgnore(ignore, dirEntry); } ) != d_ignore.end() ) { imsg << "ignored" << endl; return true; } return false; } xd-5.00.02/alternatives/alternatives.h0000644000175000017500000001146314531604165016642 0ustar frankfrank#ifndef _INCLUDED_ALTERNATIVES_H_ #define _INCLUDED_ALTERNATIVES_H_ #include #include #include #include #include "../enums/enums.h" #include "../command/command.h" #include "../history/history.h" // If, when looking for /t*/m*/ps*/ the initial path /t*/m* does not exist // then there's no reason for inspecting /t*/mp*/s*/ as it won't exist either. // // In those cases the non-existing path is pruned (i.e., t*/m* is) an // subpatterns of the pruned path (e.g., t*/mp*) are not considered (and so: // not globbed) class Options; class Alternatives: private std::deque { using SetStr = std::unordered_set; struct Entry // = std::pair; // 1st: inode, 2nd: device { size_t inode; size_t device; }; struct Equal { bool operator()(Entry const &lhsl, Entry const &rhs) const; // .ih }; struct Hash { size_t operator()(Entry const &entry) const; // .ih }; using SetEntry = std::unordered_set; Options const &d_options; size_t d_nInHistory; // nr of items in the history bool d_fromHome; // true: search from $HOME bool d_allDirs; // true: search all dirs (also via links) TriState d_addRoot; // true: always also search /, ifEmpty: only if // search from $HOME fails Command d_command; History d_history; // history constructor uses Options std::string d_initialDir; SetStr d_ignore; SetEntry d_accepted; Result d_result; public: Alternatives(); std::string const &operator[](size_t index) const; void viable(); // find viable alternatives (or exc.) void order(); // handles history-position void update(size_t idx); // put the selected item in the history size_t separateAt() const; Result result() const; // inline using std::deque::size; private: void add(char const *path); // may update d_nInHistory // add alternatives found with // generalized directory searching // globPattern // starting at 'dir' // ^ for reference purposes: names used until version 5 void addAlternatives(size_t *idx, std::string &searchCmd, std::string dir); // add path in 'line' to d_ignored void addIgnored(std::string const &line); // update searchCmd when using // case insensitive matching static void checkCase(size_t *idx, std::string &head); // dotPattern bool embeddedDot(std::string const &dirEntry) const; // globFrom void findAlternatives(); // get ignored and alternative dirs, // globFrom, 2nd half void findDirs(); // find alternative dirs. // find alternatives when using // globHead // generalizedDirs searching void generalizedAlternatives(std::string const &initial, std::string &sarchCmd); // generalizedGlob Result generalizedDirs(std::string const &initial); static std::string getCwd(); // 2nd part of globPattern void globAlternatives(size_t idx, std::string const &searchCmd, std::string const &dir); // globFilter void inspect(char const *entry); // accept unique/non-relative dirs // called by embeddedDots static bool matchIgnore(std::string const &ignore, std::string const &entry); // prepare 'dir' for globbing // set dir = pattern in // (in addAlternatives) // globPattern void prepareDir(std::string &dir, size_t *idx, std::string &searchCmd); void setIgnored(); // determine set of paths to ignore void startDir(); // determine the start-dir // find all dirs using plain Result traditionalDirs(std::string const &dir); // glob from 'dir' // trailingDotPattern static bool trailingDots(std::string const &spec); }; inline Result Alternatives::result() const { return d_result; } inline void Alternatives::update(size_t index) { d_history.save((*this)[index]); } #endif xd-5.00.02/alternatives/generalizedalternatives.cc0000644000175000017500000000050614531604165021206 0ustar frankfrank#include "alternatives.ih" void Alternatives::generalizedAlternatives(string const &initial, string &searchCmd) try { size_t idx = 0; size_t end = searchCmd.length(); while (idx != end) addAlternatives(&idx, searchCmd, initial); } catch (bool headHasSlash) {} xd-5.00.02/alternatives/findalternatives.cc0000644000175000017500000000037214531604165017636 0ustar frankfrank#include "alternatives.ih" void Alternatives::findAlternatives() { if (not d_options.all()) // skip 'ignore' specs in the config file setIgnored(); findDirs(); // find alternative dirs at 'startDir' } xd-5.00.02/alternatives/startdir.cc0000644000175000017500000000276314531604165016136 0ustar frankfrank#include "alternatives.ih" void Alternatives::startDir() { bool fromConfig = false; switch (d_command.action()) { case Command::FROM_CONFIG: d_initialDir = d_fromHome ? d_options.homeDir() : "/"s; fromConfig = true; break; case Command::FROM_HOME: d_initialDir = d_options.homeDir(); break; case Command::FROM_ROOT: d_initialDir = "/"s; break; case Command::FROM_CWD: d_initialDir = getCwd(); break; case Command::FROM_PARENT: d_initialDir = getCwd(); size_t pos = d_initialDir.length(); // remove parent() path elements for (size_t idx = d_command.parent(); pos && idx--; ) pos = d_initialDir.rfind('/', pos - 1); if (pos != string::npos) // parent() elements found d_initialDir.resize(pos); // rmove the tail else d_initialDir = '/'; // fewer subd_initialDirs: use / break; } if (d_addRoot != NEVER and (not d_fromHome || not fromConfig)) { imsg << "Search does not start at the home-dir: " "no additional search from the root" << endl; d_addRoot = NEVER; } if (d_initialDir.back() != '/') // all d_initialDirs end in / d_initialDir += '/'; imsg << "Resolved starting the initial dir as: " << d_initialDir << endl; } xd-5.00.02/alternatives/order.cc0000644000175000017500000000021714531604165015405 0ustar frankfrank#include "alternatives.ih" void Alternatives::order() { if (d_history.rotate()) rotate(begin(), begin() + d_nInHistory, end()); } xd-5.00.02/alternatives/generalizeddirs.cc0000644000175000017500000000133314531604165017445 0ustar frankfrank#include "alternatives.ih" Result Alternatives::generalizedDirs(string const &initial) { // create the command consisting of all cmd line args ending in / // E.g., 2abc -> abc/, 2 ab cd de -> ab/cd/de/ string searchCmd = d_command.accumulate(); Result ret = searchCmd.length() == 0 ? DIRECT : MULTIPLE; if (ret == MULTIPLE) searchCmd.pop_back(); // remove trailing / if (searchCmd.empty()) imsg << "Direct CD, no merged searching, cd to "; else imsg << "Merged searching: `" << searchCmd << "', searching from "; imsg << initial << '\'' << endl; if (ret == MULTIPLE) generalizedAlternatives(initial, searchCmd); return ret; } xd-5.00.02/alternatives/icmconf0000777000175000017500000000000014531604165017642 2../icmconf.libustar frankfrankxd-5.00.02/alternatives/checkcase.cc0000644000175000017500000000160214531604165016202 0ustar frankfrank#include "alternatives.ih" // static void Alternatives::checkCase(size_t *idx, string &searchCmd) { // at an odd number of --icase specs: if ((Options::instance().icase() & 1) != 0) { // use case insensitive matching string mold("[..]"); // the pattern to contain, e.g., [aA] int ch = searchCmd[*idx]; // the char at 'idx' if (isalpha(ch)) // if it's a letter { mold[1] = tolower(ch); // then fill the lc/uc variants, mold[2] = toupper(ch); searchCmd.replace(*idx, 1, mold); // replace char @idx by [xX], *idx += 4; // and shift the next idx forwar by 4 return; } } ++*idx; // no letter or case sens. match: inc } xd-5.00.02/alternatives/traditionaldirs.cc0000644000175000017500000000156414531604165017474 0ustar frankfrank#include "alternatives.ih" Result Alternatives::traditionalDirs(string const &startDir) try { if (d_command.empty()) // no additional dirs specified: { imsg << "Direct cd to " << startDir << endl; return DIRECT; // cd to the initial dir } string dir{ d_initialDir }; for (auto &element: d_command) (dir += element) += "*/"; // add */ to each cmd arg dir.pop_back(); // remove trailing / imsg << "Passing `" << dir << "' to glob" << endl; // find matching elements Glob glob(Glob::DIRECTORY, dir, Glob::NOSORT, Glob::DEFAULT); for (char const *entry: glob) inspect(entry); // accept unique dirs. return MULTIPLE; } catch (exception const &exc) { return MULTIPLE; } xd-5.00.02/alternatives/viable.cc0000644000175000017500000000135014531604165015533 0ustar frankfrank#include "alternatives.ih" void Alternatives::viable() { startDir(); imsg << boolalpha << "Additional search from $HOME: " << d_fromHome << '\n' << "Search all directories: " << d_allDirs << '\n' << "Add root search if search from $HOME fails: " << d_options.triStateStr() << '\n' << "Start dir = " << d_initialDir << endl; findAlternatives(); // sets d_result to DIRECT // or MULTIPLE. if (d_result == DIRECT) return; sort(begin(), begin() + d_nInHistory); sort(begin() + d_nInHistory, end()); } xd-5.00.02/alternatives/add.cc0000644000175000017500000000057714531604165015033 0ustar frankfrank#include "alternatives.ih" void Alternatives::add(char const *entry) { if (not d_history.find(entry)) // entry is not in the search history push_back(entry); // -> append it to the set of alternatives else { push_front(entry); // entry is in the history -> show as ++d_nInHistory; // an early alternative. } } xd-5.00.02/alternatives/preparedir.cc0000644000175000017500000000133214531604165016426 0ustar frankfrank#include "alternatives.ih" // see globpattern.cc: // if the head contains a / it is not tested. // If the tail starts with /, that char is ignored. void Alternatives::prepareDir(string &dir, size_t *idx, string &searchCmd) { // update searchCmd when case checkCase(idx, searchCmd); // insensitive matching is used // create a pattern from dir + initial substring string head = searchCmd.substr(0, *idx); if (head.find('/') != string::npos) // ignore if head has a /, caught throw false; // by generalizedAlternatives dir += head; dir += "*/"; // this pattern must exist } xd-5.00.02/alternatives/alternatives.ih0000644000175000017500000000105514531604165017007 0ustar frankfrank#include "alternatives.h" #include "cstring" #include #include #include #include #include #include #include #include "../options/options.h" using namespace std; using namespace FBB; inline bool Alternatives::Equal::operator()( Entry const &lhs, Entry const &rhs) const { return memcmp(&lhs, &rhs, sizeof(Entry)); }; inline size_t Alternatives::Hash::operator()(Entry const &entry) const { return entry.inode; } xd-5.00.02/alternatives/inspect.cc0000644000175000017500000000202114531604165015732 0ustar frankfrank#include "alternatives.ih" void Alternatives::inspect(char const *entry) { imsg << "Inspecting `" << entry << "': "; string dirEntry(entry); // if a trailing / was removed reinstall it. if (dirEntry.back() != '/') dirEntry += '/'; // no patterns with /./ or /. elements if (embeddedDot(dirEntry) or trailingDots(entry)) return; Stat stat{ entry }; // if 'all dirs' is not specified then // entry must be equal to the true path name if (not d_allDirs && stat.path() != entry) { imsg << " symlink" << endl; return; } // only add unique entries if (d_accepted.insert( { stat.inode(), stat.device() } ).second == false) { imsg << " already available" << endl; return; } imsg << "ACCEPTED" << endl; add(entry); // store the entry in the deque 'parent' class } xd-5.00.02/alternatives/addignored.cc0000644000175000017500000000063214531604165016373 0ustar frankfrank#include "alternatives.ih" void Alternatives::addIgnored(string const &line) { istringstream in(line); string path; in >> path >> path; // skip ignore, extract path // add a / unless the path ends in * or / if (*path.rbegin() != '*' && *path.rbegin() != '/') path += '/'; imsg << "ignoring " << path << endl; d_ignore.insert(path); } xd-5.00.02/build0000755000175000017500000000704714531604165012317 0ustar frankfrank#!/usr/bin/icmake -t. #define LOGENV "XD" string g_logPath = getenv(LOGENV)[1], g_cwd = chdir(""); // initial working directory, ends in / int g_echo = ON; #include "icmconf" #include "icmake/cuteoln" #include "icmake/backtick" #include "icmake/setopt" #include "icmake/run" #include "icmake/md" #include "icmake/findall" #include "icmake/loginstall" #include "icmake/logzip" #include "icmake/logfile" #include "icmake/uninstall" #include "icmake/pathfile" #include "icmake/special" #include "icmake/clean" #include "icmake/manpage" #include "icmake/install" #include "icmake/gitlab" void main(int argc, list argv) { string option; string strip; int idx; for (idx = listlen(argv); idx--; ) { if (argv[idx] == "-q") { g_echo = OFF; argv -= (list)"-q"; } else if (argv[idx] == "-P") { //g_gch = 0; argv -= (list)"-P"; } } echo(g_echo); option = argv[1]; if (option == "clean") clean(0); if (option == "distclean") clean(1); if (option == "install") install(argv[2], argv[3]); if (option == "uninstall") uninstall(argv[2]); if (option != "") special(); if (option == "gitlab") gitlab(); if (option == "man") manpage(); if (option == "library") { system("icmbuild library"); exit(0); } if (argv[2] == "strip") strip = "strip"; if (option == "program") { system("icmbuild program"); exit(0); } if (option == "xref") { system("icmbuild program"); run("oxref -r replacements -t main -fxs tmp/lib" LIBRARY ".a tmp/main.o > " PROJECT ".xref"); exit(0); } printf("Usage: build [-q -P] what\n" "Where\n" " [-q]: run quietly, do not show executed commands\n" " [-P]: do not use precompiled headers\n" "`what' is one of:\n" " clean - clean up remnants of previous " "compilations\n" " distclean - clean + fully remove tmp/\n" " library - build " PROJECT "'s library\n" " man - build the man-page (requires Yodl)\n" " program [strip] - build " PROJECT " (optionally strip the\n" " executable)\n" " xref [strip] - same a `program', also builds xref file\n" " using oxref\n" " install selection [base] - to install the software in the \n" " locations defined in the INSTALL.im file,\n" " optionally below base\n" " selection can be\n" " x, to install all components,\n" " or a combination of:\n" " b (binary program),\n" " d (documentation),\n" " m (man-pages)\n" " uninstall logfile - remove files and empty directories listed\n" " in the file 'logfile'\n" " gitlab - prepare gitlab's gh-pages update\n" " (internal use only)\n" "\n" "If the environment variable DRYRUN is defined, no commands are\n" "actually executed\n" "\n" ); exit(1); } xd-5.00.02/build-depends0000644000175000017500000000016114531604165013722 0ustar frankfrankBuild-Depends: libbobcat-dev (>= 3.11.01), icmake (>= 7.19.00), g++ (>= 4.7.1), yodl (>= 3.00.0) xd-5.00.02/changelog0000644000175000017500000003072614740700253013141 0ustar frankfrankxd (5.00.02) * Requires bobcat >= 6.07.00 and icmake >= 13.00,03. Changed ArgConfig::None into ArgConfig::NoArg, building uses a SPCH and multi-compilation. The compiler is called with the ${ICMAKE_CPPSTD} argument. -- Frank B. Brokken Sun, 12 Jan 2025 09:43:13 +0100 xd (5.00.01) * Added a section to the man-page about how to activate direct key entries. * The file 'c++std' is not used anymore. Instead the standard to use can be specified using the ICMAKE_CXXFLAGS environment variable. -- Frank B. Brokken Wed, 29 Nov 2023 09:45:52 +0100 xd (5.00.00) * Xd now supports direct parent-dir changes. E.g., xd 4 changes dir to the 4th parent. * Reorganized/renamed mmbers in the Alternatives class * Dropped icmake/precompile: handled by icmake itself through the PRECOMP flag. * Repaired a memory leak in command/concatargs.cc * Updated the man-page -- Frank B. Brokken Wed, 08 Mar 2023 10:28:53 +0100 xd (4.01.01) * Ready for libbobcat6 * Added 'c++std' defining the c++ standard to use for compilation. Compilation commands also use -Werror * Changed 'build oxref' into 'build xref' -- Frank B. Brokken Wed, 14 Sep 2022 13:18:21 +0200 xd (4.01.00) * Added option --no-input suppressing the --input option, which is useful when defining shell functions processing the directory selected by xd. * Values returned by xd to the operating system are fine-tuned to the action performed by xd, which can now return 0..5. See the man-page for details. -- Frank B. Brokken Sun, 26 Jun 2022 12:48:38 +0200 xd (4.00.00) * Added option --input allowing xd to directly perform cd-commands and to insert non-selection characters into the shell's input buffer. * Added option --block-size to show alternative cd-directories in blocks of fixed maximum sizes. * Added the file LICENSE.txt specifying XD's (GPL) copyright rules. * Updated the man-page. * Updated the xdrc demo configuration file. * Updated the xd.xref cross-reference listing. * Added class Options to handle the options/configuration file. * The class Filter was renamed to Selector. -- Frank B. Brokken Sun, 19 Jun 2022 12:50:49 +0200 xd (3.29.02) * Repaired flaw in icmake/finall: it now checks for 'backtick' returning a single, empty element. -- Frank B. Brokken Tue, 07 Sep 2021 18:43:12 +0200 xd (3.29.01) * Removed -q from xd's build script -- Frank B. Brokken Sat, 26 Jun 2021 15:16:19 +0200 xd (3.29.00) * Changes required for bobcat >= 5.00.00 -- Frank B. Brokken Wed, 24 Apr 2019 12:40:38 +0200 xd (3.28.00) * Directory entries containing /./ which XD may find when using dot in a search pattern are considered spurious results and are ignored. * The class name Arbiter was changed to Filter. -- Frank B. Brokken Thu, 24 Jan 2019 11:55:32 +0100 xd (3.27.00) * Added option --homedir-char and configuration file directive homedir-char to specify a non-default homedir specification character. * Updated the man-page (also its section `ABOUT xd'). * Compilation using the `build' script uses g++-2a. -- Frank B. Brokken Wed, 23 Jan 2019 11:44:19 +0100 xd (3.26.01) * Migrated from Github to Gitlab. -- Frank B. Brokken Tue, 19 Jun 2018 21:48:31 +0530 xd (3.26.00) * Patterns only specifying a starting directory are accepted, and return the full path of starting directories. E.g., 'xd .' returns the user's home directory, and 'xd 3' returns the path three levels up from the current working directory. -- Frank B. Brokken Sat, 07 Jan 2017 16:28:30 +0100 xd (3.25.00) * Initial directory specifiers 0-9 can now be used with and without separators. E.g., 'xd 0lb' and 'xd 0 lb' are equivalent. * The underscore is not used as separator anymore: the man-page was updated accordingly. * Renamed xd.* to main.* (synchronizing names with other projects) -- Frank B. Brokken Wed, 05 Oct 2016 15:06:54 +0200 xd (3.24.01) * Applied cosmetic changes to alternatives/getcwd.c (3.24.00's changes are merged with this version). -- Frank B. Brokken Sun, 21 Feb 2016 14:32:19 +0100 xd (3.24.00) * The xd-support scripts that are mentioned in the man-page now allow (ugly!!!) blanks in directory names. * Updated the manual page. * Repaired the description of the initial . and 0 in the usage message. * Removed a dependency on PATH_MAX (in alternatives/getcwd.cc) -- Frank B. Brokken Sun, 21 Feb 2016 12:45:28 +0100 xd (3.23.04) * Adapted the build scripts to icmake 8.00.04 * README.g++-5 now superfluous and removed. -- Frank B. Brokken Sun, 20 Dec 2015 10:45:43 +0100 xd (3.23.03) * Kevin Brodsky observed that the installation scripts used 'chdir' rather than 'cd'. Fixed in this release. * Kevin Brodsky also observed that the combined size of all precompiled headers might exceed some disks capacities. The option -P was added to the ./build script to prevent the use of precompiled headers. -- Frank B. Brokken Mon, 05 Oct 2015 21:28:25 +0200 xd (3.23.02) * Modified the (un)installation procedures -- Frank B. Brokken Fri, 02 Oct 2015 13:48:25 +0200 xd (3.23.01) * Repaired a small flaw in the man-page * Added the missing 'generalized-search' (cq. 'traditional') demo-entry to the sample xdrc file * Added the file 'required' summarizing the software which was used for building xd. -- Frank B. Brokken Mon, 19 Jan 2015 20:07:19 +0100 xd (3.23.00) * Added --icase (-i) allowing case insensitive directory matching * Changed compilation option --std=c++0x to --std=c++14 -- Frank B. Brokken Thu, 11 Dec 2014 13:14:01 +0100 xd (3.22.09) * Added missing (since g++ 2.8.2) #include to alternatives.ih -- Frank B. Brokken Tue, 12 Nov 2013 09:33:03 +0100 xd (3.22.08) * Catching std::exceptions instead of FBB::Errno exceptions -- Frank B. Brokken Thu, 24 Jan 2013 13:42:22 +0100 xd (3.22.07) * Using Glob(Glob::DIRECTORY, ... to find directories -- Frank B. Brokken Mon, 29 Oct 2012 11:50:45 +0100 xd (3.22.06) * Added the build-depends file and updated the INSTALL file. -- Frank B. Brokken Sun, 28 Oct 2012 10:06:05 +0100 xd (3.22.05) * The following #defines in INSTALL.im can be overruled by defining identically named environment variables: CXX defines the name of the compiler to use. By default `g++' CXXFLAGS the options passed to the compiler. By default `-Wall --std=c++0x -O2 -g' LDFLAGS the options passed to the linker. By default no options are passed to the linker. -- Frank B. Brokken Wed, 18 Jul 2012 15:39:24 +0200 xd (3.22.04) * New upstream release, cosmetic changes (removed 3.22.03 headers again) -- Frank B. Brokken Thu, 10 May 2012 15:55:34 +0200 xd (3.22.03) * New version requires bobcat >= 3.00.00 -- Frank B. Brokken Thu, 03 May 2012 20:30:17 +0200 xd (3.22.02) * New version to link against bobcat 2.20.02, changes some for_eaches into range-based for-loops -- Frank B. Brokken Fri, 06 Jan 2012 08:55:35 +0100 xd (3.22.01) * `build' script now recognizes CXXFLAGS and LDFLAGS for, resp. g++ and ld flags. Default values are set in INSTALL.im, as before. -- Frank B. Brokken Sun, 26 Jun 2011 15:09:45 +0200 xd (3.22.00) * Replaced Bobcat's FnWrap* calls by lambda functions * The 'build' script now uses the -g option by default (set in INSTALL.im). To modify the g++ compilation options change the #define CPPOPT in INSTALL.im. By default it is set to "-O2 -g". To modify the flags `on the fly' set the environment variable CPPFLAGS, overruling CPPOPT. The option "-Wall" is always used and should not be altered. -- Frank B. Brokken Tue, 14 Jun 2011 21:06:15 +0200 xd (3.21.00) * The history retention mechanism has been simplified. Either the last x number of history lines are kept (using --history-maxsize) or the most recent history lines (as specified by --history-lifetime) are kept. * The selected choice is always given the current time stamp, so if a history is kept, in will always contain the most recently made choice. * The GPL is added to the tar.gz archive created by trunk/sourcetar * Superfluous icmake files (rebuild, manual) were removed. -- Frank B. Brokken Fri, 18 Feb 2011 15:23:45 +0100 xd (3.20.0) * Continuation patterns following a pattern not matching any file are pruned, speeding up XD's search process. * Added memory for previous selections, showing the popular alternatives matching a search pattern either at the beginning or at the end of the list of alternatives. Using history is optional, cf. the xd(1) man-page. * This version requires bobcat >= 2.10.0 -- Frank B. Brokken Fri, 17 Dec 2010 21:30:18 +0100 xd (3.12.0) * XD now requires Bobcat >= 2.09.00, using Bobcat's Mstream objects for message handling * Changed all fnwrap1c calls into fnwrap::unary calls -- Frank B. Brokken Fri, 29 Oct 2010 10:24:43 +0200 xd (3.11.0) * Generalized search didn't recognize plain directories to ignore unless a trailing * was appended. Now fixed. -- Frank B. Brokken Fri, 25 Sep 2009 22:27:31 +0200 xd (3.10.2) * Using compiler option --std=c++0x -- Frank B. Brokken Sun, 30 Aug 2009 11:47:49 +0200 xd (3.10.1) * XD's home directory now at http://xd-home.sourceforge.net/ -- Frank B. Brokken Sat, 28 Mar 2009 10:47:36 +0100 xd (3.10.0) * Implemented Generalized Directory Search (GDS) inserting directory separators at all possible positions of the search string. See the man-page for details. GDS use is optional. xd (3.00.1) * Minor modifications due to changes in Bobcat xd (3.00.0) * Complete rewrite of XD according to current views about C++ * This version is now formally offered to Debian Linux * Implemented 'ignore' and other directives and extended the earlier set of command line options. * Added a man-page. See the man page and xd's usage info shown when the program is started without arguments for details about how to use xd * The default configuration file is now ~/.xdrc * Current configuration defaults are: add-root if-empty directories all start-at home xd (2.13) * Made XD selfsupporting. libicce isn't required anymore. Adapted `build': now uses the -t argument xd (2.11) * Oops, embedded links weren't recognized in 2.10. Now the algorithm is modified so as to compare the inode/device information. What comes first is taken first: it may be the directory link. Apart from that: the same operational functionality as in 2.10. The line 'directories pure' should now be 'directories unique', but it's also the default, so it can safely be omitted. xd (2.10) * Solutions reducing to the same file (e.g., via links) are prevented by default. In order to get all solutions the line 'directories all' must be included in the xd.conf file. xd (2.09) * libicce.a is now containing the NonCanon etc. classes. The formerly used library libcclib.a. This library and the ICString.h, ICError.h, ARG.h, NonCanon.h and ConfigFile.h files (normally in /usr/local/include) can be removed. The functionality of xd has not been changed. xd (2.08) * from the $HOME directory fails. * In xd.conf this may be suppressed by entering a line containing extra no * Alternatively, the extra evaluation may be forced in addition to the standard evaluation (from the $HOME directory) if the line extra always is used in xd.conf * In the distribution, the xd.conf file is now expected in $HOME/.conf/xd/xd.conf * Prior to the compilation, this path may be set by altering XD_CONF_PATH in the file configure.h xd (2.07) * First Linux version. Previous versions were for MS-DOS xd-5.00.02/CLASSES0000644000175000017500000000005614531604165012303 0ustar frankfrankoptions command history alternatives selector xd-5.00.02/command/0000755000175000017500000000000014740701373012701 5ustar frankfrankxd-5.00.02/command/data.cc0000644000175000017500000000041414531604165014117 0ustar frankfrank#include "command.ih" char const *Command::s_action[] = { "FROM_CONFIG", "FROM_HOME", "FROM_ROOT", "FROM_CWD", "FROM_PARENT" }; // separating parts of directory names: char const Command::s_separators[] = "/"; xd-5.00.02/command/command.h0000644000175000017500000000426414531604165014475 0ustar frankfrank#ifndef _INCLUDED_COMMAND_H_ #define _INCLUDED_COMMAND_H_ #include #include // determine the command as received and the kind of action according to // the received pattern. // the pattern is converted to its elements and each element is stored in // an element of the vector base class. E.g., xd 2abc stores a, b, c // and 'xd 3 ab cd ef stores ab, bc and ef. // The initial location character is used to determine the Action. E.g., // 0: FROM_CWD, /: FROM_ROOT, 1..9: FROM_PARENT, .: FROM_HOME // d_arguments contains the individual args, ending in /. // E.g., 2abc -> abc/, 2 ab cd de -> ab/cd/de/ struct Command: public std::vector // stores the elements of the pattern { // modify commanddata.cc if Action is modified enum Action // starting point as determined { // by the first arg-character FROM_CONFIG, // default: determined by config FROM_HOME, FROM_ROOT, FROM_CWD, FROM_PARENT, // relative to CWD }; private: Action d_action; size_t d_parent; int d_homedirChar = '.'; // default homedir char // the selection args, each ending std::string d_arguments; // in / static char const *s_action[]; static char const s_separators[]; // separating parts of nested dir // names public: Command(); std::string const &accumulate() const; // d_arguments size_t parent() const; // FROM_PARENT number Action action() const; // Action type private: void concatArgs(); void determineAction(); void splitBase(); // split [0]'s characters into // separate vector elements }; inline size_t Command::parent() const { return d_parent; } inline Command::Action Command::action() const { return d_action; } inline std::string const &Command::accumulate() const { return d_arguments; } #endif xd-5.00.02/command/README.determineaction0000644000175000017500000000320714531604165016733 0ustar frankfrank// The following table is not maintained, currently. See the manpage for // more up-to-date info. // // ---------------------------------------------------------- // using sub-specifications // (/ and - separate subspecs) // ---------------------------------------------------------- // intention no yes // ---------------------------------------------------------- // from CWD .abc (11) ./a/bc (12) // ./abc // // from $HOME 0abc (21) 0/a/bc (22) // 0. (all .* dirs at $HOME) // // from / /abc (31) /a/bc (32) // / //abc // (/ sitches to the root directory only) // // from cwd's parent # #abc (41) #a/bc (42) // (#: [1-9]) #/abc // // from config abc (51) -abc (51) // (- can be used as a pattern indicator at the 1st position) // ---------------------------------------------------------- // // command[0] determines the initial cell: // 0 indicates from the current directory onward // . indicates subspecifications from $HOME // / indicates from the root // # (#: [1-9]) indicates specifications from parent # // other indicates from $HOME // // any / or - beyond command[0] automatically switches to // sub-specifications (the last / on command is not counted // here, as this one was added by Command() itself. xd-5.00.02/command/icmconf0000777000175000017500000000000014531604165016557 2../icmconf.libustar frankfrankxd-5.00.02/command/command.ih0000644000175000017500000000041514531604165014640 0ustar frankfrank#include "command.h" #include #include #include //#include #include #include #include #include "../options/options.h" using namespace std; using namespace FBB; xd-5.00.02/command/splitbase.cc0000644000175000017500000000060214531604165015173 0ustar frankfrank#include "command.ih" void Command::splitBase() { if (size() != 1) return; for_each( // copy all spec. elements into Command's front().begin() + 1, front().end(), // base object [&](char ch) { push_back(string(1, ch)); } ); front().resize(1); // keep the 1st character } xd-5.00.02/command/determineaction.cc0000644000175000017500000000214614531604165016364 0ustar frankfrank#include "command.ih" void Command::determineAction() { switch (int ch = d_arguments[0]) // Interpret the first character { case '0': // from parent 0 or cwd d_action = FROM_CWD; break; case '/': // explicitly from the root d_action = FROM_ROOT; break; // breaks remove the 1st char from args // start from a parent case '1' ... '9': d_parent = ch - '0'; d_action = FROM_PARENT; break; // other characters: 1st char. of directory or homedir char (~). default: if (ch == d_homedirChar) { d_action = FROM_HOME; break; } d_action = FROM_CONFIG; return; } do d_arguments.erase(0, 1); // remove the 1st (location) character while (d_arguments.front() == '/'); // and a possible initial / sep. imsg << "After removing the initial location/dir character(s): `" << d_arguments << '\'' << endl; } xd-5.00.02/command/concatargs.cc0000644000175000017500000000046014531604165015333 0ustar frankfrank#include "command.ih" void Command::concatArgs() { auto ranger = Options::instance().args(); for (char const *arg: ranger) // all arguments end in / (d_arguments += arg) += '/'; delete[] &*ranger.begin(); imsg << "Arguments: `" << d_arguments << '\'' << endl; } xd-5.00.02/command/command1.cc0000644000175000017500000000264314531604165014713 0ustar frankfrank#include "command.ih" Command::Command() : d_action(FROM_HOME), d_parent(0), d_homedirChar(Options::instance().homedirChar()) { imsg << "\n" "Command\n"; concatArgs(); // concatenate arguments, separating them by / // characters determineAction(); // store the individual arguments in the base class // (string vector) String::split(this, d_arguments, s_separators); // When are the elements of the first argument changed into initial chars // of directory elements? // 1. if there is only one command line argument // 2. if the first argument is not to be interpreted as a name by itself // 3. if there's only one argument // Can't 2 and 3 be combined to: size() == 1 ? // if (!subSpecs && size() && ArgConfig::instance().nArgs() == 1) splitBase(); // split the base class if it contains only // one string. if (ArgConfig::instance().option('V')) { cerr << "Parent nr: " << d_parent << "\n" "Action: " << s_action[d_action] << "\n"; if (empty()) cerr << "No initial directory specifier(s)"; else { cerr << "Initial characters of directories: "; copy(begin(), end(), ostream_iterator(cerr, " ")); } cerr << endl; } } xd-5.00.02/documentation/0000755000175000017500000000000014531604165014133 5ustar frankfrankxd-5.00.02/documentation/kbd/0000755000175000017500000000000014531604165014673 5ustar frankfrankxd-5.00.02/documentation/kbd/writeKBbuffer.cc0000644000175000017500000000631114531604165017744 0ustar frankfrank// modifed 2017/1/8 after // http://www.linuxquestions.org/questions/linux-general-1/ // reading-and-writing-to-the-linux-keyboard-buffer-4175416506/ // dumpkeys -n | \grep '^keycode' | sed // 's/^\w\+\s\+\(\(\S\+\s\+\)\{4\}\).*/\1/' | less #include #include #include // /usr/include/linux/input-event-codes.h #include #define EV_PRESSED 1 #define EV_RELEASED 0 #define EV_REPEAT 2 /* * Purpose: Stuffs the Linux keyboard buffer with a key and * reads it back out of the buffer. * All key definitions can be found in input.h file: * /usr/src/linux-headers-3.2.0-23/include/linux * */ int main() { /************************************************ * IMPORTANT * you need to execute this code as the su or * sudo user in order to open the device properly. ***********************************************/ printf("Starting the keyboard buffer writer/reader \n"); int fd = 0; char const *device = "/dev/input/event0"; // This is the keyboard device as identified using both: $cat /proc/bus/input/devices // and looking in the var/log/Xorg.0.log searching for "keyboard" // Write a key to the keyboard buffer if( (fd = open(device, O_RDWR)) > 0 ) { struct input_event event; printf("The keyboard code is: %d \n", KEY_B); // Note: these are not the same as ASCII codes. // Press a key (stuff the keyboard with a keypress) event.type = EV_KEY; event.value = EV_PRESSED; event.code = KEY_LEFTSHIFT; write(fd, &event, sizeof(struct input_event)); // Press a key (stuff the keyboard with a keypress) event.type = EV_KEY; event.value = EV_PRESSED; event.code = KEY_B; write(fd, &event, sizeof(struct input_event)); // Release the key event.value = EV_RELEASED; event.code = KEY_B; write(fd, &event, sizeof(struct input_event)); // Do it again // Press a key (stuff the keyboard with a keypress) event.type = EV_KEY; event.value = EV_PRESSED; event.code = KEY_B; write(fd, &event, sizeof(struct input_event)); // Release the key event.value = EV_RELEASED; event.code = KEY_B; write(fd, &event, sizeof(struct input_event)); // Press a key (stuff the keyboard with a keypress) event.type = EV_KEY; event.value = EV_PRESSED; event.code = KEY_SLASH; write(fd, &event, sizeof(struct input_event)); // Release the key event.value = EV_RELEASED; event.code = KEY_SLASH; // becomes ? because shift-/ == ? write(fd, &event, sizeof(struct input_event)); // Release the key event.value = EV_RELEASED; event.code = KEY_LEFTSHIFT; write(fd, &event, sizeof(struct input_event)); close(fd); } //// Read the key back from the keyboard buffer //int fd1 = 0; //if( (fd1 = open(device, O_RDONLY)) > 0 ) // It's important to open a new file descriptor here or the program will block. //{ // struct input_event event; // unsigned int scan_code = 0; // // if(event.type != EV_KEY) // return 0; // Keyboard events are always of type EV_KEY // // if(event.value == EV_RELEASED) // { // scan_code = event.code; // printf("read back scan_code is: %d \n", scan_code); // } // close(fd1); //} } xd-5.00.02/documentation/kbd/enterkbd/0000755000175000017500000000000014531604165016471 5ustar frankfrankxd-5.00.02/documentation/kbd/enterkbd/demo.cc0000644000175000017500000000041714531604165017726 0ustar frankfrank// man tty_ioctl #include #include using namespace std; int main() { // string cmd{ "cd /home\nl" }; // for (char ch: cmd) // ioctl(0, TIOCSTI, &ch); ioctl(0, TIOCSTI, "l"); // add an extra s via the kbd to get 'ls' } xd-5.00.02/documentation/kbd/keytab.cc0000644000175000017500000000411514531604165016462 0ustar frankfrank// Enter has keycode 28 #include std::unordered_map chCodes { {'1', 2 }, {'2', 3 }, {'3', 4 }, {'4', 5 }, {'5', 6 }, {'6', 7 }, {'7', 8 }, {'8', 9 }, {'9', 10 }, {'0', 11 }, {'-', 12 }, {'=', 13 }, {'q', 16 }, {'w', 17 }, {'e', 18 }, {'r', 19 }, {'t', 20 }, {'y', 21 }, {'u', 22 }, {'i', 23 }, {'o', 24 }, {'p', 25 }, {'[', 26 }, {']', 27 }, {'a', 30 }, {'s', 31 }, {'d', 32 }, {'f', 33 }, {'g', 34 }, {'h', 35 }, {'j', 36 }, {'k', 37 }, {'l', 38 }, {';', 39 }, {'\'', 40 }, {'`', 41 }, {'\\', 43 }, {'z', 44 }, {'x', 45 }, {'c', 46 }, {'v', 47 }, {'b', 48 }, {'n', 49 }, {'m', 50 }, {',', 51 }, {'.', 52 }, {'/', 53 }, {' ', 57 }, {'!', 64 + 2 }, // & 64 -> shift. keycode is & 63 {'@', 64 + 3 }, {'#', 64 + 4 }, {'$', 64 + 5 }, {'%', 64 + 6 }, {'^', 64 + 7 }, {'&', 64 + 8 }, {'*', 64 + 9 }, {'(', 64 + 10}, {')', 64 + 11}, {'_', 64 + 12}, {'+', 64 + 13}, {'Q', 64 + 16}, {'W', 64 + 17}, {'E', 64 + 18}, {'R', 64 + 19}, {'T', 64 + 20}, {'Y', 64 + 21}, {'U', 64 + 22}, {'I', 64 + 23}, {'O', 64 + 24}, {'P', 64 + 25}, {'{', 64 + 26}, {'}', 64 + 27}, {'A', 64 + 30}, {'S', 64 + 31}, {'D', 64 + 32}, {'F', 64 + 33}, {'G', 64 + 34}, {'H', 64 + 35}, {'J', 64 + 36}, {'K', 64 + 37}, {'L', 64 + 38}, {':', 64 + 39}, {'"', 64 + 40}, {'~', 64 + 41}, {'|', 64 + 43}, {'Z', 64 + 44}, {'X', 64 + 45}, {'C', 64 + 46}, {'V', 64 + 47}, {'B', 64 + 48}, {'N', 64 + 49}, {'M', 64 + 50}, {'<', 64 + 51}, {'>', 64 + 52}, {'?', 64 + 53}, }; xd-5.00.02/documentation/kbd/cdprog.cc0000644000175000017500000001004614531604165016461 0ustar frankfrank// Enter has keycode 28, and is generated from \n #include #include #include #include #include #include #include #include #include #include using namespace std; using namespace chrono; unordered_map chCodes { {'1', 2 }, {'2', 3 }, {'3', 4 }, {'4', 5 }, {'5', 6 }, {'6', 7 }, {'7', 8 }, {'8', 9 }, {'9', 10 }, {'0', 11 }, {'-', 12 }, {'=', 13 }, {'q', 16 }, {'w', 17 }, {'e', 18 }, {'r', 19 }, {'t', 20 }, {'y', 21 }, {'u', 22 }, {'i', 23 }, {'o', 24 }, {'p', 25 }, {'[', 26 }, {']', 27 }, {'\n', 28 }, {'a', 30 }, {'s', 31 }, {'d', 32 }, {'f', 33 }, {'g', 34 }, {'h', 35 }, {'j', 36 }, {'k', 37 }, {'l', 38 }, {';', 39 }, {'\'', 40 }, {'`', 41 }, // L shift key has code 42 {'\\', 43 }, {'z', 44 }, {'x', 45 }, {'c', 46 }, {'v', 47 }, {'b', 48 }, {'n', 49 }, {'m', 50 }, {',', 51 }, {'.', 52 }, {'/', 53 }, {' ', 57 }, {'!', 64 + 2 }, // & 64 -> shift. keycode is & 63 {'@', 64 + 3 }, {'#', 64 + 4 }, {'$', 64 + 5 }, {'%', 64 + 6 }, {'^', 64 + 7 }, {'&', 64 + 8 }, {'*', 64 + 9 }, {'(', 64 + 10}, {')', 64 + 11}, {'_', 64 + 12}, {'+', 64 + 13}, {'Q', 64 + 16}, {'W', 64 + 17}, {'E', 64 + 18}, {'R', 64 + 19}, {'T', 64 + 20}, {'Y', 64 + 21}, {'U', 64 + 22}, {'I', 64 + 23}, {'O', 64 + 24}, {'P', 64 + 25}, {'{', 64 + 26}, {'}', 64 + 27}, {'A', 64 + 30}, {'S', 64 + 31}, {'D', 64 + 32}, {'F', 64 + 33}, {'G', 64 + 34}, {'H', 64 + 35}, {'J', 64 + 36}, {'K', 64 + 37}, {'L', 64 + 38}, {':', 64 + 39}, {'"', 64 + 40}, {'~', 64 + 41}, {'|', 64 + 43}, {'Z', 64 + 44}, {'X', 64 + 45}, {'C', 64 + 46}, {'V', 64 + 47}, {'B', 64 + 48}, {'N', 64 + 49}, {'M', 64 + 50}, {'<', 64 + 51}, {'>', 64 + 52}, {'?', 64 + 53}, }; enum { KEY_RELEASED = 0, KEY_PRESSED = 1, KEY_EVENT = EV_KEY, // from linux/input.h L_SHIFT = KEY_LEFTSHIFT // from linux/input-event-codes.h, // included by linux/input.h }; struct input_event ev = {0, KEY_EVENT}; // time: not used (0), // type: KEY_EVENT int fd; // set to the device's FD void event(int keyCode, int action) { ev.type = EV_KEY; ev.code = keyCode; ev.value = action; write(fd, &ev, sizeof(struct input_event)); } void event(int keyCode) { event(keyCode, KEY_PRESSED); event(keyCode, KEY_RELEASED); } bool shift = false; void insert(int ch) { int keyCode = chCodes[ch]; if (keyCode & 64 and not shift) { shift = true; event(L_SHIFT, KEY_PRESSED); keyCode &= 63; // remove the shift-indicator } else if (not (keyCode & 64) and shift) { shift = false; event(L_SHIFT, KEY_RELEASED); } event(keyCode); } void insert(string const &chars) { for (int ch: chars) insert(ch); } void cdTo(string const &path) { insert("chdir "); insert(path); insert("\n\n"); // this_thread::sleep_for(milliseconds(10)); } int main() try { uid_t uid = getuid(); seteuid(0); fd = open("/dev/input/event0", O_WRONLY); seteuid(uid); if (fd < 0) throw runtime_error("can't open /dev/input/event0"); string str; cout << "enter directory to cd to: "; getline(cin, str); cdTo(str); // cout << '\n'; } catch (exception const &exc) { cout << exc.what() << '\n'; } xd-5.00.02/documentation/man/0000755000175000017500000000000014531604165014706 5ustar frankfrankxd-5.00.02/documentation/man/xd.yo0000644000175000017500000007006514531604165015702 0ustar frankfrankNOUSERMACRO(xd) includefile(../../release.yo) htmlbodyopt(text)(#27408B) htmlbodyopt(bgcolor)(#FFFAF0) whenhtml(mailto(Frank B. Brokken: f.b.brokken@rug.nl)) DEFINEMACRO(lsoption)(3)(\ bf(--ARG1)=tt(ARG3) (bf(-ARG2))\ ) DEFINEMACRO(laoption)(2)(\ bf(--ARG1)=tt(ARG2)\ ) DEFINEMACRO(loption)(1)(\ bf(--ARG1)\ ) DEFINEMACRO(soption)(1)(\ bf(-ARG1)\ ) DELETEMACRO(tt) DEFINEMACRO(tt)(1)(em(ARG1)) COMMENT( man-request, section, date, distribution file, general name) manpage(xd)(1)(_CurYrs_)(xd._CurVers_) (xd - fast directory changes) COMMENT( man-request, larger title ) manpagename(xd)(eXtra fast Directory changer) COMMENT( all other: add after () ) manpagesynopsis() bf(xd) [OPTIONS] tt(arguments) manpagedescription() The program bf(xd) is used to perform e+bf(X)tra fast bf(D)irectory changes. Usually to change a directory the user is required to enter a command like, e.g., tt(cd /usr/local/bin), possibly using shell completion. Often this is a tedious task: shell completion shows all entries, including files, when we're only interested in directories and the full specification of our intented directory may eventually require many keyboard actions. tt(Xd) was designed a long time ago (in the early 90s) to reduce the effort of changing directories. Often we're well aware to which directory we want to change, and it's easy to provide the initial directory characters of that directory. E.g., if the intent is to tt(cd) to tt(/usr/local/bin), it's easy to specify the letters tt(ulb). tt(Xd) capitalizes on this capability. By providing the initial directory characters of directories tt(xd) determines the expansion(s) allowing you to do fast directory changes. So, after entering the command tt(xd ulb) tt(xd) may directly perform the change-directory to tt(/usr/local/bin). Often, however, multiple alternatives can match the specified series of characters. E.g., when entering tt(xd ulb) tt(xd) may find several alternatives, like verb( 1: /usr/lib/base-config 2: /usr/lib/bonobo 3: /usr/lib/bonobo-activation 4: /usr/local/bin ) If these are the alternatives, then this is exactly what tt(xd) shows you. Then, by simply pressing the tt(4) key (em(no) tt(Enter) key required) tt(xd) performs the required tt(/usr/local/bin) (see also the section bf(DIRECT KEY ENTRY)). tt(Xd's) behavior can be fine-tuned in various ways: itemization( it() by default (as specified by the configuration file, see below) tt(xd) looks for expansions starting at the user's home directory or at the system's root directory; it() initial character bf(/): if the first character of the command is tt(/) then all expansions are performed from the system's root directory. E.g., tt(xd /t) produces tt(/tmp) but not tt(/home/user/tmp); it() initial character bf(.): if the first character of the command is tt(.) then by default all expansions are performed from the user's home directory. E.g., tt(xd .t) results in tt(/home/user/tmp) but not in tt(/tmp). The home directory recognition character can be altered using the tt(--homedir-char) option, see below (section bf(OPTIONS)). When merely specifying tt(xd .) then tt(xd) changes the current directory to the user's home directory. it() initial character bf(0): If the first character of the command is tt(0), then all expansions start at the current working directory. When merely specifying tt(xd 0) then tt(xd) returns leaving the current directory unchanged. When additional characters are appended to 0 then this command operates like the following, starting from the current working directory; it() initial character bf(1..9): If the first character of the command is a digit between tt(1) and tt(9) then all expansions start at that parent directory level of the current working directory (up to the system's root directory). E.g., if the current working directory is tt(/usr/share/doc) then tt(xd 2lb) will offer the alternative tt(/usr/local/bin): two steps up, then look for directories starting with tt(l) and therein directories starting with tt(b). When merely specifying one of these characters tt(xd) changes the current directory to the indicated parent, up to the root-directory (e.g., specifying tt(xd 5) at tt(/usr/bin) changes the current directory to the root-directory) it() separators (space, and the forward slash (`tt(/)')): sometimes it is clear that there are many alternatives and the intention is to reduce that number. By using separators subsequently nested directories must start with the characters between the separators. E.g., tt(xd u l bi) doesn't produce the alternative tt(/usr/lib/base-config) anymore, since tt(base-config) does not start with tt(bi). In this case only tt(/usr/local/bin) is produced. When used as initial character in a pattern the forward slash always indicates the root-directory; COMMENT( Separators may be mixed (tt(xd u/l bi) is identical to tt(xd u l bi)). Since the tt(/) can also be used as a root-directory specification, a conflict is implied by a command like tt(xd /u l bi). This conflict is solved by given the initial character a higher precedence than the separator. Using the underscore (_) separator in this case is another way to solve the conflict (which in practice hardly ever occurs). END) it() search patterns may contain dots (like tt(.s)). In such cases the dot represents hidden directories. However, tt(xd) usually also finds patterns containing tt(/./), as the current directory matches the dot. Such patterns are considered spurious and are not reported. ) If there's only one solution, tt(Xd) prepares for a direct directory change to the solution's directory. If there are multiple solutions, then by default lists of at most 62 alternatives (10 for the numbers 0..9, 26 for the letters a..z and 26 for the letters A..Z) are written to the standard error stream from which the user may select an alternative by simply pressing the key associated with the selection of choice. If no selection is requested any other key may be pressed (e.g., the space bar or the tt(Enter) key). If there is no solutioon tt(xd) writes the text tt(No Solutions) to the standard error stream. When tt(xd) is given at least one argument, all its output is sent to the standard error stream, except for the selected directory name which should become the next working directory. tt(Xd) may insert the tt(cd) command directly into the command shell from where tt(xd) was called. See also section bf(SHELL SCRIPTS)). In this mode of operation tt(xd) returns a single dot if no selection is made, preventing an unintended change of directory. If no selection is made or if the selection process is aborted a single dot is written to the standard output stream. Usually tt(xd) will be called by a shell alias, providing the tt(cd) command with tt(xd)'s output (see below at the bf(SHELL SCRIPTS) section) executing tt(cd `xd $*`). The default dot produced by tt(xd) prevents an unintended change of directory. When tt(xd) is merely given an initial directory specification, like a single dot (tt(.)) or digit (a digit in the set tt([0..9])) then tt(xd) returns the implied path. Specifying a parent before the root-directory (E.g., entering `tt(xd 5)' when the current working directory is `tt(/tmp)') results in writing the root directory (`tt(/)') to the standard output stream. If tt(xd) is called without arguments its em(usage) information is written to the standard error stream. tt(Xd) may be further configured using options and a configuration file, discussed in the bf(OPTIONS) and bf(CONFIGURATION FILE) sections below. manpagesection(DIRECT KEY ENTRY) To pass the directory change command to the shell's input buffer bf(xd) calls the function bf(ioctl)(2). That function is still available, although it's also considered a somewhat deprecated function. But even though it's available, by default it may not work. The program bf(sysctl)(8) shows the values of system variables, among which tt(dev.tty.legacy_tiocsti): verb( sysctl -a | grep tiocsti dev.tty.legacy_tiocsti = 0 ) If, at your computer, tt(sysctl) shows tt(dev.tty.legacy_tiocsti = 0) then define a file tt(/etc/sysctl.d/tiocsti.conf) containing the line verb( dev.tty.legacy_tiocsti=1 ) Then, after rebooting tt(ioctl) will work as described in its man-page. Alternatively, a shell script or alias can be defined to pass the command to your shell. E.g., when using the tt(tcsh) shell program the following alias can be defined: verb( alias xd 'cd `\xd --no-input \!*`' ) Or, when using tt(bash), define a function tt(xd) calling, e.g., tt(/usr/bin/xd): verb( xd() { cd `/usr/bin/xd --no-input "$*"` } ) manpagesection(GENERALIZED DIRECTORY SEARCH) tt(Xd) also supports generalized directory search commands (GDS). When GDS is requested separators are no longer required, and tt(xd) finds all possible alternatives resulting from all possible sequential combinations of the initial search command. GDS is activated either by specifying the tt(-g) option or by entering tt(generalized-search) in tt(xd)'s configuration file. Alternatively, when the latter is specified then the tt(--traditional) command line option suppresses GDS. When using GDS each initial substring of the command to tt(xd) is considered as the initial characters of a directory. E.g., if the command tt(xd tmps) is entered using GDS then directories matching the following search patterns will be found; itemization( it() tt(/t*/m*/p*/s*/) it() tt(/t*/m*/ps*/) it() tt(/t*/mp*/s*/) it() tt(/t*/mps*/) it() tt(/tm*/p*/s*/) it() tt(/tm*/ps*/) it() tt(/tmp*/s*/) it() tt(/tmps*/) ) With the traditional processing mode only the first one of these alternative patterns is considered. Multiple command line arguments, the slash, and the underscore can still be used with GDS. In this case they force a directory change using the considered patterns. E.g., with the command tt(xd tm/ps) the following patterns will be considered: itemization( it() tt(/t*/m*/p*/s*/) it() tt(/t*/m*/ps*/) it() tt(/tm*/p*/s*/) it() tt(/tm*/ps*/) ) In this set all of the previous patterns showing the tt(...mp...) combination were dropped, as a directory change is forced between the tt(m) and tt(p) characters. manpagesection(RETURN VALUES) tt(Xd) may return the following values to its caller, allowing scripts calling tt(xd) to make decisions that depend on the actually performed action by tt(xd): itemization( it() 0 is returned if tt(xd) issued a tt(cd) command; it() 1 is returned if tt(xd) received a non-space character, not selecting a directory to change to. When the tt(input) option has been specified this character is inserted into the command shell's input buffer; it() 2 is returned if tt(xd) received a space (or Enter) character, indicating that tt(xd) should perform no further action; it() 3 is returned if no directory was found matching the argument passed to tt(xd); it() 4 is returned if the tt(--help) or tt(--version) option was specified (see their descriptions in the tt(OPTIONS) section); it() 5 is returned if an error was encountered (e.g., when a non-existing configuration file is specified). ) manpageoptions() If available, single letter options are listed between parentheses following their associated long-option variants. Single letter options require arguments if their associated long options require arguments as well. Most options can also be specified in tt(xd's) configuration file, in which case the long option variants must be used, omitting the initial two dashes (see the section tt(CONFIGURATION FILE) below for specific details about the configuration file. By default the options can also be specified in the configuration file. If an option cannot be specifiied in the configuration file it is explicitly stated at its description. Options that are specified as command-line options take priority over options specified in the configuration file. itemization( it() loption(add-root) tt(condition)nl() If the search starts at the user's home directory an additional search starting at the system's root directory may be performed as well, depending on the value specified for the tt(add-root) option. Conditions are quote( itemization( it() tt(never) (no additional search is performed), it() tt(if-empty) (an additional search is performed if the initial search did not yield any directory), it() tt(always) (an additional search is always performed); ) ) it() loption(all) soption(a)nl() If the configuration file (see below) contains tt(ignore) directives then those directives are ignored when computing the alternatives from which the user may select a directory to change to; it() lsoption(block-size)(b)(nr)nl() The possible directories matching tt(xd's) argument are listed in blocks of tt() elements. the possible directories matching tt(xd's) argument are listed in blocks of tt() elements. The built-in minimum block size is 5. If there are fewer alternatives then this built-in minimum then the actually available alternatives are displayed; When alternatives are split up in blocks, a tt(+) is displayed after listing the first block, a tt(-) is displayed after listing the last block, and tt(-+) is displayed after listing the intermediate blocks. In these cases, pressing - redisplays the previous block, pressing + displays the next block; Although these block-end prompts only show - and +, the characters , and < (usually combined in one key) can be used instead of -, while . and > (also usually combined in one key) can be used instead of +. it() lsoption(config-file)(c)(filename)nl() The name of an tt(xd) configuration file. By default tt(xd) looks for the file tt(.xdrc) in the user's home directory. The existence of the default file is optional. This option cannot be specified in the configuration file; it() loption(directories) tt(inclusion)nl() Directories may be also be reached via symbolic links. The (default) inclusion type tt(all) adds these symbolic links to the list of alternatives. The inclusion type tt(unique) prevents symbolic links from being added to the list of alternatives; it() loption(generalized-search) soption(g)nl() When specified tt(xd) uses GDS unless the directive tt(traditional) is specified in the configuration file; it() loption(help) (soption(h))nl() Basic usage information is written to the standard error stream, whereafter tt(xd) terminates. This option cannot be specified in the configuration file; it() loption(homedir-char) tt(ch)nl() By default an initial dot character (`tt(.)') initiates a search from the user's home directory. There is a slight disadvantage to using the dot, as it is also be the initial character of `hidden' directories. Assuming that you have a directory tt(~/.ssh) then the command to xd to that directory would be tt(xd ..s), the first dot being the home directory indicator, after which tt(.s) is used to find tt(.ssh). The option tt(--homedir-char) can be used to specify another character. Homedir characters cannot be digits or a slash (`tt(/)') as these are used to specify, respectively, parent directories and the computer's root directory. Characters like ``tt(, @ % ^)'' or maybe `tt(H)' (assuming that it doesn't interfere with an existing directory beginning with tt(H)) could be used as homedir-characters, other than the default dot character. Caveat: command shells by default interpret characters like ``tt(~ $ \ ' " ` < > |)'' etc., which therefore should probably not be specified as home directory specifiers; it() loption(history) tt([filename])nl() A history of previously made choices is kept in the file tt(filename). If tt(--history) is specified, but the filename is left empty the history file tt($HOME/.xd.his) is used. This file should only be modified by tt(xd) itself. If you can't resist editing it then use the following example showing the format of the lines in the history file. verb( 1292596154 1 /home/frank/svn/xd/ ) The first field is the time (in seconds since the epoch) the entry was written, the second field is the number of times the entry has been selected and the third field is the associated path. The following tt(history-...) options are only interpreted if the tt(history) option is also specified. it() loption(history-lifetime) tt(spec)nl() The lifetime of the entries in the history file. The specification consists of a number followed by tt(D, W, M) or tt(Y), representing, resp. days, weeks, months, or years. A month is considered a period of 30 days, a year a period of 365 days. If the specification is omitted a lifetime of tt(1M) (one month) is used. Entries older than tt(history-lifetime) are disregarded as history-items and are removed from the history file; it() loption(history-maxsize) tt(nr)nl() The maximum number of entries the history file may contain. By default there is no limit. When tt(history-maxsize) is specified and more than the maximum number of history items are found in the history file then the tt(nr) most popular choices are kept. Usually the cut-off point will be somewhere within a popularity category. In that case the most recently selected alternatives within that category are kept; it() loption(history-position) tt([top|bottom])nl() Previously found alternatives are displayed either at the top of the list or at the bottom of the list. If this option is omitted then the elements in the history are intermixed with new alternatives. The next option tt(history-separate) is only used when this option is also specified. By merely specifying tt(history-position) the history items are shown at the top of the list; it() loption(history-separate)nl() When specified a blank line is written between the items in the history and new alternatives (not previously selected). This option is only interpreted when the previous option is also specified; it() loption(icase) soption(i)nl() Specify this option to use case-insensitive pattern matching. E.g., specifying tt(xd /ub) returns the directory tt(/usr/bin), but not a directory like tt(/UnSpecified/Books), which is returned by tt(xd /UB). However, tt(xd -i /ub) (using any letter casing for the specification) returns both directories. The option tt(icase) could of course be specified in the configuration file, which which case case-insensitive matching is used by default. In the latter case specifying tt(-i) as a command line option reverts the matching procedure to case-sensitive directory matching. In general, when an even number of em(icase) specifications is provided tt(xd) uses case-sensitive directory matching, while an odd number of em(icase) specifications results in case-insensitive directory matching; it() bf(ignore) tt(path) nl() This option cannot be specified as command-line option. Instead, the configuration file may contain multiple tt(ignore) directives which are (different from the way other directives are handled) all interpreted. Each tt(ignore) directive is followed by a path specification as shown in a list of alternatives produced by tt(xd) or an initial substring of such a path terminating in a tt(*) character. When tt(xd) encounters a path matching any of the tt(ignore) directives (interpreting the final tt(*) as `any further directory name' specification) it will not display that path in its list of alternatives. This directive is overruled by the tt(---all) command line option; it() loption(input)nl() tt(Xd) itself issues the tt(cd) command for the selected directory to the shell, and enters other (non alternative-selecting characters) into the shell's input. By specifying this option (or by entering tt(input) in the configuration file) an extra shell alias or script is not necessary. In this tt(input) mode tt(xd) directly inserts the requested tt(cd) command into the shell's input buffer. This mode has an additional feature: if a key is pressed that is not assiciated with a possible directory then the current directory is kept, and the character corresponding to the pressed key is entered into the shell's input buffer. E.g., if tt(xd ulb) shows a list of five alternatives, but the tt(L) key is pressed then tt(xd) ends and the shell's input buffer shows tt(l). Merely pressing tt(s) + Enter will then show the current directory content. To merely end tt(xd) in this mode the space bar or Enter key can be pressed; To merely end tt(xd) press the Enter key or space-bar; it() loption(no-input)nl() The tt(no-input) option can only be specified as a command-line option and suppresses the tt(input) option. The tt(no-input) option has no effect if the tt(input) option is not specified. By suppressing the tt(input) mode tt(xd) writes the name of the directory to change to to its standard output stream. This allows shell functions to process the directory returned by tt(xd). An example of its use is the function tt(pxd) (tt(pushd) using tt(xd)) shown in section tt(SHELL SCRIPTS); it() loption(start-at) tt(origin)nl() Defines the default start location of directory searches. Origin tt(home) (the default) results in all default searches to start at the user's home directory. Origin tt(root) results in searches to begin at the disk's root (tt(/)) directory; it() loption(traditional)nl() tt(Xd) does not use GDS but uses its traditional mode. It overrules a tt(generalized-search) directive specified in the configuration file as well as the tt(-g) option; it() loption(verbose) (soption(V))nl() More extensive information about the actions taken by the tt(xd) program is written to the standard error stream. This option cannot be specified in the configuration file; it() loption(version) (soption(v))nl() tt(Xd)'s version number is written to the standard error stream whereafter tt(xd) terminates. This option cannot be specified in the configuration file. ) manpagesection(CONFGURATION FILE) The default configuration file is tt(.xdrc) in the user's home directory. It may be overruled by the program's tt(--config-file) command-line option. Empty lines are ignored. Information at and beyond tt(#)-characters is interpreted as comment and is also ignored. Directives in tt(xd) configuration files follow the pattern verb( directive value ) (for some directives there is no tt(value) term). A line may at most contain one directive, but white space (including comment at the end of the line) is OK. The same directive may be specified multiple times, in which case the em(last) directive will be used (except for the em(ignore) directive, which are all interpreted). All directives are interpreted em(case sensitively) unless option tt(icase) is specified. Non-empty lines not beginning with a recognized directive are silently ignored. manpagesection(SHELL SCRIPTS) Assuming tt(xd) is installed in tt(/usr/bin) scripts can be defined around tt(xd) for various shell programs. This allows the shell to change directories under control of tt(xd). itemization( it() Example 1. To use tt(xd) in combination with the tt(pushd) shell command tt(xd) itself should not perform directory changes. In such cases the tt(no-input) option should be specified in the shell function combining tt(pushd) and tt(xd). To use tt(xd) with the bf(bash)(1)-shell, the following function can be used (which could be added to, e.g., tt(.bash_login)): verb( pxd() # function to do `pushd` using `xd` { pushd "`/usr/bin/xd --no-input $*`" } ) To use tt(xd) with the bf(tcsh)(1)-shell, the following alias can be defined in, e.g., the tt(~/.alias) file: verb( alias pxd 'pushd `\xd --no-input \!*`' ) it() Example 2. If the tt(input) option is specified (as command-line or configuration file option) then this example can be ignored. To use tt(xd) with the bf(bash)(1)-shell, the following function can be used (which could be added to, e.g., tt(.bash_login)): verb( xd() # function to do `cd` using `xd` { cd "`/usr/bin/xd $*`" } ) To use tt(xd) with the bf(tcsh)(1)-shell, the following alias can be defined in, e.g., the tt(~/.alias) file: verb( alias xd 'cd `\xd \!*`' ) Having defined the tt(xd) alias or script tt(xd ...) commands results in the automatic (or optional) change of the current working directory ) If your system uses blanks in directory names, the above tcsh-alias cannot be used as the blanks are interpreted as argument-separaters. In that case the following alias can be defined as the tt(xd) alias: verb( alias xd 'setenv XD "`\xd \!*`";cd "$XD"' ) manpagesection(EXAMPLES) verb( xd ulb - all directories starting subsequently, with u, l and b origin is default, or specified in .xdrc as home or root xd 0t - all directories starting with t below the cwd xd 2t - all directories starting at the `grandparent' (2 steps up) of the cwd xd --start-at root t - all directories at the root starting with t xd .. - all directories starting with a dot in the cwd xd . - the user's home directory xd 0 - the current working directory xd 1 - the current directory's parent directory ) Assuming the following directories exist: verb( /usr/lib/bonobo /usr/lib/bonobo-activation /usr/local/bin ) then the following two tt(ignore) specifications in tt(xd)'s configuration file will result in ignoring the tt(bonobo) directory alternatives: First specification: verb( ignore /usr/lib/bonobo ignore /usr/lib/bonobo-activation ) Second specification: verb( ignore /usr/lib/bonobo* ) manpagefiles() itemization( it() bf($HOME/.xdrc): Default location of the configuration file it() tt(https://fbb-git.gitlab.io/xd/): Home directory ) manpagesection(SEE ALSO) bf(bash)(1), bf(ioctl)(2), bf(sysctl)(8), bf(tcsh)(1) manpagebugs() None reported manpagesection(ABOUT xd) The program tt(xd) was initially (before 1994) written for the MS-DOS platform. In 1994 it was redesigned to work under Unix (Linux, AIX) and it was converted to bf(C++). The original bf(C++) code is still available from tag tt(start) (tt(https://gitlab.com/fbb-git/xd/tags), find the tt(start) tag and download) and is funny to look at as it is a remarkable illustration of bf(C++) code written by bf(C) programmers who had just learned about bf(C++). Versions tt(2.x) were used until 2008, and in late August 2008 I rewrote tt(xd) completely, reflecting my then views about bf(C++), eventually resulting in versions tt(3.x.y) and beyond. The tt(3.x.y) and later versions extensively use the facilities offered by the bf(bobcat)(7) library. manpagesection(ACKNOWLEDGEMENTS) GDS was added to tt(xd) following a suggestion by Bram Neijt (bram at neijt dot nl). manpageauthor() Frank B. Brokken (f.b.brokken@rug.nl). xd-5.00.02/documentation/blockdemo/0000755000175000017500000000000014531604165016072 5ustar frankfrankxd-5.00.02/documentation/blockdemo/demo.cc0000644000175000017500000000333214531604165017326 0ustar frankfrank#include #include using namespace std; enum { MIN_BLOCK_SIZE = 5 }; struct BlockStruct { size_t begin; size_t end; char const *prompt; }; size_t d_blockSize; void set(BlockStruct &dest, size_t end) { dest.begin = end; dest.end = end + d_blockSize; } void set(BlockStruct &preLast, BlockStruct &last) { if (last.end - last.begin >= MIN_BLOCK_SIZE) // last block: big enough return; size_t preSize = (last.end - preLast.begin + 1) / 2; preLast.end = preLast.begin + preSize; last.begin = preLast.end; } void alternativeBlocks(size_t nAlternatives) { // # used blocks size_t nBlocks = (nAlternatives + d_blockSize - 1) / d_blockSize; if (nBlocks == 1) { cout << "only 1 block\n"; return; } vector blocks(nBlocks, {0, 0, "-+" }); blocks.front().prompt = "+"; blocks.front().end = d_blockSize; for (size_t idx = 1, end = blocks.size(); idx != end; ++idx) set(blocks[idx], blocks[idx - 1].end); blocks.back().prompt = "-"; if (blocks.back().end > nAlternatives) // back may not exceed blocks.back().end = nAlternatives; // nAlternatives set(*(blocks.rbegin() + 1), blocks.back()); // inspect the last two sizes for (auto const &block: blocks) cout << block.begin << " to " << block.end << " (" << (block.end - block.begin) << ")" " with " << block.prompt << '\n'; } int main(int argc, char **argv) { while (true) { cout << "nAlternatives blockSize: "; size_t nAlt; cin >> nAlt >> d_blockSize; alternativeBlocks(nAlt); } } xd-5.00.02/enums/0000755000175000017500000000000014531604165012411 5ustar frankfrankxd-5.00.02/enums/enums.h0000644000175000017500000000061214531604165013710 0ustar frankfrank#ifndef INCLUDED_ENUMS_H_ #define INCLUDED_ENUMS_H_ enum TriState // used by Alternatives { NEVER, IF_EMPTY, ALWAYS }; enum Position // used by History { TOP, BOTTOM }; enum Result { NONE, // no solutions DIRECT, // direct CD (one solution) MULTIPLE, // RECEIVED_ALTERNATIVES, }; #endif xd-5.00.02/handle.cc0000644000175000017500000000106414531604165013025 0ustar frankfrank#include "main.ih" int handle(exception_ptr ptr) try { rethrow_exception(ptr); } catch(exception const &err) // handle exceptions { cerr << err.what() << '\n'; // preventa a directory change noInput(); // if --input wasn't specified return Selector::ERROR; } catch(int value) { if (ArgConfig::instance().option("hv")) value = Selector::USAGE; else if (value == Result::NONE) cerr << "No Solutions\n"; noInput(); return value; } xd-5.00.02/history/0000755000175000017500000000000014740701373012764 5ustar frankfrankxd-5.00.02/history/infoopextract.cc0000644000175000017500000000051614531604165016161 0ustar frankfrank#include "history.ih" istream &operator>>(istream &in, History::HistoryInfo &hi) { if (getline(in, hi.path)) { istringstream ins(hi.path); if (ins >> hi.time >> hi.count && getline(ins, hi.path)) hi.path = String::trim(hi.path); else hi.path.clear(); } return in; } xd-5.00.02/history/history.f0000644000175000017500000000202214531604165014627 0ustar frankfrankinline History::HistoryInfo::HistoryInfo(size_t time, size_t count, std::string const &path) : time(time), count(count), path(path) {} inline bool History::find(std::string const &path) const { return findIter(path) != d_history.end(); } inline std::vector::const_iterator History::findIter(std::string const &path) const { return find_if( d_history.begin(), d_history.end(), [&](HistoryInfo const &history) { return history.path == path; } ); } inline Position History::position() const { return d_options.historyPosition(); } inline bool History::rotate() const { return not d_historyFilename.empty() && d_options.historyPosition() == BOTTOM; } inline std::ostream &operator<<(std::ostream &out, History::HistoryInfo const &hi) { return out << hi.time << ' ' << hi.count << ' ' << hi.path; } xd-5.00.02/history/history1.cc0000644000175000017500000000044614531604165015060 0ustar frankfrank#include "history.ih" History::History() : d_options(Options::instance()), d_now(d_options.now()) { imsg << "\n" "History\n"; if (not d_options.history().empty()) { d_historyFilename = d_options.homeDir() + d_options.history(); load(); } } xd-5.00.02/history/comparetimes.cc0000644000175000017500000000025414531604165015763 0ustar frankfrank#include "history.ih" bool History::compareTimes(HistoryInfo const &first, HistoryInfo const &second) { return second.time < first.time; } xd-5.00.02/history/save.cc0000644000175000017500000000223414531604165014231 0ustar frankfrank#include "history.ih" // choice: chosen directory to cd to void History::save(string const &choice) { if (d_historyFilename.empty()) // no history file in use return; ofstream out(d_historyFilename); if (!out) { imsg << "cannot write history file `" << d_historyFilename << '\'' << endl; return; } auto iter = findIter(choice); if (iter == d_history.end()) d_history.push_back(HistoryInfo(d_now, 1, choice)); else { HistoryInfo *info = const_cast(&*iter); ++info->count; info->time = d_now; } sort(d_history.begin(), d_history.end(), compareTimes); // stable_sort(d_history.begin(), d_history.end(), compareCounts); if (size_t maxSize = d_options.historyMaxSize(); maxSize != UINT_MAX) { imsg << "Max. history size: " << maxSize << endl; if (d_history.size() > maxSize) d_history.resize(maxSize); } copy(d_history.begin(), d_history.end(), ostream_iterator(out, "\n")); } xd-5.00.02/history/history.h0000644000175000017500000000342014531604165014634 0ustar frankfrank#ifndef INCLUDED_HISTORY_ #define INCLUDED_HISTORY_ #include #include #include #include #include "../enums/enums.h" #include "../options/options.h" class History { struct HistoryInfo { size_t time; size_t count; std::string path; HistoryInfo() = default; HistoryInfo(size_t time, size_t count, std::string const &path); }; friend std::istream &operator>>(std::istream &in, HistoryInfo &hl); friend std::ostream &operator<<(std::ostream &in, HistoryInfo const &hl); Options const &d_options; std::string d_historyFilename; // name of the history file size_t d_now; // current time std::vector d_history; static char s_defaultHistory[]; public: History(); Position position() const; void setLocation(size_t nInHistory); void save(std::string const &choice); bool rotate() const; // see if a path is in the history bool find(std::string const &path) const; private: std::vector::const_iterator findIter( std::string const &path) const; void load(); static void maybeInsert(HistoryInfo const &historyInfo, std::vector &history, size_t now); static bool compareTimes(HistoryInfo const &first, HistoryInfo const &second); static bool compareCounts(HistoryInfo const &first, HistoryInfo const &second); }; #include "history.f" #endif xd-5.00.02/history/icmconf0000777000175000017500000000000014531604165016642 2../icmconf.libustar frankfrankxd-5.00.02/history/history.ih0000644000175000017500000000023414531604165015005 0ustar frankfrank#include "history.h" #include #include #include #include using namespace std; using namespace FBB; xd-5.00.02/history/comparecounts.cc0000644000175000017500000000046714531604165016163 0ustar frankfrank#include "history.ih" // called from load // true: first < second, smallest elements are put first // return false to put the largest elements first bool History::compareCounts(HistoryInfo const &first, HistoryInfo const &second) { return second.count < first.count; } xd-5.00.02/history/maybeinsert.cc0000644000175000017500000000037714531604165015623 0ustar frankfrank#include "history.ih" void History::maybeInsert(HistoryInfo const &hi, vector &history, size_t oldestTime) { if (hi.path.empty()) return; if (oldestTime <= hi.time) history.push_back(hi); } xd-5.00.02/history/load.cc0000644000175000017500000000101714531604165014210 0ustar frankfrank#include "history.ih" void History::load() { ifstream in{ d_historyFilename }; if (!in) { imsg << "History file `" << d_historyFilename << "' not readable" << endl; return; } imsg << "History file `" << d_historyFilename << '\'' << endl; for_each( istream_iterator(in), istream_iterator(), [&](HistoryInfo const &historyInfo) { maybeInsert(historyInfo, d_history, d_options.historyLifetime()); } ); } xd-5.00.02/icmake/0000755000175000017500000000000014531604165012513 5ustar frankfrankxd-5.00.02/icmake/setopt0000644000175000017500000000033314531604165013753 0ustar frankfrankstring setOpt(string install_im, string envvar) { list optvar; string ret; optvar = getenv(envvar); if (optvar[0] == "1") ret = optvar[1]; else ret = install_im; return ret; } xd-5.00.02/icmake/manpage0000644000175000017500000000066014531604165014050 0ustar frankfrank#define MANPAGE "../../tmp/man/" ${PROJECT} ".1" void manpage() { md("tmp/man tmp/manhtml"); chdir("documentation/man"); if (PROJECT ".yo" younger MANPAGE || "release.yo" younger MANPAGE) { run("yodl2man --no-warnings -o " MANPAGE " " PROJECT); run("yodl2html --no-warnings -o ../../tmp/manhtml/" PROJECT "man.html " PROJECT); } exit(0); } xd-5.00.02/icmake/findall0000644000175000017500000000117314531604165014051 0ustar frankfrank// assuming we're in g_cwd, all entries of type 'type' matching source/pattern // are returned w/o final \n list findAll(string type, string source, string pattern) { string cmd; list entries; list ret; int idx; chdir(source); cmd = "find ./ -mindepth 1 -maxdepth 1 -type " + type; if (pattern != "") pattern = "-name '" + pattern + "'"; entries = backtick(cmd + " " + pattern + " -printf \"%f\\n\""); if (idx > 0 && strlen(entries[0]) > 0) { for (idx = listlen(entries); idx--; ) ret += (list)cutEoln(entries[idx]); } chdir(g_cwd); return ret; } xd-5.00.02/icmake/log0000755000175000017500000000063014531604165013221 0ustar frankfrank#!/bin/bash find tmp/install -type f -exec md5sum "{}" \; | sed 's|tmp/install|'$1'|' > $2 find tmp/install -type l -exec printf "link %s\n" "{}" \; | sed 's|tmp/install|'$1'|' >> $2 find tmp/install -type d -exec printf "dir %s\n" "{}" \; | sed 's|tmp/install|'$1'|' >> $2 xd-5.00.02/icmake/pathfile0000644000175000017500000000054314531604165014234 0ustar frankfranklist path_file(string path) { list ret; int len; int idx; for (len = strlen(path), idx = len; idx--; ) { if (path[idx] == "/") { ret = (list)substr(path, 0, idx) + (list)substr(path, idx + 1, len); return ret; } } ret = (list)"" + (list)path; return ret; } xd-5.00.02/icmake/clean0000644000175000017500000000112714531604165013521 0ustar frankfrankvoid clean(int dist) { run("rm -rf " "build-stamp configure-stamp " "options/SKEL " "tmp/*.o" + " o */o release.yo tmp/lib*.a " "parser/grammar.output" ); if (dist) run("rm -rf tmp *.ih.gch */*.ih.gch"); chdir("documentation"); run("rm -rf " "man/*.1 " "man/*.3* " "man/*.html " "manual/manual-stamp " "manual/*.html " "manual/invoking/usage " "manual/invoking/usage.txt " "usage/usage " ); exit(0); } xd-5.00.02/icmake/uninstall0000644000175000017500000000044714531604165014454 0ustar frankfrankvoid uninstall(string logfile) { int idx; list entry; string dir; list line; if (!exists(logfile)) { printf("installation log file " + logfile + " not found\n"); exit(0); } run("icmake/remove " + logfile + " " + (string)g_echo); exit(0); } xd-5.00.02/icmake/cuteoln0000644000175000017500000000023314531604165014105 0ustar frankfrankstring cutEoln(string text) { int len; len = strlen(text) - 1; if (text[len] == "\n") text = substr(text, 0, len); return text; } xd-5.00.02/icmake/run0000644000175000017500000000032714531604165013244 0ustar frankfrankint g_dryrun = setOpt("", "DRYRUN") != ""; void runP(int testValue, string cmd) { if (g_dryrun) printf(cmd, "\n"); else system(testValue, cmd); } void run(string cmd) { runP(0, cmd); } xd-5.00.02/icmake/md0000644000175000017500000000073314531604165013041 0ustar frankfrank// md: target should be a series of blank-delimited directories to be created // If an element is a whildcard, the directory will always be created, // using mkdir -p. // // uses: run() void md(string target) { int idx; list paths; string dir; if (!exists(target)) run("mkdir -p " + target); else if (((int)stat(target)[0] & S_IFDIR) == 0) { printf(target + " exists, but is not a directory\n"); exit(1); } } xd-5.00.02/icmake/gitlab0000644000175000017500000000021614531604165013677 0ustar frankfrankvoid gitlab() { run("cp -r release.yo tmp/manhtml/xdman.html ../../wip"); run("cp changelog ../../wip/changelog.txt"); exit(0); } xd-5.00.02/icmake/remove0000755000175000017500000000116614531604165013742 0ustar frankfrank#!/bin/bash g_echo=$2 rm_f() { [ $g_echo -ne 0 ] && echo rm $1 rm -f $1 } rm_dir() { [ $g_echo -ne 0 ] && echo rmdir $1 rmdir --ignore-fail-on-non-empty -p $1 } IFS=" " for line in `cat $1` do field1=`echo $line | awk '{printf $1}'` field2=`echo $line | awk '{printf $2}'` if [ $field1 == "link" ] ; then rm_f $field2 elif [ $field1 == "dir" ] ; then rm_dir $field2 elif [ -e "$field2" ] ; then if [ "$field1" != "`md5sum $field2 | awk '{printf $1}'`" ] ; then echo $field2 changed, not removed else rm_f $field2 fi fi done rm_f $1 xd-5.00.02/icmake/backtick0000644000175000017500000000015714531604165014214 0ustar frankfranklist backtick(string arg) { list ret; echo(OFF); ret = `arg`; echo(g_echo); return ret; } xd-5.00.02/icmake/install0000644000175000017500000000331714531604165014110 0ustar frankfrank void install(string request, string dest) { string target; int components = 0; list pathsplit; string base; base = "tmp/install/"; md(base); if (request == "x") components = 63; else { if (strfind(request, "b") != -1) components |= 2; if (strfind(request, "d") != -1) components |= 4; if (strfind(request, "m") != -1) components |= 8; } if (components & 2) { target = base + BINARY; pathsplit = path_file(target); printf(" installing the executable `", target, "'\n"); logFile("tmp/bin", "binary", pathsplit[0], pathsplit[1]); } if (components & (4 | 8)) { target = base + DOC "/"; if (components & 4) { printf(" installing the changelog at `", target, "\n"); logZip("", "changelog", target ); printf(" INSTALLING xdrc at `", target, "\n"); logFile(".", "xdrc", target, ""); } if (components & 8) { printf(" installing the html-manual pages at `", target, "\n"); logInstall("tmp/manhtml", "", target); } } if (components & 8) { target = base + MAN "/"; printf(" installing the manual pages below `", target, "'\n"); logZip("tmp/man", "xd.1", target); } chdir(g_cwd); if (dest == "") dest = "/"; else md(dest); dest = cutEoln(backtick("realpath " + dest)[0]); if (g_logPath != "") backtick("icmake/log " + dest + " " + g_logPath); run("tar cf - -Ctmp/install . | tar xf - -C" + dest); printf("\n Installation completed\n"); exit(0); } xd-5.00.02/icmake/logfile0000644000175000017500000000025714531604165014063 0ustar frankfrankvoid logFile(string srcdir, string src, string destdir, string dest) { chdir(g_cwd); md(destdir); run("cp " + srcdir + "/" + src + " " + destdir + "/" + dest); } xd-5.00.02/icmake/loginstall0000644000175000017500000000166414531604165014615 0ustar frankfrank// source and dest, absolute or reachable from g_cwd, should exist. // files and links in source matching dest (if empty: all) are copied to dest // and are logged in g_log // Before they are logged, dest is created void logInstall(string src, string pattern, string dest) { list entries; int idx; chdir(g_cwd); md(dest); src += "/"; dest += "/"; if (listlen(makelist(O_DIR, src)) == 0) { printf("Warning: ", src, " not found: can't install ", src, pattern, " at ", dest, "\n"); return; } entries = findAll("f", src, pattern); for (idx = listlen(entries); idx--; ) run("cp " + src + entries[idx] + " " + dest); chdir(g_cwd); entries = findAll("l", src, pattern); if (listlen(entries) == 1 && strlen(entries[0]) == 0) return; for (idx = listlen(entries); idx--; ) run("cp " CPOPTS " " + src + entries[idx] + " " + dest); } xd-5.00.02/icmake/special0000644000175000017500000000071214531604165014056 0ustar frankfrank//string g_skel; void special() { // g_skel = setOpt(SKEL, "SKEL"); // // if ("INSTALL.im" newer "options/SKEL") // run("echo \"#define _Skel_ \\\"" + g_skel + "\\\"\" > options/SKEL"); if (! exists("release.yo") || "VERSION" newer "release.yo") { system("touch version.cc"); run("gcc -E VERSION.h | grep -v '#' | sed 's/\\\"//g' > " "release.yo"); } } xd-5.00.02/icmake/logzip0000644000175000017500000000165314531604165013747 0ustar frankfrank// names may be a series of files in src, not a wildcard. // if it's empty then all files in src are used. // the files are gzipped and logged in dest. // src and dest do not have to end in / void logZip(string src, string names, string dest) { list files; int idx; string file; chdir(g_cwd); md(dest); dest += "/"; if (src != "") { if (listlen(makelist(O_DIR, src)) == 0) { printf("Warning: ", src, " not found: can't install ", src, names, " at ", dest, "\n"); return; } chdir(src); } if (names == "") files = makelist("*"); else files = strtok(names, " "); for (idx = listlen(files); idx--; ) { file = files[idx]; run("gzip -n -9 < " + file + " > " + file + ".gz"); } run("tar cf - *.gz | (cd " + g_cwd + "; cd " + dest + "; tar xf -)"); run("rm *.gz"); } xd-5.00.02/icmconf0000644000175000017500000000105014740700736012622 0ustar frankfrank #include "INSTALL.im" #define MULTICOMP "jobs -q" #define SPCH "" #define MAIN "main.cc" #define ADD_LIBRARIES "bobcat" #define ADD_LIBRARY_PATHS "" #define REFRESH #define LIBRARY "modules" #define SHAREDREQ "" #define IH ".ih" //#define CLS #define USE_ALL "a" #define SOURCES "*.cc" #define USE_ECHO ON #define TMP_DIR "tmp" #define OBJ_EXT ".o" #define USE_VERSION #define DEFCOM "program" xd-5.00.02/icmconf.lib0000644000175000017500000000105414531604165013370 0ustar frankfrank//#define CLS #define LIBRARY "modules" #define SOURCES "*.cc" #define OBJ_EXT ".o" #define TMP_DIR "tmp" #define USE_ECHO ON #define IH ".ih" //#define PRECOMP "-x c++-header" //#define USE_ALL "a" #define CXX "g++" #define CXXFLAGS " -Wall -O2 -fdiagnostics-color=never " //#define REFRESH //#define LDFLAGS "-s" #define ADD_LIBRARIES "bobcat" #define ADD_LIBRARY_PATHS "" #define DEFCOM "library" xd-5.00.02/INSTALL0000644000175000017500000001006214531604165012312 0ustar frankfrankTo install xd by hand instead of using a binary distribution perform the following steps: 0. xd and its construction depends, in addition to the normally standard available system software on specific software and versions which is documented in the file `required'. (If you compile the bobcat library yourself, note that xd does not use the SSL, Milter and Xpointer classes; they may --as far as xd is concerned-- be left out of the library by running './build light') 1. It is expected you use icmake for the package construction. For this a top-level script (build) and support scripts in the ./icmake/ directory are available. By default, the 'build' script echoes the commands it executes to the standard output stream. By specifying the option -q (e.g., ./build -q ...) this is prevented, significantly reducing the output generated by 'build'. 2. Inspect the values of the variables in the file INSTALL.im. Modify these when necessary. The default skeleton filenames are compiled into xd through the definitions in options/data.cc. 3. Run ./build program [strip] to compile xd. The argument `strip' is optional and strips symbolic information from the final executable. 4. If you installed Yodl then you can create the documentation: ./build man builds the man-pages, and ./build manual builds the manual. 5. Before installing the components of xd, consider defining the environment variable XD, defining its value as the (preferably absolute) filename of a file on which installed files and directories are logged. Defining the XD environment variable as ~/.xd usually works well. 6. Run (probably as root) ./build install 'what' 'base' to install. Here, 'what' specifies what you want to install. Specify: x, to install all components, or specify a combination of: a (additional documentation), b (binary program), d (standard documentation), m (man-pages) s (skeleton files) u (user guide) E.g., use ./build install bs 'base' if you only want to be able to run bisonc++, and want it to be installed below 'base'. ./build install's last argument 'base' is optional: the base directory below which the requested files are installed. This base directory is prepended to the paths #defined in the INSTALL.im file. If 'base' is not specified, then INSTALL.im's #defined paths are used as-is. When requesting non-existing elements (e.g., ./build install x was requested, but the man-pages weren't constructed) then these non-existing elements are silently ignored by the installation process. If the environment variable BISONCPP was defined when issuing the `./build install ...' command then a log of all installed files is written to the file indicated by the BISONCPP environment variable (see also the next item). Defining the BISONCPP environment variable as ~/.bisoncpp usually works well. 7. Uninstalling previously installed components of Bisonc++ is easy if the environment variable BISONCPP was defined before issuing the `./build install ...' command. In that case, run the command ./build uninstall logfile where 'logfile' is the file that was written by ./build install. Modified files and non-empty directories are not removed, but the logfile itself is removed following the uninstallation. 8. Following the installation nothing in the directory tree which contains this file (i.e., INSTALL) is required for the proper functioning of bisonc++, so consider removing it. If you only want to remove left-over files from the build-process, just run ./build distclean xd-5.00.02/INSTALL.im0000644000175000017500000000100414740701362012711 0ustar frankfrank#define PROJECT "xd" #define CXX "g++" #define CXXFLAGS "-Wall -Werror -O2 -pthread " \ "-fdiagnostics-color=never" #define LDFLAGS "" #define CPOPTS // ONLY USE ABSOLUTE DIRECTORY NAMES: // the final program #define BINARY "/usr/bin/"${PROJECT} // the directory where the standard documentation is stored #define DOC "/usr/share/doc/"${PROJECT} // the directory where the manual page is stored #define MAN "/usr/share/man/man1" xd-5.00.02/LICENSE0000644000175000017500000010451514740701464012277 0ustar frankfrank GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . xd-5.00.02/main.cc0000644000175000017500000000362214740700643012520 0ustar frankfrank#include "main.ih" namespace { ArgConfig::LongOption longOpts[] = { {"add-root", ArgConfig::Required}, {"all", 'a'}, {"block-size", 'b'}, {"config-file", 'c'}, {"directories", ArgConfig::Required}, {"generalized-search", 'g'}, {"help", 'h'}, {"input", ArgConfig::NoArg}, {"history", ArgConfig::Optional}, {"history-lifetime", ArgConfig::Required}, {"history-maxsize", ArgConfig::Required}, // history/load.cc {"history-position", ArgConfig::Required}, // top, bottom {"history-separate", ArgConfig::NoArg}, {"homedir-char", ArgConfig::Required}, {"icase", 'i'}, {"no-input", ArgConfig::NoArg}, {"start-at", ArgConfig::Required}, {"traditional", ArgConfig::NoArg}, {"verbose", 'V'}, {"version", 'v'}, }; auto longEnd = longOpts + size(longOpts); } int main(int argc, char **argv) try { Options::initialize("ab:c:gihvV", longOpts, longEnd, argc, argv, Icmbuild::version, usage); Alternatives alternatives; alternatives.viable(); // viable alternatives or exception alternatives.order(); // history alternatives first or last // the Selector makes the selection Selector selector{ alternatives }; // and inserts the input selector.select(); // make the selection return selector.returnValue(); // 0: cd, 1: input, 2: no solution, // 3: no selection, 4: usage/version // 5: error/auto usage } catch(...) { return handle(current_exception()); } xd-5.00.02/main.ih0000644000175000017500000000071714531604165012535 0ustar frankfrank#include #include #include #include #include #include #include "options/options.h" #include "alternatives/alternatives.h" #include "selector/selector.h" namespace Icmbuild { extern char version[]; extern char year[]; extern char author[]; }; using namespace std; using namespace FBB; int handle(exception_ptr ptr); void noInput(); void usage(string const &progname); xd-5.00.02/noinput.cc0000644000175000017500000000022114531604165013260 0ustar frankfrank#include "main.ih" void noInput() { if (not Options::input()) cout << ".\n"; // prevents a directory change } xd-5.00.02/options/0000755000175000017500000000000014740701373012756 5ustar frankfrankxd-5.00.02/options/find.cc0000644000175000017500000000163214531604165014206 0ustar frankfrank#include "options.ih" size_t Options::find(char const *longOpt, string const *begin, string const *end) { string value; if (d_arg.option(&value, longOpt) == 0) // not specified, use the { // default imsg << "Option or configfile: No key `" << longOpt << '\'' << endl; return end - begin; } auto ret = find_if( begin, end, [&](string const &entry) { return value == entry; } ); if (ret != end) imsg << "Option or config `" << longOpt << ": " << value << '\'' << endl; else imsg << "`" << longOpt << " " << value << "' not supported. Using the default" << endl; return ret - begin; } xd-5.00.02/options/instance.cc0000644000175000017500000000024714531604165015073 0ustar frankfrank#include "options.ih" Options &Options::instance() { if (not s_options) throw Exception{} << "Options not yet initialized"; return *s_options; } xd-5.00.02/options/data.cc0000644000175000017500000000214114531604165014173 0ustar frankfrank#include "options.ih" unique_ptr Options::s_options; bool Options::s_input; char Options::s_defaultConfig[] = ".xdrc"; // in $HOME char Options::s_defaultHistory[] = ".xd.his"; // in $HOME bool Options::s_fromHome[] = // values correspond to { // s_startAt entries true, false, true }; string const Options::s_startAt[] = { "home", "root", "" }; // the last element is used for the default value if // valid alternatives aren't used string const *Options::s_endStartAt = s_startAt + size(s_startAt) - 1; bool Options::s_allDirs[] = { true, false, true }; string const Options::s_dirs[] = { "all", "unique", "" }; string const *Options::s_endDirs = s_dirs + size(s_dirs) - 1; TriState Options::s_addRoot[] = { NEVER, IF_EMPTY, ALWAYS, IF_EMPTY }; string const Options::s_triState[] = { "never", "if-empty", "always", "" }; string const *Options::s_endTriState = s_triState + size(s_triState) - 1; xd-5.00.02/options/sethistorylifetime.cc0000644000175000017500000000167414531604165017230 0ustar frankfrank#include "options.ih" void Options::setHistoryLifetime() { string value; if (not d_arg.option(&value, "history-lifetime")) { d_historyLifetime = d_now - 24 * 60 * 60 * 30; // 1 month lifetime imsg << "History lifetime: 1M" << endl; return; } try { d_historyLifetime = stoul(value); } catch (...) { imsg << "Cannot determine history-lifetime " << value << ", using 1M" << endl; d_historyLifetime = d_now - 24 * 60 * 60 * 30; // 1 month lifetime return; } int lastChar = toupper(*value.rbegin()); imsg << "History lifetime: " << d_historyLifetime << static_cast(lastChar) << endl; d_historyLifetime = d_now - d_historyLifetime * 24 * 60 * 60 * ( lastChar == 'W' ? 7 : lastChar == 'M' ? 30 : lastChar == 'Y' ? 365 : 1 ); } xd-5.00.02/options/gethome.cc0000644000175000017500000000070514531604165014716 0ustar frankfrank#include "options.ih" // static string Options::getHome() { string homeDir; char *cp = getenv("HOME"); // determine the homedir if (!cp) // save it homeDir = '/'; else { homeDir = cp; if (homeDir.back() != '/') // ensure final / at the homedir homeDir += '/'; } imsg << "Home directory: " << homeDir << endl; return homeDir; } xd-5.00.02/options/homedirchar.cc0000644000175000017500000000057614531604165015561 0ustar frankfrank#include "options.ih" int Options::homedirChar() const { string value; if (d_arg.option(&value, "homedir-char") == 0) return '.'; if ("0123456789/"s.find(value.front()) != string::npos) throw Exception{ 1 } << "Character `" << value.front() << "' cannot be used as homedir-character"; return value.front(); } xd-5.00.02/options/setmaxsize.cc0000644000175000017500000000066414531604165015466 0ustar frankfrank#include "options.ih" void Options::setMaxSize() { string value; if (d_arg.option(&value, "history-maxsize")) { d_historyMaxSize = stoul(value); imsg << "History max size: " << d_historyMaxSize << " elements" << endl; } else { d_historyMaxSize = UINT_MAX; imsg << "History max size: none" << endl; } } xd-5.00.02/options/options1.cc0000644000175000017500000000350014531604165015036 0ustar frankfrank#define XERR #include "options.ih" Options::Options(char const *optString, ArgConfig::LongOption const *const begin, ArgConfig::LongOption const *const end, int argc, char **argv, char const *version, void (*usage)(std::string const &)) : d_arg(ArgConfig::initialize(optString, begin, end, argc, argv)), d_now(time(0)), d_separate(d_arg.option(0, "history-separate")) { string_view last{ argv[argc - 1] }; // remove a last / from the last if (last.back() == '/') // argv element argv[argc - 1][last.length() - 1] = 0; d_arg.setCommentHandling(ArgConfig::RemoveComment); imsg.reset(cerr); // mstream messages go to cerr imsg.setActive(d_arg.option('V')); imsg << "\n" "Options\n"; fmsg.reset(cerr); d_homeDir = getHome(); bool noInput = d_arg.option(0, "no-input") != 0; string msg = readConfigFile(); s_input = not noInput and d_arg.option(0, "input") != 0; versionHelp(version, usage); if (not msg.empty()) imsg << msg << endl; if (s_input) imsg << "shell-input a non selection/space character" << endl; else imsg << "xd ends at a non selection/space character" << endl; // true, unless 'start-at root' was specified d_fromHome = s_fromHome[ find("start-at", s_startAt, s_endStartAt) ]; d_allDirs = s_allDirs[ find("directories", s_dirs, s_endDirs) ]; d_addRoot = s_addRoot[ find("add-root", s_triState, s_endTriState) ]; setHistory(); // history filename setMaxSize(); // history max size setHistoryLifetime(); setPosition(); // history position setBlockSize(); } xd-5.00.02/options/setblocksize.cc0000644000175000017500000000031114531604165015760 0ustar frankfrank#include "options.ih" void Options::setBlockSize() { string value; d_blockSize = d_arg.option(&value, 'b') ? stoul(value) : UINT_MAX; imsg << "Block size: " << d_blockSize << endl; } xd-5.00.02/options/sethistory.cc0000644000175000017500000000110314531604165015474 0ustar frankfrank// --history // --------------------------------- // no empty non-empty // default default as spec'd // ---------------------------------- #include "options.ih" void Options::setHistory() // history filename { if (not d_arg.option(&d_history, "history")) { imsg << "History file: not used" << endl; return; } if (d_history.empty()) d_history = s_defaultHistory; // set default history filename imsg << "History file: " << d_history << endl; } xd-5.00.02/options/icmconf0000777000175000017500000000000014531604165016634 2../icmconf.libustar frankfrankxd-5.00.02/options/options.h0000644000175000017500000000753414531604165014632 0ustar frankfrank#ifndef INCLUDED_OPTIONS_ #define INCLUDED_OPTIONS_ #include #include #include #include #include "../enums/enums.h" class Options { FBB::ArgConfig &d_arg; bool d_allDirs; TriState d_addRoot; size_t d_blockSize; bool d_fromHome; std::string d_history; // history filename size_t d_historyLifetime; size_t d_historyMaxSize; Position d_historyPosition; std::string d_homeDir; size_t d_now; bool d_separate; // separate previously made choices from // new ones by a blank line static bool s_input; static char s_defaultConfig[]; static char s_defaultHistory[]; static std::unique_ptr s_options; static bool s_fromHome[]; static std::string const s_startAt[]; static std::string const *s_endStartAt; static bool s_allDirs[]; static std::string const s_dirs[]; static std::string const *s_endDirs; static TriState s_addRoot[]; static std::string const s_triState[]; static std::string const *s_endTriState; public: Options(Options const &other) = delete; static Options &initialize( char const *optString, FBB::ArgConfig::LongOption const *const begin, FBB::ArgConfig::LongOption const *const end, int argc, char **argv, char const *version, void (*usage)(std::string const &) ); static Options &instance(); TriState addRoot() const; // .f bool all() const; // option -a / --all // .f bool allDirs() const; // .f FBB::Ranger args() const; // .f size_t blockSize() const; // .f bool fromHome() const; // .f bool generalized() const; // --generalized-search / -g .f std::string const &history() const; // .f size_t historyLifetime() const; // .f size_t historyMaxSize() const; // .f std::string const &homeDir() const; // .f int homedirChar() const; size_t icase() const; // .f auto ignore() const; // .f static bool input(); // .f size_t now() const; // .f Position historyPosition() const; // .f bool separate() const; // .f bool traditional() const; // --traditional .f std::string const &triStateStr() const; // .f private: Options(char const *optString, FBB::ArgConfig::LongOption const *const begin, FBB::ArgConfig::LongOption const *const end, int argc, char **argv, char const *version, void (*usage)(std::string const &)); size_t find(char const *longOpt, std::string const *begin, std::string const *end); static std::string getHome(); std::string readConfigFile(); // ret. value not empty: imsg void setBlockSize(); void setHistory(); // history filename void setHistoryLifetime(); void setMaxSize(); void setPosition(); void versionHelp(char const *version, void (*usage)(std::string const &)) const; }; #include "options.f" #endif xd-5.00.02/options/options.ih0000644000175000017500000000034114531604165014770 0ustar frankfrank#include "options.h" #include #include #include #include #include #include #include using namespace std; using namespace FBB; xd-5.00.02/options/options.f0000644000175000017500000000271414531604165014623 0ustar frankfrankinline TriState Options::addRoot() const { return d_addRoot; } inline bool Options::all() const { return d_arg.option('a'); } inline bool Options::allDirs() const { return d_allDirs; } inline FBB::Ranger Options::args() const { return FBB::ranger(d_arg.argPointers(), d_arg.nArgs()); } inline size_t Options::blockSize() const { return d_blockSize; } inline bool Options::fromHome() const { return d_fromHome; } inline bool Options::generalized() const { return d_arg.option('g'); } inline size_t Options::historyLifetime() const { return d_historyLifetime; } inline size_t Options::historyMaxSize() const { return d_historyMaxSize; } inline std::string const &Options::history() const { return d_history; } inline std::string const &Options::homeDir() const { return d_homeDir; } inline size_t Options::icase() const { return d_arg.option('i'); } // static inline bool Options::input() { return s_input; } inline auto Options::ignore() const { return d_arg.beginEndRE("^\\s*ignore\\s+\\S+\\s*$"); } inline size_t Options::now() const { return d_now; } inline Position Options::historyPosition() const { return d_historyPosition; } inline bool Options::separate() const { return d_separate; } inline bool Options::traditional() const { return d_arg.option(0, "traditional"); } inline std::string const &Options::triStateStr() const { return s_triState[d_addRoot]; } xd-5.00.02/options/readconfigfile.cc0000644000175000017500000000116614531604165016231 0ustar frankfrank#include "options.ih" string Options::readConfigFile() { string confName; if (d_arg.option(&confName, 'c')) // at -c: read the specified d_arg.open(confName); // configfile else { // otherwise confName = d_homeDir + s_defaultConfig; if (Stat confStat{ confName }; confStat) { if ((not confStat.mode()) & Stat::UR) wmsg << "Can't read " << confName << endl; else d_arg.open(confName); } } return "Configuration file: " + confName; } xd-5.00.02/options/setposition.cc0000644000175000017500000000051314531604165015643 0ustar frankfrank#include "options.ih" void Options::setPosition() { string value; d_historyPosition = d_arg.option(&value, "history-position") && value == "bottom" ? BOTTOM : TOP; imsg << "History elements at the " << (d_historyPosition == TOP ? "top" : "bottom") << endl; } xd-5.00.02/options/initialize.cc0000644000175000017500000000126214531604165015426 0ustar frankfrank#include "options.ih" Options &Options::initialize( char const *optString, ArgConfig::LongOption const *const begin, ArgConfig::LongOption const *const end, int argc, char **argv, char const *version, void (*usage)(string const &) ) { if (s_options) throw Exception{} << "Options already initialized"; s_options = unique_ptr{ new Options{ optString, begin, end, argc, argv, version, usage } }; return *s_options; } xd-5.00.02/options/versionhelp.cc0000644000175000017500000000137114531604165015624 0ustar frankfrank#include "options.ih" void Options::versionHelp(char const *version, void (*usage)(string const &)) const { streambuf *buf = cout.rdbuf(cerr.rdbuf()); // make sure that try // versionHelp doesn't { // write to cout d_arg.versionHelp(usage, version, 1); // need at least 1 arg cout.rdbuf(buf); // insert the help } catch(...) { cout.rdbuf(buf); // missing argument: throw; // help is provided and // ends the program } } xd-5.00.02/README0000644000175000017500000001021414531604165012140 0ustar frankfrank =============================== XD by Frank B. Brokken =============================== Thank you for retrieving XD! ---------------------------- The XD program is a smart directory changer. In cases where you have to change directories, you probably often have enter long commands, like cd /usr/include/c++/4.3/i486-linux-gnu/bits For case like this, xd was developed. XD uses the initial characters of subdirectories to expand them for you. Instead of the above command, a simple xd uic4ib would be enough. The command may seem weird at first, but realize that you know where you wanted to go to: while telling yourself where you want to go to you simply enter the initial character of the directory you mumble to yourself. That's all. The program and its sources is distributed under the terms of the GNU General Public Licence. When xd is started without arguments you get something like: ====================================================================== xd by Frank B. Brokken (f.b.brokken@rug.nl) xd V4.00.00 1994-2022 Usage: xd [options] args Where: [options] - optional arguments (short options and default values between parentheses): --all (-a) - skip `ignore' specification in the configuration file --block-size (-b) size - show the alternatives in blocks of max. 'size' alternatives (spacebar to continue) --config-file (-c) - path to the config file to use ($HOME/.xdrc) --add-root - search expansions from / (if-empty) --directories - which directories to show? (default: all) --generalized-search (-g) - use the GDS mode --help (-h) - provide this help --history - use to store info about choices (no history unless specified) --history-lifetime - specify the max. lifetime of previously made choices. Use [DWMY] for a lifetime of Days, Months, Weeks, or Years --history-position - where to put the previously made choices (TOP, BOTTOM) --history-maxsize - display at most previously made choices --history-separate - separate previously made choices from new ones by a blank line (not with --block-size) --input - a non-selection character ends XD and is entered into the shell's input stream --start-at - where to start the search? (default: home dir.) --traditional - use the traditional mode --version (-v) - show version information and terminate --verbose (-V) - show xd's actions in detail args - arguments, possibly containing directory separators [/-]. xd eXchanges Directories by interpreting the characters of its argument(s) as the initial characters of nested subdirectories. Multiple arguments or arguments separated by / or - define the initial characters of subsequently nested subdirectories. If the first argument starts with . expansion starts at the user's home directory; if it's 0 expansion starts in the current directory; if it's / expansion starts at the root; if it's a number (1 .. 9) expansion starts at parent ; otherwise expansion starts at the location defined by the configuration file When the specification results in multiple solutions, a final selection is requested from a displayed list of alternatives. Use 'man xd' or read the xdrc file provided with the distribution for details about "xd's configuration file ====================================================================== This should help you out to configure xd to your needs. The man-page provides much more information about how to use xd. I hope you find xd useful and will enjoy using it. Frank. xd-5.00.02/replacements0000644000175000017500000000076414531604165013676 0ustar frankfrank#std::__cxx11::basic_string, std::allocator >#std::string# #, std::default_delete## #std::__detail::_Node_iterator >, false, false>#RecordMap::iterator# #, std::hash, std::equal_to, std::allocator >## #[abi:cxx11]## #std::set, std::allocator >#std::set# xd-5.00.02/required0000644000175000017500000000061614531604165013030 0ustar frankfrankThis file lists non-standard software only. Thus, standard utilities like cp, mv, sed, etc, etc, are not explicitly mentioned. Neither is the g++ compiler explicitly mentioned, but a fairly recent one is assumed. Required software for building XD: ---------------------------------- Build-Depends: libbobcat-dev (>= 4.01.03) icmake (>= 8.00.04) yodl (>= 3.06.0) xd-5.00.02/selector/0000755000175000017500000000000014740701373013103 5ustar frankfrankxd-5.00.02/selector/data.cc0000644000175000017500000000037414531604165014326 0ustar frankfrank#include "selector.ih" string Selector::s_allChars{ "123456790" "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" }; string Selector::s_inc{ "+.>" }; string Selector::s_dec{ "-,<" }; xd-5.00.02/selector/accept.cc0000644000175000017500000000071214531604165014650 0ustar frankfrank#include "selector.ih" // alternatives is +.> or -,< // if ch in alternatives, use alternatives.front() for accepted: // accepted is + - or -+ // // static bool Selector::accept(int ch, string const &alternatives, string const &accepted) { return alternatives.find(ch) != string::npos // +.> -,< or both and accepted.find(alternatives.front()) != string::npos; } xd-5.00.02/selector/set1.cc0000644000175000017500000000023614531604165014266 0ustar frankfrank#include "selector.ih" void Selector::set(Block &nextBlok, size_t lastEnd) const { nextBlok.begin = lastEnd; nextBlok.end = lastEnd + d_blockSize; } xd-5.00.02/selector/select.cc0000644000175000017500000000122314531604165014666 0ustar frankfrank#include "selector.ih" void Selector::select() { if (d_direct) chdir(); else { switch (d_alternatives.size()) { case 0: // no alternatives, throw avoids throw static_cast(NO_SOLUTIONS); // updating the history case 1: // one alternative: do the cd imsg << endl; d_index = 0; chdir(); break; default: // otherwise: show all alternatives showAlternatives(); // show the alternatives break; } } } xd-5.00.02/selector/setblocksize.cc0000644000175000017500000000106314531604165016112 0ustar frankfrank#include "selector.ih" void Selector::setBlockSize() { // blockSize cannot exceed the #available // selection chars or the #available // alternatives d_blockSize = Options::instance().blockSize(); if (d_blockSize < MIN_BLOCK_SIZE) d_blockSize = MIN_BLOCK_SIZE; else if (d_blockSize > d_index) d_blockSize = d_index <= s_allChars.size() ? d_index : s_allChars.size(); } xd-5.00.02/selector/set2.cc0000644000175000017500000000050314531604165014264 0ustar frankfrank#include "selector.ih" void Selector::set(Block &beforeLast, Block &last) { if (last.end - last.begin >= MIN_BLOCK_SIZE) // last block: big enough return; size_t beforeSize = (last.end - beforeLast.begin + 1) / 2; beforeLast.end = beforeLast.begin + beforeSize; last.begin = beforeLast.end; } xd-5.00.02/selector/showalternatives.cc0000644000175000017500000000154014531604165017013 0ustar frankfrank#include "selector.ih" void Selector::showAlternatives() { // # used blocks size_t nBlocks = (d_index + d_blockSize - 1) / d_blockSize; if (nBlocks == 1) // one block: { Block block{ 0, d_index, "" }; show(block); // show the alternatives action(block); // and make a selection return; } vector blocks = blockVector(nBlocks); size_t idx = 0; while (true) { show(blocks[idx]); switch (action(blocks[idx])) { case Action::DEC: --idx; break; case Action::INC: ++idx; break; case Action::INPUT: return; } } } xd-5.00.02/selector/show.cc0000644000175000017500000000103314531604165014366 0ustar frankfrank#include "selector.ih" void Selector::show(Block const &block) const { imsg << endl; for ( size_t chIdx = 0, idx = block.begin, separateAt = d_alternatives.separateAt(); idx != block.end; ++idx, ++chIdx ) { if (idx == separateAt) cerr << '\n'; cerr << setw(2) << s_allChars[chIdx] << ": " << d_alternatives[idx] << '\n'; } if (not block.prompt.empty()) cerr << ' ' << block.prompt << '\n'; } xd-5.00.02/selector/chdir.cc0000644000175000017500000000076514531604165014512 0ustar frankfrank#include "selector.ih" void Selector::chdir() { d_returnValue = CD; string const &dir{ d_alternatives[d_index] }; if (d_ioctl) // --input was specified. { imsg << "input: cd " << dir << endl; input("cd " + dir + '\n'); } else { imsg << "direct cout: " << dir << endl; cout << dir << '\n'; } // Alternatives handles the DIRECT d_alternatives.update(d_index); // update } xd-5.00.02/selector/input.cc0000644000175000017500000000040314531604165014545 0ustar frankfrank#include "selector.ih" // static void Selector::input(string const &text) { Tty tty{ Tty::OFF }; for (char ch: text) { if (ioctl(0, TIOCSTI, &ch) == -1) imsg << __FILE__ ": ioctl returned -1: " << errnodescr << endl; } } xd-5.00.02/selector/icmconf0000777000175000017500000000000014531604165016761 2../icmconf.libustar frankfrankxd-5.00.02/selector/selector.ih0000644000175000017500000000042614531604165015246 0ustar frankfrank#include "selector.h" #include #include #include #include #include #include #include "../options/options.h" #include "../alternatives/alternatives.h" using namespace std; using namespace FBB; xd-5.00.02/selector/selector.h0000644000175000017500000000504614531604165015100 0ustar frankfrank#ifndef _SELECTOR_H_ #define _SELECTOR_H_ #include #include #include class Alternatives; struct Selector { enum ReturnValue { CD = 0, COMMAND = 1, NO_SELECTION = 2, NO_SOLUTIONS = 3, USAGE = 4, ERROR = 5 }; private: enum { MIN_BLOCK_SIZE = 5 // # alternatives showed in }; // a block of alternatives enum Action { DEC, INC, INPUT }; struct Block { size_t begin; size_t end; std::string prompt; }; Alternatives &d_alternatives; size_t d_index; // constructor: #alternatives, // at select(): selected alternative size_t d_blockSize; bool d_ioctl; // true: --input was specified bool d_direct; // Alternatives's result == DIRECT ReturnValue d_returnValue; std::string d_selectChars; // d_blockSize substr of s_allChars static std::string s_dec; // chars used to inc. the block-index static std::string s_inc; // chars used to dec. the block-index static std::string s_allChars; // all possible alternative selection // chars. public: Selector(Alternatives &alternatives); void select(); ReturnValue returnValue() const; // .f private: static bool accept(int ch, std::string const &alternatives, std::string const &accepted); Action action(Block const &block); std::vector blockVector(size_t nBlocks); void chdir(); // changes dir to d_alt.[d_index] static void input(std::string const &text); void noCD(int ch); // set bextBlock's begin/end // fields void set(Block &nextBlock, size_t lastEnd) const; // 1 void set(Block &beforeLast, Block &last); // 2 // set the #alternatives shown in void setBlockSize(); // a block void showAlternatives(); void show(Block const &block) const; }; #include "selector.f" #endif xd-5.00.02/selector/selector1.cc0000644000175000017500000000060414531604165015312 0ustar frankfrank#include "selector.ih" Selector::Selector(Alternatives &alternatives) : d_alternatives(alternatives), d_index(d_alternatives.size()), d_ioctl(Options::instance().input()), d_direct(d_alternatives.result() == DIRECT), d_returnValue(ERROR) { imsg << "\n" "Selector" << endl; setBlockSize(); // # alternatives shown in a block } xd-5.00.02/selector/blockvector.cc0000644000175000017500000000111014531604165015717 0ustar frankfrank#include "selector.ih" vector Selector::blockVector(size_t nBlocks) { vector blocks(nBlocks, {0, 0, "-+" }); blocks.front().prompt = "+"; blocks.front().end = d_blockSize; for (size_t idx = 1, end = blocks.size(); idx != end; ++idx) set(blocks[idx], blocks[idx - 1].end); blocks.back().prompt = "-"; if (blocks.back().end > d_index) // back may not exceed blocks.back().end = d_index; // nAlternatives set(*(blocks.rbegin() + 1), blocks.back()); // inspect the last two sizes return blocks; } xd-5.00.02/selector/selector.f0000644000175000017500000000013114531604165015064 0ustar frankfrankinline Selector::ReturnValue Selector::returnValue() const { return d_returnValue; } xd-5.00.02/selector/action.cc0000644000175000017500000000227514531604165014674 0ustar frankfrank#include "selector.ih" Selector::Action Selector::action(Block const &block) { OneKey oneKey; int ch = oneKey.get(); // get the reply imsg << "Selector::action received oneKey " << static_cast(ch) << endl; if (accept(ch, s_inc, block.prompt)) // go to the next block return INC; if (accept(ch, s_dec, block.prompt)) // to the previous block return DEC; string blockChars = s_allChars.substr(0, block.end - block.begin); if (size_t idx = blockChars.find(ch); idx != string::npos) d_index = block.begin + idx; else d_index = block.end; if (isspace(ch)) // change space chars to ' ' ch = ' '; // to prevent extra prompt if (d_index < block.end) // directory was selected chdir(); // chdir to the alt.[d_index] else noCD(ch); // at --input: shell-input // the entered character return Action::INPUT; } xd-5.00.02/selector/nocd.cc0000644000175000017500000000042014531604165014330 0ustar frankfrank#include "selector.ih" void Selector::noCD(int ch) { d_returnValue = ch == ' ' ? NO_SELECTION : COMMAND; if (not d_ioctl) cout << ".\n"; else if (d_returnValue == COMMAND) // --input was specified. input(string{ static_cast(ch) }); } xd-5.00.02/spch0000664000175000017500000000026514740700754012152 0ustar frankfrank#include "main.ih" #include "selector/selector.ih" #include "alternatives/alternatives.ih" #include "history/history.ih" #include "command/command.ih" #include "options/options.ih" xd-5.00.02/usage.cc0000644000175000017500000000622214531604165012677 0ustar frankfrank// usage.cc #include "main.ih" namespace { char const info1[] = R"( [options] args Where: [options] - optional arguments (short options and default values between parentheses): --all (-a) - skip `ignore' specification in the configuration file --block-size (-b) size - show the alternatives in blocks of max. 'size' alternatives (spacebar to continue) --config-file (-c) - path to the config file to use ($HOME/.xdrc) --add-root - search expansions from / (if-empty) --directories - which directories to show? (default: all) --generalized-search (-g) - use the GDS mode --help (-h) - provide this help --history - use to store info about choices (no history unless specified) --history-lifetime - specify the max. lifetime of previously made choices. Use [DWMY] for a lifetime of Days, Months, Weeks, or Years --history-position - where to put the previously made choices (TOP, BOTTOM) --history-maxsize - display at most previously made choices --history-separate - separate previously made choices from new ones by a blank line (not with --block-size) --input - a non-selection character ends XD and is entered into the shell's input stream --start-at - where to start the search? (default: home dir.) --traditional - use the traditional mode --version (-v) - show version information and terminate --verbose (-V) - show )"; char const info2[] = R"('s actions in detail args - arguments, possibly containing directory separators [/-]. )"; char const info3[] = R"( eXchanges Directories by interpreting the characters of its argument(s) as the initial characters of nested subdirectories. Multiple arguments or arguments separated by / or - define the initial characters of subsequently nested subdirectories. If the first argument starts with . expansion starts at the user's home directory; if it's 0 expansion starts in the current directory; if it's / expansion starts at the root; if it's a number (1 .. 9) expansion starts at parent ; otherwise expansion starts at the location defined by the configuration file When the specification results in multiple solutions, a final selection is requested from a displayed list of alternatives. Use 'man xd' or read the xdrc file provided with the distribution for details about ")"; char const info4[] = R"('s configuration file )"; } void usage(std::string const &progname) { cerr << "\n" << progname << " by " << Icmbuild::author << "\n" << progname << " V" << Icmbuild::version << " " << Icmbuild::year << "\n" "\n" "Usage: " << progname << info1 << progname << info2 << progname << info3 << progname << info4; } xd-5.00.02/VERSION0000644000175000017500000000006614740677273012350 0ustar frankfrank#define VERSION "5.00.02" #define YEARS "1994-2025" xd-5.00.02/version.cc0000644000175000017500000000027114740677462013272 0ustar frankfrank#include "main.ih" #include "VERSION" namespace Icmbuild { char version[] = VERSION; char year[] = YEARS; char author[] = "Frank B. Brokken (f.b.brokken@rug.nl)"; } xd-5.00.02/VERSION.h0000644000175000017500000000010414531604165012553 0ustar frankfrank#include "VERSION" SUBST(_CurVers_)(VERSION) SUBST(_CurYrs_)(YEARS) xd-5.00.02/xd.lsm0000644000175000017500000000240214531604165012410 0ustar frankfrankBegin2 Title = XD -- eXchange Directories Version = 2.11 Desc1 = XD is a program with which directory-changes can be Desc2 = easily realized, by providing XD with the initial Desc3 = characters of the diectory path you want to change to. Desc4 = Ambiguities are resolved interactively or explicitly Desc5 = in the directory-specification itself Author = Frank B. Brokken AuthorEmail = frank@icce.rug.nl Maintainer = Frank B. Brokken Site1 = ftp.icce.rug.nl Path1 = pub/unix File1 = xd.2.11.tar.gz FileSize1 = approx. 20 kB Site2 = sunsite.unc.edu Path2 = ?????????? File2 = xd.2.11.tar.gz FileSize2 = approx. 20 kB Site3 = tsx-11.mit.edu Path3 = ?????????? File3 = xd.2.11.tar.gz FileSize2 = approx. 20 kB Required1 = The provided build script is based on icmake, which can be Required2 = obtained from beatrix.icce.rug.nl, sunsite.unc.edu or Required3 = tsx-11.mit.edu. The (sources for the) required library libicce.a Required4 = and its header files are available on ftp.icce.rug.nl, /pub/unix CopyPolicy1 = GPL Keywords = Directory changing Entered = 03MAR95 EnteredBy = Frank B. Brokken CheckedEmail = frank@icce.rug.nl End xd-5.00.02/xdrc0000644000175000017500000001071514531604165012151 0ustar frankfrank# XD configuration file example # Default location used by xd: $HOME/.xdrc # If you don't have a file $HOME/.xdrc and did not specify a configuration # file using the --config-file command line option then program defined # defaults (shown here as well) will be used. # By default directives and values are interpreted case sensitively # When directives are provided repeatedly the last directive will be used # (except for ignore, which are all interpreted) # The commented-out examples show the default specifications or (if # indicated so by extra comment) show the specification format # The add-root directive determines when to perform an additional search # starting from the root (/) directory: # always - an additional search is always performed. # if-empty - an additional search is performed if the initial search # did not yield any directory. # never - no additional search is performed. #add-root if-empty # The 'all' directive suppresses the 'ignore' directives. #all # Not used by default, usually specified as command-line option # The block-size directive specifies the max. number of directory alternatives # that are displayed in a block. #block-size 10 # by default no limit, the 10 used here is an example # The directories directive defines which directives are shown: # all - show all alternatives, including symbolic links (symlinks) # unique - do not show symlinks to directories #directories all # The generalized-search (GDS) on is specified bf(xd) directory separators are # no longer required, and xd finds all posible alternatives resulting from # all possible sequential combinations of the initial search command. # Directory separators are honored when specified, even when # generalized-search is specified. However, they are *required* if # generalized-search is not specified or (same thing) if 'traditional' # is specified. #generalized-search # The homedir-char directive defines the initial specification char used to # specify the user's home-dir #homedir-char . # Specify the name of the history file if a history of previously made # choices most be kept. If only the 'history' directive is specified the # history file is $HOME/.xd.his # The next history directives are only interpreted if the 'history' # directive is specified #history # The lifetime of the entries in the history file. # using D, W, M and Y to represent resp. days, weeks, months, or years. #history-lifetime 1M # The maximum number of entries the history file may contain. #history-maxsize 50 # by default no limit, the 50 used here is an example # Previously found directory alternatives are displayed either # at the top of the list or at the bottom of the list. If omitted then the # elements in the history are intermixed with new alternatives. #history-position top # by default not used, here using 'top' as an example # A blank line is written between the items in the history and new # alternatives (not previously selected). # This option is only interpreted when the previous option is also specified #history-separate # by default not used # The icase option is used to specify case-insensitive pattern matching. By # default case sensitive pattern matching is used. #icase # by default not used # Multiple ignore specifications may be specified. Directories matching the # specification will not show up in the list of alternatives. Specifications # may end in a * #ignore /usr/lib/bonobo* # by default not used: the specification is # provided as an example # The ignore directives (multiple ignore directives are all interpreted) # defines directories that should not appear in alternative # lists. Specifications may end in a final *, indicating that all # directories matching the provided pattern will be ignored. # There is no default. Some examples: # ignore /usr/lib/bonobo/ # ignore /usr/lib/bonobo-activation/ # or, using wildcards: # ignore /usr/lib/bonobo* # Xd itself issues the tt(cd) command for the selected directory to the shell, # and enters other (non alternative-selecting characters) into the shell's # input. #input # by default not used # The start-at directive defines the origin of the search: # home - start the search from the user's home dir. # root - start the search from the root (/) directory. #start-at home # Xd does not use GDS but uses its traditional mode #traditional # by default not used xd-5.00.02/xd.xref0000644000175000017500000005256714531604165012602 0ustar frankfrankoxref by Frank B. Brokken (f.b.brokken@rug.nl) oxref V 2.01.00 2012-2023 CREATED Wed, 29 Nov 2023 09:39:55 +0000 OXREF ARGUMENTS: -r replacements -t main -fxs tmp/libmodules.a tmp/main.o ---------------------------------------------------------------------- CROSS REFERENCE LISTING: accept(int, std::string const&, std::string const&) Full name: Selector::accept(int, std::string const&, std::string const&) Source: accept.cc Used By: action.cc: Selector::action(Selector::Block const&) action(Selector::Block const&) Full name: Selector::action(Selector::Block const&) Source: action.cc Used By: showalternatives.cc: Selector::showAlternatives() add(char const*) Full name: Alternatives::add(char const*) Source: add.cc Used By: inspect.cc: Alternatives::inspect(char const*) addAlternatives(unsigned long*, std::string&, std::string) Full name: Alternatives::addAlternatives(unsigned long*, std::string&, std::string) Source: addalternatives.cc Used By: generalizedalternatives.cc: Alternatives::generalizedAlternatives(std::string const&, std::string&) addIgnored(std::string const&) Full name: Alternatives::addIgnored(std::string const&) Source: addignored.cc Used By: setignored.cc: Alternatives::setIgnored() Alternatives() Full name: Alternatives::Alternatives() Source: alternatives1.cc Used By: main.cc: main author Full name: Icmbuild::author Source: version.cc Used By: usage.cc: usage(std::string const&) blockVector(unsigned long) Full name: Selector::blockVector(unsigned long) Source: blockvector.cc Used By: showalternatives.cc: Selector::showAlternatives() chdir() Full name: Selector::chdir() Source: chdir.cc Used By: action.cc: Selector::action(Selector::Block const&) select.cc: Selector::select() checkCase(unsigned long*, std::string&) Full name: Alternatives::checkCase(unsigned long*, std::string&) Source: checkcase.cc Used By: preparedir.cc: Alternatives::prepareDir(std::string&, unsigned long*, std::string&) Command() Full name: Command::Command() Source: command1.cc Used By: alternatives1.cc: Alternatives::Alternatives() compareTimes(History::HistoryInfo const&, History::HistoryInfo const&) Full name: History::compareTimes(History::HistoryInfo const&, History::HistoryInfo const&) Source: comparetimes.cc Used By: save.cc: History::save(std::string const&) concatArgs() Full name: Command::concatArgs() Source: concatargs.cc Used By: command1.cc: Command::Command() determineAction() Full name: Command::determineAction() Source: determineaction.cc Used By: command1.cc: Command::Command() embeddedDot(std::string const&) const Full name: Alternatives::embeddedDot(std::string const&) const Source: embeddeddot.cc Used By: inspect.cc: Alternatives::inspect(char const*) find(char const*, std::string const*, std::string const*) Full name: Options::find(char const*, std::string const*, std::string const*) Source: find.cc Used By: options1.cc: Options::Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) findAlternatives() Full name: Alternatives::findAlternatives() Source: findalternatives.cc Used By: viable.cc: Alternatives::viable() findDirs() Full name: Alternatives::findDirs() Source: finddirs.cc Used By: findalternatives.cc: Alternatives::findAlternatives() generalizedAlternatives(std::string const&, std::string&) Full name: Alternatives::generalizedAlternatives(std::string const&, std::string&) Source: generalizedalternatives.cc Used By: generalizeddirs.cc: Alternatives::generalizedDirs(std::string const&) globalternatives.cc: Alternatives::globAlternatives(unsigned long, std::string const&, std::string const&) generalizedDirs(std::string const&) Full name: Alternatives::generalizedDirs(std::string const&) Source: generalizeddirs.cc Used By: finddirs.cc: Alternatives::findDirs() getCwd() Full name: Alternatives::getCwd() Source: getcwd.cc Used By: startdir.cc: Alternatives::startDir() getHome() Full name: Options::getHome() Source: gethome.cc Used By: options1.cc: Options::Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) globAlternatives(unsigned long, std::string const&, std::string const&) Full name: Alternatives::globAlternatives(unsigned long, std::string const&, std::string const&) Source: globalternatives.cc Used By: addalternatives.cc: Alternatives::addAlternatives(unsigned long*, std::string&, std::string) handle(std::__exception_ptr::exception_ptr) Full name: handle(std::__exception_ptr::exception_ptr) Source: handle.cc Used By: main.cc: main History() Full name: History::History() Source: history1.cc Used By: alternatives1.cc: Alternatives::Alternatives() homedirChar() const Full name: Options::homedirChar() const Source: homedirchar.cc Used By: command1.cc: Command::Command() initialize(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) Full name: Options::initialize(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) Source: initialize.cc Used By: main.cc: main input(std::string const&) Full name: Selector::input(std::string const&) Source: input.cc Used By: chdir.cc: Selector::chdir() nocd.cc: Selector::noCD(int) inspect(char const*) Full name: Alternatives::inspect(char const*) Source: inspect.cc Used By: globalternatives.cc: Alternatives::globAlternatives(unsigned long, std::string const&, std::string const&) traditionaldirs.cc: Alternatives::traditionalDirs(std::string const&) instance() Full name: Options::instance() Source: instance.cc Used By: command1.cc: Command::Command() concatargs.cc: Command::concatArgs() history1.cc: History::History() alternatives1.cc: Alternatives::Alternatives() checkcase.cc: Alternatives::checkCase(unsigned long*, std::string&) setignored.cc: Alternatives::setIgnored() selector1.cc: Selector::Selector(Alternatives&) setblocksize.cc: Selector::setBlockSize() load() Full name: History::load() Source: load.cc Used By: history1.cc: History::History() matchIgnore(std::string const&, std::string const&) Full name: Alternatives::matchIgnore(std::string const&, std::string const&) Source: matchignore.cc Used By: embeddeddot.cc: Alternatives::embeddedDot(std::string const&) const maybeInsert(History::HistoryInfo const&, std::vector >&, unsigned long) Full name: History::maybeInsert(History::HistoryInfo const&, std::vector >&, unsigned long) Source: maybeinsert.cc Used By: load.cc: History::load() noCD(int) Full name: Selector::noCD(int) Source: nocd.cc Used By: action.cc: Selector::action(Selector::Block const&) noInput() Full name: noInput() Source: noinput.cc Used By: handle.cc: handle(std::__exception_ptr::exception_ptr) operator>>(std::istream&, History::HistoryInfo&) Full name: operator>>(std::istream&, History::HistoryInfo&) Source: infoopextract.cc Used By: load.cc: History::load() operator[](unsigned long) const Full name: Alternatives::operator[](unsigned long) const Source: operatorindex.cc Used By: chdir.cc: Selector::chdir() show.cc: Selector::show(Selector::Block const&) const Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) Full name: Options::Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) Source: options1.cc Used By: initialize.cc: Options::initialize(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) order() Full name: Alternatives::order() Source: order.cc Used By: main.cc: main prepareDir(std::string&, unsigned long*, std::string&) Full name: Alternatives::prepareDir(std::string&, unsigned long*, std::string&) Source: preparedir.cc Used By: addalternatives.cc: Alternatives::addAlternatives(unsigned long*, std::string&, std::string) readConfigFile() Full name: Options::readConfigFile() Source: readconfigfile.cc Used By: options1.cc: Options::Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) s_action Full name: Command::s_action Source: data.cc Used By: command1.cc: Command::Command() s_addRoot Full name: Options::s_addRoot Source: data.cc Used By: options1.cc: Options::Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) s_allChars Full name: Selector::s_allChars Source: data.cc Used By: action.cc: Selector::action(Selector::Block const&) setblocksize.cc: Selector::setBlockSize() show.cc: Selector::show(Selector::Block const&) const s_allDirs Full name: Options::s_allDirs Source: data.cc Used By: options1.cc: Options::Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) s_dec Full name: Selector::s_dec Source: data.cc Used By: action.cc: Selector::action(Selector::Block const&) s_defaultConfig Full name: Options::s_defaultConfig Source: data.cc Used By: readconfigfile.cc: Options::readConfigFile() s_defaultHistory Full name: Options::s_defaultHistory Source: data.cc Used By: sethistory.cc: Options::setHistory() s_dirs Full name: Options::s_dirs Source: data.cc Used By: options1.cc: Options::Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) s_endDirs Full name: Options::s_endDirs Source: data.cc Used By: options1.cc: Options::Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) s_endStartAt Full name: Options::s_endStartAt Source: data.cc Used By: options1.cc: Options::Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) s_endTriState Full name: Options::s_endTriState Source: data.cc Used By: options1.cc: Options::Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) s_fromHome Full name: Options::s_fromHome Source: data.cc Used By: options1.cc: Options::Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) s_inc Full name: Selector::s_inc Source: data.cc Used By: action.cc: Selector::action(Selector::Block const&) s_input Full name: Options::s_input Source: data.cc Used By: noinput.cc: noInput() options1.cc: Options::Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) selector1.cc: Selector::Selector(Alternatives&) s_options Full name: Options::s_options Source: data.cc Used By: initialize.cc: Options::initialize(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) instance.cc: Options::instance() s_separators Full name: Command::s_separators Source: data.cc Used By: command1.cc: Command::Command() s_startAt Full name: Options::s_startAt Source: data.cc Used By: options1.cc: Options::Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) s_triState Full name: Options::s_triState Source: data.cc Used By: options1.cc: Options::Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) viable.cc: Alternatives::viable() save(std::string const&) Full name: History::save(std::string const&) Source: save.cc Used By: chdir.cc: Selector::chdir() select() Full name: Selector::select() Source: select.cc Used By: main.cc: main Selector(Alternatives&) Full name: Selector::Selector(Alternatives&) Source: selector1.cc Used By: main.cc: main separateAt() const Full name: Alternatives::separateAt() const Source: separateat.cc Used By: show.cc: Selector::show(Selector::Block const&) const set(Selector::Block&, Selector::Block&) Full name: Selector::set(Selector::Block&, Selector::Block&) Source: set2.cc Used By: blockvector.cc: Selector::blockVector(unsigned long) set(Selector::Block&, unsigned long) const Full name: Selector::set(Selector::Block&, unsigned long) const Source: set1.cc Used By: blockvector.cc: Selector::blockVector(unsigned long) setBlockSize() Full name: Selector::setBlockSize() Source: setblocksize.cc Used By: selector1.cc: Selector::Selector(Alternatives&) setBlockSize() Full name: Options::setBlockSize() Source: setblocksize.cc Used By: options1.cc: Options::Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) setHistory() Full name: Options::setHistory() Source: sethistory.cc Used By: options1.cc: Options::Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) setHistoryLifetime() Full name: Options::setHistoryLifetime() Source: sethistorylifetime.cc Used By: options1.cc: Options::Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) setIgnored() Full name: Alternatives::setIgnored() Source: setignored.cc Used By: findalternatives.cc: Alternatives::findAlternatives() setMaxSize() Full name: Options::setMaxSize() Source: setmaxsize.cc Used By: options1.cc: Options::Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) setPosition() Full name: Options::setPosition() Source: setposition.cc Used By: options1.cc: Options::Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) show(Selector::Block const&) const Full name: Selector::show(Selector::Block const&) const Source: show.cc Used By: showalternatives.cc: Selector::showAlternatives() showAlternatives() Full name: Selector::showAlternatives() Source: showalternatives.cc Used By: select.cc: Selector::select() splitBase() Full name: Command::splitBase() Source: splitbase.cc Used By: command1.cc: Command::Command() startDir() Full name: Alternatives::startDir() Source: startdir.cc Used By: viable.cc: Alternatives::viable() traditionalDirs(std::string const&) Full name: Alternatives::traditionalDirs(std::string const&) Source: traditionaldirs.cc Used By: finddirs.cc: Alternatives::findDirs() trailingDots(std::string const&) Full name: Alternatives::trailingDots(std::string const&) Source: trailingdots.cc Used By: inspect.cc: Alternatives::inspect(char const*) usage(std::string const&) Full name: usage(std::string const&) Source: usage.cc Used By: main.cc: main version Full name: Icmbuild::version Source: version.cc Used By: usage.cc: usage(std::string const&) main.cc: main versionHelp(char const*, void (*)(std::string const&)) const Full name: Options::versionHelp(char const*, void (*)(std::string const&)) const Source: versionhelp.cc Used By: options1.cc: Options::Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) viable() Full name: Alternatives::viable() Source: viable.cc Used By: main.cc: main year Full name: Icmbuild::year Source: version.cc Used By: usage.cc: usage(std::string const&) ---------------------------------------------------------------------- CALL TREE FOR: main main +-handle(std::__exception_ptr::exception_ptr) | +-noInput() | +-Options::s_input +-usage(std::string const&) | +-Icmbuild::author | +-Icmbuild::version | +-Icmbuild::year +-Icmbuild::version +-Options::initialize(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) | +-Options::s_options | +-Options::Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) | +-Options::s_input | +-Options::s_triState | +-Options::s_startAt | +-Options::s_dirs | +-Options::s_endTriState | +-Options::s_addRoot | +-Options::s_endDirs | +-Options::s_allDirs | +-Options::s_endStartAt | +-Options::s_fromHome | +-Options::find(char const*, std::string const*, std::string const*) | +-Options::getHome() | +-Options::readConfigFile() | | +-Options::s_defaultConfig | +-Options::versionHelp(char const*, void (*)(std::string const&)) const | +-Options::setHistory() | | +-Options::s_defaultHistory | +-Options::setMaxSize() | +-Options::setHistoryLifetime() | +-Options::setPosition() | +-Options::setBlockSize() +-Alternatives::Alternatives() | +-Options::instance() | | +-Options::s_options | +-Command::Command() | | +-Options::homedirChar() const | | +-Options::instance() | | | +-Options::s_options | | +-Command::concatArgs() | | | +-Options::instance() | | | +-Options::s_options | | +-Command::determineAction() | | +-Command::s_separators | | +-Command::splitBase() | | +-Command::s_action | +-History::History() | +-Options::instance() | | +-Options::s_options | +-History::load() | +-operator>>(std::istream&, History::HistoryInfo&) | +-History::maybeInsert(History::HistoryInfo const&, std::vector >&, unsigned long) +-Alternatives::order() +-Alternatives::viable() | +-Options::s_triState | +-Alternatives::findAlternatives() | | +-Alternatives::findDirs() | | | +-Alternatives::traditionalDirs(std::string const&) | | | | +-Alternatives::inspect(char const*) | | | | +-Alternatives::add(char const*) | | | | +-Alternatives::embeddedDot(std::string const&) const | | | | | +-Alternatives::matchIgnore(std::string const&, std::string const&) | | | | +-Alternatives::trailingDots(std::string const&) | | | +-Alternatives::generalizedDirs(std::string const&) | | | +-Alternatives::generalizedAlternatives(std::string const&, std::string&) | | | +-Alternatives::addAlternatives(unsigned long*, std::string&, std::string) | | | +-Alternatives::prepareDir(std::string&, unsigned long*, std::string&) | | | | +-Alternatives::checkCase(unsigned long*, std::string&) | | | | +-Options::instance() | | | | +-Options::s_options | | | +-Alternatives::globAlternatives(unsigned long, std::string const&, std::string const&) | | | +-Alternatives::generalizedAlternatives(std::string const&, std::string&) ==> 5 | | | +-Alternatives::inspect(char const*) | | | +-Alternatives::add(char const*) | | | +-Alternatives::embeddedDot(std::string const&) const | | | | +-Alternatives::matchIgnore(std::string const&, std::string const&) | | | +-Alternatives::trailingDots(std::string const&) | | +-Alternatives::setIgnored() | | +-Options::instance() | | | +-Options::s_options | | +-Alternatives::addIgnored(std::string const&) | +-Alternatives::startDir() | +-Alternatives::getCwd() +-Selector::select() | +-Selector::chdir() | | +-History::save(std::string const&) | | | +-History::compareTimes(History::HistoryInfo const&, History::HistoryInfo const&) | | +-Alternatives::operator[](unsigned long) const | | +-Selector::input(std::string const&) | +-Selector::showAlternatives() | +-Selector::action(Selector::Block const&) | | +-Selector::accept(int, std::string const&, std::string const&) | | +-Selector::s_inc | | +-Selector::s_dec | | +-Selector::s_allChars | | +-Selector::chdir() | | | +-History::save(std::string const&) | | | | +-History::compareTimes(History::HistoryInfo const&, History::HistoryInfo const&) | | | +-Alternatives::operator[](unsigned long) const | | | +-Selector::input(std::string const&) | | +-Selector::noCD(int) | | +-Selector::input(std::string const&) | +-Selector::blockVector(unsigned long) | | +-Selector::set(Selector::Block&, unsigned long) const | | +-Selector::set(Selector::Block&, Selector::Block&) | +-Selector::show(Selector::Block const&) const | +-Alternatives::operator[](unsigned long) const | +-Alternatives::separateAt() const | +-Selector::s_allChars +-Selector::Selector(Alternatives&) +-Options::s_input +-Options::instance() | +-Options::s_options +-Selector::setBlockSize() +-Options::instance() | +-Options::s_options +-Selector::s_allChars