New upstream version 4.00.00
Frank B. Brokken
1 year, 10 months ago
0 | #define PROJECT "xd" | |
0 | #define PROJECT "xd" | |
1 | 1 | #define CXX "g++" |
2 | #define CXXFLAGS "--std=c++2a -fdiagnostics-color=never -Wall -O2 -g" | |
3 | #define LDFLAGS "" | |
2 | #define CXXFLAGS "--std=c++20 -fdiagnostics-color=never -Wall -O2 -g" | |
3 | #define LDFLAGS "" | |
4 | 4 | #define CPOPTS |
5 | 5 | |
6 | 6 | // ONLY USE ABSOLUTE DIRECTORY NAMES: |
0 | Xd is made available under the copyright rules of the Gnu Public License | |
1 | (cf. https://www.gnu.org/licenses/agpl-3.0.html) |
0 | ||
1 | 0 | =============================== |
2 | 1 | XD |
3 | 2 | by |
32 | 31 | |
33 | 32 | ====================================================================== |
34 | 33 | xd by Frank B. Brokken (f.b.brokken@rug.nl) |
35 | xd V3.00.0 1994-2008 | |
34 | xd V4.00.00 1994-2022 | |
36 | 35 | |
37 | 36 | Usage: xd [options] args |
38 | 37 | Where: |
40 | 39 | parentheses): |
41 | 40 | --all (-a) - skip `ignore' specification in the |
42 | 41 | configuration file |
42 | --block-size (-b) size - show the alternatives in blocks of max. | |
43 | 'size' alternatives (spacebar to continue) | |
43 | 44 | --config-file (-c) <file> - path to the config file to use |
44 | 45 | ($HOME/.xdrc) |
45 | --add-root <when> - search expansions from / | |
46 | (if-empty) | |
47 | --directories <which> - which directories to show? | |
48 | (all) | |
46 | --add-root <when> - search expansions from / (if-empty) | |
47 | --directories <which> - which directories to show? (default: all) | |
48 | --generalized-search (-g) - use the GDS mode | |
49 | 49 | --help (-h) - provide this help |
50 | --start-at <origin> - where to start the search? | |
51 | (home) | |
50 | --history <fname> - use <fname> to store info about choices | |
51 | (no history unless specified) | |
52 | --history-lifetime <spec> - specify the max. lifetime of previously made | |
53 | choices. Use <int>[DWMY] for a lifetime of | |
54 | Days, Months, Weeks, or Years | |
55 | --history-position <where = TOP> - where to put the previously made choices | |
56 | (TOP, BOTTOM) | |
57 | --history-maxsize <size = UINT_MAX> - display at most <size> previously | |
58 | made choices | |
59 | --history-separate - separate previously made choices from new ones | |
60 | by a blank line (not with --block-size) | |
61 | --input - a non-selection character ends XD and is entered | |
62 | into the shell's input stream | |
63 | --start-at <origin> - where to start the search? (default: home dir.) | |
64 | --traditional - use the traditional mode | |
52 | 65 | --version (-v) - show version information and terminate |
53 | 66 | --verbose (-V) - show xd's actions in detail |
54 | 67 | args - arguments, possibly containing directory separators [/-]. |
58 | 71 | Multiple arguments or arguments separated by / or - define the |
59 | 72 | initial characters of subsequently nested subdirectories. |
60 | 73 | |
61 | If the first argument starts with . expansion starts at the current | |
62 | directory; if it's 0 expansion starts in the user's home directory; | |
63 | if it's / expansion starts at the root; if it's a number (1 .. 9) | |
74 | If the first argument starts with . expansion starts at the user's | |
75 | home directory; if it's 0 expansion starts in the current directory; | |
76 | if it's / expansion starts at the root; if it's a number (1 .. 9) | |
64 | 77 | expansion starts at parent <number>; otherwise expansion starts |
65 | 78 | at the location defined by the configuration file |
66 | 79 | |
68 | 81 | selection is requested from a displayed list of alternatives. |
69 | 82 | |
70 | 83 | Use 'man xd' or read the xdrc file provided with the distribution |
71 | for details about xd's configuration file | |
84 | for details about "xd's configuration file | |
72 | 85 | ====================================================================== |
73 | 86 | |
74 | 87 |
0 | #define VERSION "3.29.02" | |
1 | #define YEARS "1994-2021" | |
0 | #define VERSION "4.00.00" | |
1 | #define YEARS "1994-2022" |
6 | 6 | #include <string> |
7 | 7 | #include <memory> |
8 | 8 | |
9 | ||
9 | #include "../enums/enums.h" | |
10 | 10 | #include "../command/command.h" |
11 | 11 | #include "../history/history.h" |
12 | ||
13 | namespace FBB | |
14 | { | |
15 | class ArgConfig; | |
16 | } | |
17 | 12 | |
18 | 13 | |
19 | 14 | // If, when looking for /t*/m*/ps*/ the initial path /t*/m* does not exist |
23 | 18 | // subpatterns of the pruned path (e.g., t*/mp*) are not considered (and so: |
24 | 19 | // not globbed) |
25 | 20 | |
21 | class Options; | |
26 | 22 | |
27 | 23 | class Alternatives: public std::deque<std::string> |
28 | 24 | { |
29 | std::string d_homeDir; | |
30 | FBB::ArgConfig &d_arg; | |
31 | bool d_separate; | |
32 | size_t d_nInHistory; | |
25 | Options const &d_options; | |
33 | 26 | |
34 | bool d_home; // true: search from $HOME | |
35 | bool d_dirs; // true: search all dirs (also via links) | |
27 | size_t d_nInHistory; // nr of items in the history | |
36 | 28 | |
29 | bool d_fromHome; // true: search from $HOME | |
30 | bool d_allDirs; // true: search all dirs (also via links) | |
31 | TriState d_addRoot; // true: always also search /, ifEmpty: only if | |
32 | // search from $HOME fails | |
37 | 33 | |
38 | enum TriState | |
39 | { | |
40 | FALSE, | |
41 | IF_EMPTY, | |
42 | TRUE | |
43 | }; | |
34 | Command d_command; | |
35 | History d_history; // history constructor uses Options | |
44 | 36 | |
45 | TriState d_addRoot; // true: always also search /, ifEmpty: only if | |
46 | // search from $HOME fails | |
47 | Command d_command; | |
48 | History d_history; | |
49 | ||
50 | static char const *s_triState[]; | |
51 | static char const *const *const s_triStateEnd; | |
52 | ||
53 | static char const *s_startAt[]; | |
54 | static char const * const *const s_startAtEnd; | |
55 | ||
56 | static char const *s_dirs[]; | |
57 | static char const *const *const s_dirsEnd; | |
58 | ||
59 | static char const *s_merge[]; | |
60 | static char const *const *const s_mergeEnd; | |
61 | ||
62 | static char s_defaultConfig[]; | |
37 | // static char const *s_merge[]; | |
38 | // static char const *const *const s_mergeEnd; | |
63 | 39 | |
64 | 40 | public: |
65 | 41 | enum ViableResult |
68 | 44 | RECEIVED_ALTERNATIVES, |
69 | 45 | }; |
70 | 46 | |
71 | Alternatives(); | |
47 | Alternatives(); // uses default | |
48 | ||
72 | 49 | ViableResult viable(); |
73 | 50 | void order(); |
74 | 51 | void update(size_t idx); |
76 | 53 | size_t separateAt() const; |
77 | 54 | |
78 | 55 | private: |
79 | static std::string getHome(); | |
80 | ||
81 | FBB::ArgConfig &configFile(); | |
82 | ||
83 | size_t set(char const *longKey, char const *const * const begin, | |
84 | char const *const *const end, | |
85 | size_t notFound); | |
86 | ||
87 | 56 | void getCwd(std::unique_ptr<char> *dest); |
88 | 57 | |
89 | 58 | std::string determineInitialDirectory(); |
114 | 83 | static void addIgnored(std::string const &line, |
115 | 84 | std::set<std::string> &ignoreSet); |
116 | 85 | |
86 | static bool dotPattern(std::string const &dirEntry, | |
87 | GlobContext const &globContext); | |
88 | ||
117 | 89 | static bool matchIgnore(std::string const &ignore, |
118 | 90 | std::string const &entry); |
91 | ||
92 | static bool trailingDotPatterns(std::string const &spec); | |
119 | 93 | }; |
120 | 94 | |
121 | 95 | inline void Alternatives::update(size_t index) |
2 | 2 | #include <sstream> |
3 | 3 | #include <algorithm> |
4 | 4 | #include <exception> |
5 | ||
5 | 6 | #include <bobcat/mstream> |
6 | 7 | #include <bobcat/glob> |
7 | 8 | #include <bobcat/stat> |
8 | #include <bobcat/argconfig> | |
9 | 9 | #include <bobcat/ranger> |
10 | ||
11 | #include "../options/options.h" | |
10 | 12 | |
11 | 13 | using namespace std; |
12 | 14 | using namespace FBB; |
1 | 1 | |
2 | 2 | Alternatives::Alternatives() |
3 | 3 | : |
4 | d_homeDir(getHome()), | |
5 | d_arg(configFile()), | |
6 | d_separate(d_arg.option(0, "history-separate")), | |
4 | d_options(Options::instance()), | |
7 | 5 | d_nInHistory(0), |
8 | d_history(d_arg, d_homeDir) | |
6 | d_fromHome(d_options.fromHome()), | |
7 | d_allDirs(d_options.allDirs()), | |
8 | d_addRoot(d_options.addRoot()) | |
9 | 9 | {} |
1 | 1 | |
2 | 2 | void Alternatives::checkCase(string &head, size_t *idx) const |
3 | 3 | { |
4 | if ((d_arg.option('i') & 1) != 0) // even number of --icase specs | |
4 | if ((d_options.icase() & 1) != 0) // even number of --icase specs | |
5 | 5 | { |
6 | 6 | string mold("[..]"); |
7 | 7 | int ch = head[*idx]; |
13 | 13 | *idx += 4; |
14 | 14 | return; |
15 | 15 | } |
16 | } | |
16 | } | |
17 | 17 | ++*idx; |
18 | 18 | } |
0 | #include "alternatives.ih" | |
1 | ||
2 | ArgConfig &Alternatives::configFile() | |
3 | { | |
4 | ArgConfig &arg = ArgConfig::instance(); | |
5 | ||
6 | string confName; | |
7 | if (arg.option(&confName, 'c')) | |
8 | arg.open(confName); | |
9 | else | |
10 | { | |
11 | confName = d_homeDir + s_defaultConfig; | |
12 | Stat confStat(confName); | |
13 | if (confStat) | |
14 | { | |
15 | if ((not confStat.mode()) & Stat::UR) | |
16 | wmsg << "Can't read " << confName << endl; | |
17 | else | |
18 | arg.open(confName); | |
19 | } | |
20 | } | |
21 | imsg << "Configuration file: " << confName << endl; | |
22 | ||
23 | return arg; | |
24 | } |
0 | #include "alternatives.ih" | |
1 | ||
2 | char const *Alternatives::s_merge[] = | |
3 | { | |
4 | "false", | |
5 | "true" | |
6 | }; | |
7 | char const *const *const Alternatives::s_mergeEnd = | |
8 | s_triState + sizeof(s_merge) / sizeof(char *); | |
9 | ||
10 | ||
11 | char const *Alternatives::s_triState[] = | |
12 | { | |
13 | "never", | |
14 | "if-empty", | |
15 | "always" | |
16 | }; | |
17 | ||
18 | char const *const *const Alternatives::s_triStateEnd = | |
19 | s_triState + sizeof(s_triState) / sizeof(char *); | |
20 | ||
21 | ||
22 | char const *Alternatives::s_startAt[] = | |
23 | { | |
24 | "root", | |
25 | "home", | |
26 | }; | |
27 | ||
28 | char const *const *const Alternatives::s_startAtEnd = | |
29 | s_startAt + sizeof(s_startAt) / sizeof(char *); | |
30 | ||
31 | ||
32 | char const *Alternatives::s_dirs[] = | |
33 | { | |
34 | "unique", | |
35 | "all", | |
36 | }; | |
37 | ||
38 | char const *const *const Alternatives::s_dirsEnd = | |
39 | s_dirs + sizeof(s_dirs) / sizeof(char *); | |
40 | ||
41 | ||
42 | char Alternatives::s_defaultConfig[] = ".xdrc"; // in $HOME | |
0 | //#include "alternatives.ih" | |
1 | // | |
2 | //char const *Alternatives::s_merge[] = | |
3 | //{ | |
4 | // "false", | |
5 | // "true" | |
6 | //}; | |
7 | //char const *const *const Alternatives::s_mergeEnd = | |
8 | // s_triState + sizeof(s_merge) / sizeof(char *); |
8 | 8 | switch (d_command.action()) |
9 | 9 | { |
10 | 10 | case Command::FROM_CONFIG: |
11 | cwd = d_home ? d_homeDir : string("/"); | |
11 | cwd = d_fromHome ? d_options.homeDir() : string("/"); | |
12 | 12 | rescan = true; |
13 | 13 | break; |
14 | 14 | |
15 | 15 | case Command::FROM_HOME: |
16 | cwd = d_homeDir; | |
16 | cwd = d_options.homeDir(); | |
17 | 17 | break; |
18 | 18 | |
19 | 19 | case Command::FROM_ROOT: |
39 | 39 | break; |
40 | 40 | } |
41 | 41 | |
42 | if (d_addRoot != FALSE && (!d_home || !rescan)) | |
42 | if (d_addRoot != NEVER and (!d_fromHome || !rescan)) | |
43 | 43 | { |
44 | 44 | imsg << "Search does not start at the home dir: " |
45 | 45 | "no additional search from the root" << endl; |
46 | 46 | |
47 | d_addRoot = FALSE; | |
47 | d_addRoot = NEVER; | |
48 | 48 | } |
49 | 49 | |
50 | 50 | imsg << "Resolved Cwd as: " << cwd << endl; |
0 | #include "alternatives.ih" | |
1 | ||
2 | // static | |
3 | bool Alternatives::dotPattern(string const &dirEntry, | |
4 | GlobContext const &context) | |
5 | { | |
6 | if (dirEntry.find("/./") != string::npos // ignore */./* patterns | |
7 | or | |
8 | find_if( | |
9 | context.ignore.begin(), context.ignore.end(), | |
10 | [&](string const &ignore) | |
11 | { | |
12 | return matchIgnore(ignore, dirEntry); | |
13 | } | |
14 | ) | |
15 | != context.ignore.end() | |
16 | ) | |
17 | { | |
18 | imsg << "ignored" << endl; | |
19 | return true; | |
20 | } | |
21 | ||
22 | return false; | |
23 | } |
14 | 14 | searchCmd.resize(searchCmd.length() - 1); // remove trailing / |
15 | 15 | |
16 | 16 | |
17 | imsg << "Merged search command: `" << searchCmd << "'\n" | |
18 | "Starts at `" << initial << '\'' << endl; | |
17 | if (searchCmd.empty()) | |
18 | imsg << "No merged search command\n"; | |
19 | else | |
20 | imsg << "Merged search command: `" << searchCmd << "'\n"; | |
21 | ||
22 | imsg << "Searching starts at `" << initial << '\'' << endl; | |
19 | 23 | |
20 | 24 | globHead(initial, searchCmd, context); |
21 | 25 |
0 | #include "alternatives.ih" | |
1 | ||
2 | string Alternatives::getHome() | |
3 | { | |
4 | string homeDir; | |
5 | ||
6 | char *cp = getenv("HOME"); // determine the homedir | |
7 | ||
8 | if (!cp) // save it | |
9 | homeDir = '/'; | |
10 | else | |
11 | { | |
12 | homeDir = cp; | |
13 | if (*homeDir.rbegin() != '/') | |
14 | homeDir += '/'; | |
15 | } | |
16 | // home set with ending / | |
17 | ||
18 | imsg << "Home directory: " << homeDir << endl; | |
19 | ||
20 | return homeDir; | |
21 | } |
0 | 0 | #include "alternatives.ih" |
1 | 1 | |
2 | // static | |
2 | 3 | void Alternatives::globFilter(char const *entry, GlobContext &context) |
3 | 4 | { |
4 | 5 | imsg << "Inspecting `" << entry << "': "; |
5 | 6 | // if a trailing / was removed reinstall it. |
6 | 7 | string dirEntry(entry); |
7 | if (*dirEntry.rbegin() != '/') | |
8 | if (dirEntry.back() != '/') | |
8 | 9 | dirEntry += '/'; |
9 | 10 | |
10 | 11 | if ( |
11 | dirEntry.find("/./") != string::npos // ignore */./* patterns | |
12 | dotPattern(dirEntry, context) | |
12 | 13 | or |
13 | find_if( | |
14 | context.ignore.begin(), context.ignore.end(), | |
15 | [&](std::string const &ignore) | |
16 | { | |
17 | return matchIgnore(ignore, dirEntry); | |
18 | } | |
19 | ) | |
20 | != context.ignore.end() | |
14 | trailingDotPatterns(entry) | |
21 | 15 | ) |
22 | { | |
23 | imsg << "ignored" << endl; | |
24 | 16 | return; |
25 | } | |
26 | 17 | |
27 | string spec = entry; | |
28 | ||
29 | if // ignore the . nd .. directories | |
30 | ( | |
31 | spec.rfind("/.") == spec.length() - 2 || | |
32 | spec.rfind("/..") == spec.length() - 3 | |
33 | ) | |
34 | { | |
35 | imsg << "dot-directory" << endl; | |
36 | return; | |
37 | } | |
38 | ||
39 | Stat stat(entry); | |
18 | Stat stat{ entry }; | |
40 | 19 | |
41 | 20 | // check if the entry name (globbed) is equal to the true path name |
42 | 21 | // if not, the globbed name is a link to the true path |
43 | if (!context.alternatives.d_dirs && stat.path() != spec) | |
22 | if (not context.alternatives.d_allDirs && stat.path() != entry) | |
44 | 23 | { |
45 | 24 | imsg << "symlink" << endl; |
46 | 25 | return; |
3 | 3 | { |
4 | 4 | GlobContext context = {*this}; |
5 | 5 | |
6 | if (not d_arg.option('a')) | |
6 | if (not d_options.all()) | |
7 | 7 | { |
8 | auto iters = d_arg.beginEndRE("^\\s*ignore\\s+\\S+\\s*$"); | |
9 | ||
10 | for (auto &line: ranger(iters.first, iters.second)) | |
11 | addIgnored(line, context.ignore); | |
8 | for | |
9 | ( | |
10 | auto iters = d_options.ignore(); | |
11 | auto &line: ranger(iters.first, iters.second) | |
12 | ) | |
13 | addIgnored(line, context.ignore); | |
12 | 14 | } |
13 | 15 | |
14 | 16 | ViableResult (Alternatives::*globFun)(string dir, GlobContext &context) = |
15 | d_arg.option('g') && !d_arg.option(0, "traditional") ? | |
16 | &Alternatives::generalizedGlob | |
17 | : | |
18 | &Alternatives::glob; | |
17 | ( | |
18 | d_options.generalized() and not d_options.traditional() ? | |
19 | &Alternatives::generalizedGlob | |
20 | : | |
21 | &Alternatives::glob | |
22 | ); | |
19 | 23 | |
20 | 24 | ViableResult vr = (this->*globFun)(initial, context); |
21 | 25 | |
22 | if (d_addRoot == TRUE || (size() == 0 && d_addRoot == IF_EMPTY)) | |
26 | if (d_addRoot == ALWAYS || (size() == 0 && d_addRoot == IF_EMPTY)) | |
23 | 27 | vr = (this->*globFun)("/", context); |
24 | 28 | |
25 | 29 | if (vr == ONLY_CD) |
27 | 31 | |
28 | 32 | return vr; |
29 | 33 | } |
34 | ||
35 | ||
36 | ||
37 |
0 | ../icmconf.lib⏎ |
0 | 0 | #include "alternatives.ih" |
1 | 1 | |
2 | bool Alternatives::matchIgnore(std::string const &ignore, string const &entry) | |
2 | // static | |
3 | bool Alternatives::matchIgnore(string const &ignore, string const &entry) | |
3 | 4 | { |
4 | 5 | // returns true if entry matches an ignore string |
5 | 6 | return |
6 | *ignore.rbegin() != '*' ? // literal match required | |
7 | ignore.back() != '*' ? // literal match required | |
7 | 8 | ignore == entry |
8 | 9 | : // wildcard match of final * OK |
9 | 10 | entry.find(ignore.substr(0, ignore.length() - 1)) == 0; |
1 | 1 | |
2 | 2 | size_t Alternatives::separateAt() const |
3 | 3 | { |
4 | if (not d_separate || d_nInHistory == size()) | |
4 | if (not d_options.separate() || d_nInHistory == size()) | |
5 | 5 | return UINT_MAX; |
6 | 6 | |
7 | return | |
8 | d_history.position() == History::TOP ? | |
9 | d_nInHistory | |
10 | : | |
11 | size() - d_nInHistory; | |
7 | return d_history.position() == TOP ? d_nInHistory : size() - d_nInHistory; | |
12 | 8 | } |
0 | #include "alternatives.ih" | |
1 | ||
2 | size_t Alternatives::set(char const *longKey, | |
3 | char const *const *const begin, | |
4 | char const *const *const end, | |
5 | size_t notFound) | |
6 | { | |
7 | string conf; | |
8 | ||
9 | if (!d_arg.option(&conf, longKey)) | |
10 | { | |
11 | imsg << "Option or config: No key `" << longKey << '\'' << endl; | |
12 | return notFound; | |
13 | } | |
14 | ||
15 | char const *const *const ret = | |
16 | find_if(begin, end, bind2nd(equal_to<string>(), conf)); | |
17 | ||
18 | if (ret != end) | |
19 | { | |
20 | imsg << "Option or config `" << longKey << " " << conf << "' found" << | |
21 | endl; | |
22 | ||
23 | return ret - begin; | |
24 | } | |
25 | ||
26 | imsg << "`" << longKey << " " << conf << | |
27 | "' not supported. Using the default `" << begin[notFound] << | |
28 | "'." << endl; | |
29 | ||
30 | return notFound; | |
31 | } |
0 | #include "alternatives.ih" | |
1 | ||
2 | // static | |
3 | bool Alternatives::trailingDotPatterns(string const &spec) | |
4 | { | |
5 | if // ignore trailing . and .. directories | |
6 | ( | |
7 | spec.rfind("/.") == spec.length() - 2 | |
8 | or | |
9 | spec.rfind("/..") == spec.length() - 3 | |
10 | ) | |
11 | { | |
12 | imsg << "dot-directory" << endl; | |
13 | return true; | |
14 | } | |
15 | ||
16 | return false; | |
17 | } |
1 | 1 | |
2 | 2 | Alternatives::ViableResult Alternatives::viable() |
3 | 3 | { |
4 | d_home = set("start-at", s_startAt, s_startAtEnd, 1); | |
5 | d_dirs = set("directories", s_dirs, s_dirsEnd, 1); | |
6 | d_addRoot = static_cast<TriState> | |
7 | (set("add-root", s_triState, s_triStateEnd, IF_EMPTY)); | |
8 | ||
9 | imsg << boolalpha << "Search from $HOME: " << d_home << '\n' << | |
10 | "Search all directories: " << d_dirs << '\n' << | |
4 | imsg << boolalpha << "Search from $HOME: " << d_fromHome << '\n' << | |
5 | "Search all directories: " << d_allDirs << '\n' << | |
11 | 6 | "Add root search if search from $HOME fails: " << |
12 | s_triState[d_addRoot] << endl; | |
7 | d_options.triStateStr() << endl; | |
13 | 8 | |
14 | 9 | if (globFrom(determineInitialDirectory()) == ONLY_CD) |
15 | 10 | return ONLY_CD; |
0 | #include "main.ih" // program header file | |
1 | ||
2 | namespace // the anonymous namespace can be used here | |
3 | { | |
4 | ArgConfig::LongOption longOptions[] = | |
5 | { | |
6 | {"add-root", ArgConfig::Required}, | |
7 | {"directories", ArgConfig::Required}, | |
8 | {"homedir-char", ArgConfig::Required}, | |
9 | {"start-at", ArgConfig::Required}, | |
10 | ||
11 | {"history", ArgConfig::Optional}, | |
12 | {"history-lifetime", ArgConfig::Required}, | |
13 | {"history-maxsize", ArgConfig::Required}, // history/load.cc | |
14 | {"history-separate", ArgConfig::None}, | |
15 | {"history-position", ArgConfig::Required}, // top, bottom | |
16 | ||
17 | {"traditional", ArgConfig::None}, | |
18 | ||
19 | {"all", 'a'}, | |
20 | {"config-file", 'c'}, | |
21 | {"help", 'h'}, | |
22 | {"icase", 'i'}, | |
23 | {"generalized-search", 'g'}, | |
24 | {"version", 'v'}, | |
25 | {"verbose", 'V'}, | |
26 | }; | |
27 | ||
28 | ArgConfig::LongOption const *const longEnd = | |
29 | longOptions + | |
30 | sizeof(longOptions) / sizeof(ArgConfig::LongOption); | |
31 | } | |
32 | ||
33 | void arguments(int argc, char **argv) | |
34 | { | |
35 | char *last = argv[argc - 1]; // remove the / from the last | |
36 | size_t idx = strlen(last) - 1; // cmd line argument | |
37 | if (last[idx] == '/') | |
38 | last[idx] = 0; | |
39 | ||
40 | ArgConfig &arg = ArgConfig::initialize("ac:gihvV", | |
41 | longOptions, longEnd, argc, argv); | |
42 | arg.setCommentHandling(ArgConfig::RemoveComment); | |
43 | ||
44 | streambuf *buf = cout.rdbuf(cerr.rdbuf()); // make sure that | |
45 | try // versionHelp doesn't | |
46 | { // write to cout | |
47 | arg.versionHelp(usage, Icmbuild::version, 1); | |
48 | cout.rdbuf(buf); | |
49 | } | |
50 | catch(...) | |
51 | { | |
52 | cout.rdbuf(buf); | |
53 | throw; | |
54 | } | |
55 | ||
56 | imsg.reset(cerr); | |
57 | imsg.setActive(arg.option('V')); | |
58 | ||
59 | fmsg.reset(cerr); | |
60 | } |
97 | 97 | { |
98 | 98 | precompileHeaders(); |
99 | 99 | system("icmbuild program " + strip); |
100 | run("oxref -fxs tmp/lib" LIBRARY ".a > " PROJECT ".xref"); | |
100 | run("oxref -r replacements -t main -fxs tmp/lib" | |
101 | LIBRARY ".a tmp/main.o > " PROJECT ".xref"); | |
101 | 102 | exit(0); |
102 | 103 | } |
103 | 104 |
0 | xd (4.00.00) | |
1 | ||
2 | * Added option --input allowing xd to directly perform cd-commands and | |
3 | to insert non-selection characters into the shell's input buffer. | |
4 | ||
5 | * Added option --block-size to show alternative cd-directories in blocks of | |
6 | fixed maximum sizes. | |
7 | ||
8 | * Added the file LICENSE.txt specifying XD's (GPL) copyright rules. | |
9 | ||
10 | * Updated the man-page. | |
11 | ||
12 | * Updated the xdrc demo configuration file. | |
13 | ||
14 | * Updated the xd.xref cross-reference listing. | |
15 | ||
16 | * Added class Options to handle the options/configuration file. | |
17 | ||
18 | * The class Filter was renamed to Selector. | |
19 | ||
20 | -- Frank B. Brokken <f.b.brokken@rug.nl> Sun, 19 Jun 2022 12:50:49 +0200 | |
21 | ||
0 | 22 | xd (3.29.02) |
1 | 23 | |
2 | 24 | * Repaired flaw in icmake/finall: it now checks for 'backtick' returning a |
3 | 25 | single, empty element. |
4 | 26 | |
27 | -- Frank B. Brokken <f.b.brokken@rug.nl> Tue, 07 Sep 2021 18:43:12 +0200 | |
28 | ||
5 | 29 | xd (3.29.01) |
6 | 30 | |
7 | 31 | * Removed -q from xd's build script |
6 | 6 | // determine the command as received and the kind of action according to |
7 | 7 | // the received pattern. |
8 | 8 | |
9 | class Command: public std::vector<std::string> | |
9 | struct Command: public std::vector<std::string> | |
10 | 10 | // stores the elements of the pattern |
11 | 11 | { |
12 | int d_homedirChar = '.'; // default homedir char | |
13 | std::string d_arguments; | |
14 | static char const *s_action[]; | |
15 | static char const s_separators[]; // separating parts of nested dir | |
16 | // names | |
17 | public: | |
18 | // modify commanddata.cc if Action is modified | |
19 | enum Action // starting point as determined | |
20 | { // by the first arg-character | |
21 | FROM_CONFIG, // default: determined by config | |
22 | FROM_HOME, | |
23 | FROM_ROOT, | |
24 | FROM_CWD, | |
25 | FROM_PARENT, // relative to CWD | |
26 | }; | |
12 | // modify commanddata.cc if Action is modified | |
13 | enum Action // starting point as determined | |
14 | { // by the first arg-character | |
15 | FROM_CONFIG, // default: determined by config | |
16 | FROM_HOME, | |
17 | FROM_ROOT, | |
18 | FROM_CWD, | |
19 | FROM_PARENT, // relative to CWD | |
20 | }; | |
27 | 21 | |
28 | 22 | private: |
29 | 23 | Action d_action; |
30 | 24 | size_t d_parent; |
31 | 25 | |
26 | int d_homedirChar = '.'; // default homedir char | |
27 | std::string d_arguments; | |
28 | ||
29 | static char const *s_action[]; | |
30 | static char const s_separators[]; // separating parts of nested dir | |
31 | // names | |
32 | 32 | public: |
33 | 33 | Command(); |
34 | 34 | |
39 | 39 | private: |
40 | 40 | void concatArgs(); |
41 | 41 | void determineAction(); |
42 | void splitBase(); // split [0]'s characters into | |
43 | // separate vector elements | |
42 | 44 | }; |
43 | 45 | |
44 | 46 | inline size_t Command::parent() const |
3 | 3 | #include <algorithm> |
4 | 4 | #include <iterator> |
5 | 5 | |
6 | #include <bobcat/argconfig> | |
6 | //#include <bobcat/argconfig> | |
7 | 7 | #include <bobcat/string> |
8 | 8 | #include <bobcat/mstream> |
9 | 9 | #include <bobcat/exception> |
10 | 10 | |
11 | #include "../options/options.h" | |
12 | ||
11 | 13 | using namespace std; |
12 | 14 | using namespace FBB; |
2 | 2 | Command::Command() |
3 | 3 | : |
4 | 4 | d_action(FROM_HOME), |
5 | d_parent(0) | |
5 | d_parent(0), | |
6 | d_homedirChar(Options::instance().homedirChar()) | |
6 | 7 | { |
7 | ArgConfig &argConfig = ArgConfig::instance(); | |
8 | ||
9 | if (string value; argConfig.option(&value, "homedir-char")) | |
10 | { | |
11 | d_homedirChar = value[0]; | |
12 | if ("0123456789/"s.find(d_homedirChar) != string::npos) | |
13 | throw Exception{ 1 } << "Character `" << value[0] << | |
14 | "' cannot be used as homedir-character"; | |
15 | } | |
16 | ||
17 | concatArgs(); | |
8 | concatArgs(); // concatenate arguments, separating them by / | |
9 | // characters | |
18 | 10 | |
19 | 11 | determineAction(); |
20 | 12 | |
13 | // store the individual arguments in the base class | |
14 | // (string vector) | |
21 | 15 | String::split(this, d_arguments, s_separators); |
22 | 16 | |
23 | 17 | // When are the elements of the first argument changed into initial chars |
28 | 22 | // Can't 2 and 3 be combined to: size() == 1 ? |
29 | 23 | // if (!subSpecs && size() && ArgConfig::instance().nArgs() == 1) |
30 | 24 | |
31 | if (size() == 1) | |
32 | { | |
33 | for_each( | |
34 | front().begin() + 1, front().end(), | |
35 | [&](char ch) | |
36 | { | |
37 | this->push_back(string(1, ch)); | |
38 | } | |
39 | ); | |
40 | front().resize(1); | |
41 | } | |
25 | splitBase(); // split the base class if it contains only | |
26 | // one string. | |
42 | 27 | |
43 | 28 | if (ArgConfig::instance().option('V')) |
44 | 29 | { |
49 | 34 | cerr << endl; |
50 | 35 | } |
51 | 36 | } |
37 | ||
38 | ||
39 | ||
40 | ||
41 | ||
42 | ||
43 | ||
44 | ||
45 | ||
46 | ||
47 |
1 | 1 | |
2 | 2 | void Command::concatArgs() |
3 | 3 | { |
4 | ArgConfig &arg = ArgConfig::instance(); | |
5 | ||
6 | for_each( | |
7 | arg.argPointers(), arg.argPointers() + arg.nArgs(), | |
8 | [&](char const *arg) | |
9 | { | |
10 | (d_arguments += arg) += '/'; | |
11 | } | |
12 | ); | |
4 | for(char const *arg: Options::instance().args()) | |
5 | (d_arguments += arg) += '/'; | |
13 | 6 | |
14 | 7 | imsg << "Arguments: `" << d_arguments << '\'' << endl; |
15 | 8 | } |
0 | ../icmconf.lib⏎ |
0 | #include "command.ih" | |
1 | ||
2 | void Command::splitBase() | |
3 | { | |
4 | if (size() != 1) | |
5 | return; | |
6 | ||
7 | for_each( // copy all spec. elements into Command's | |
8 | front().begin() + 1, front().end(), // base object | |
9 | [&](char ch) | |
10 | { | |
11 | push_back(string(1, ch)); | |
12 | } | |
13 | ); | |
14 | ||
15 | front().resize(1); // keep the 1st character | |
16 | } |
0 | #include <iostream> | |
1 | #include <vector> | |
2 | ||
3 | using namespace std; | |
4 | ||
5 | ||
6 | enum | |
7 | { | |
8 | MIN_BLOCK_SIZE = 5 | |
9 | }; | |
10 | ||
11 | struct BlockStruct | |
12 | { | |
13 | size_t begin; | |
14 | size_t end; | |
15 | char const *prompt; | |
16 | }; | |
17 | ||
18 | ||
19 | size_t d_blockSize; | |
20 | ||
21 | void set(BlockStruct &dest, size_t end) | |
22 | { | |
23 | dest.begin = end; | |
24 | dest.end = end + d_blockSize; | |
25 | } | |
26 | ||
27 | void set(BlockStruct &preLast, BlockStruct &last) | |
28 | { | |
29 | if (last.end - last.begin >= MIN_BLOCK_SIZE) // last block: big enough | |
30 | return; | |
31 | ||
32 | size_t preSize = (last.end - preLast.begin + 1) / 2; | |
33 | ||
34 | preLast.end = preLast.begin + preSize; | |
35 | last.begin = preLast.end; | |
36 | } | |
37 | ||
38 | void alternativeBlocks(size_t nAlternatives) | |
39 | { | |
40 | // # used blocks | |
41 | size_t nBlocks = (nAlternatives + d_blockSize - 1) / d_blockSize; | |
42 | ||
43 | if (nBlocks == 1) | |
44 | { | |
45 | cout << "only 1 block\n"; | |
46 | return; | |
47 | } | |
48 | ||
49 | vector<BlockStruct> blocks(nBlocks, {0, 0, "-+" }); | |
50 | ||
51 | blocks.front().prompt = "+"; | |
52 | blocks.front().end = d_blockSize; | |
53 | ||
54 | for (size_t idx = 1, end = blocks.size(); idx != end; ++idx) | |
55 | set(blocks[idx], blocks[idx - 1].end); | |
56 | ||
57 | blocks.back().prompt = "-"; | |
58 | ||
59 | if (blocks.back().end > nAlternatives) // back may not exceed | |
60 | blocks.back().end = nAlternatives; // nAlternatives | |
61 | ||
62 | set(*(blocks.rbegin() + 1), blocks.back()); // inspect the last two sizes | |
63 | ||
64 | ||
65 | for (auto const &block: blocks) | |
66 | cout << block.begin << " to " << block.end << | |
67 | " (" << (block.end - block.begin) << ")" | |
68 | " with " << block.prompt << '\n'; | |
69 | ||
70 | } | |
71 | ||
72 | ||
73 | int main(int argc, char **argv) | |
74 | { | |
75 | while (true) | |
76 | { | |
77 | cout << "nAlternatives blockSize: "; | |
78 | size_t nAlt; | |
79 | cin >> nAlt >> d_blockSize; | |
80 | ||
81 | alternativeBlocks(nAlt); | |
82 | } | |
83 | } |
157 | 157 | { |
158 | 158 | shift = true; |
159 | 159 | event(L_SHIFT, KEY_PRESSED); |
160 | keyCode & 63; // remove the shift-indicator | |
160 | keyCode &= 63; // remove the shift-indicator | |
161 | 161 | } |
162 | 162 | else if (not (keyCode & 64) and shift) |
163 | 163 | { |
0 | // man tty_ioctl | |
1 | ||
2 | #include <sys/ioctl.h> | |
3 | #include <string> | |
4 | ||
5 | using namespace std; | |
6 | ||
7 | int main() | |
8 | { | |
9 | // string cmd{ "cd /home\nl" }; | |
10 | // for (char ch: cmd) | |
11 | // ioctl(0, TIOCSTI, &ch); | |
12 | ||
13 | ioctl(0, TIOCSTI, "l"); // add an extra s via the kbd to get 'ls' | |
14 | } |
37 | 37 | |
38 | 38 | The program bf(xd) is used to perform e+bf(X)tra fast bf(D)irectory |
39 | 39 | changes. Usually to change a directory the user is required to enter a command |
40 | like, e.g., tt(cd /usr/local/bin), possibly with the aid of shell | |
41 | completion. In many cases this is a tedious task: shell completion shows all | |
42 | entries, including files, when we're only interested in directories and the | |
43 | full specification of our intented directory may eventually require many | |
44 | keyboard actions. | |
40 | like, e.g., tt(cd /usr/local/bin), possibly using shell completion. Often this | |
41 | is a tedious task: shell completion shows all entries, including files, when | |
42 | we're only interested in directories and the full specification of our | |
43 | intented directory may eventually require many keyboard actions. | |
44 | ||
45 | Note: tt(xd) version 4.00.00 introduces several new modes of operation: | |
46 | see section tt(VERSION 4.00.00) for details. | |
45 | 47 | |
46 | 48 | tt(Xd) was designed a long time ago (in the early 90s) to reduce the |
47 | 49 | effort of changing directories. Often we're well aware to which directory we |
48 | want to change, and it's easy to produce the initial directory characters of | |
50 | want to change, and it's easy to provide the initial directory characters of | |
49 | 51 | that directory. E.g., if the intent is to tt(cd) to tt(/usr/local/bin), |
50 | it's quite easy to produce the letters tt(ulb). | |
52 | it's easy to specify the letters tt(ulb). | |
51 | 53 | |
52 | 54 | tt(Xd) capitalizes on this capability. By providing the initial directory |
53 | characters of directories tt(xd) determines the proper expansion allowing you | |
54 | to change directories fast. So, entering the command tt(xd ulb) results in the | |
55 | expansion tt(/usr/local/bin). | |
56 | ||
57 | Often life is not that easy. Often there are multiple expansions from a | |
58 | given set of initial characters. E.g., when entering tt(xd ulb) tt(xd) may | |
59 | find several alternatives. E.g., | |
55 | characters of directories tt(xd) determines the expansion(s) allowing you to | |
56 | do fast directory changes. So, after entering the command tt(xd ulb) | |
57 | tt(xd) may directly perform the change-directory to tt(/usr/local/bin). | |
58 | ||
59 | Often, however, multiple alternatives can match the specified series of | |
60 | characters. E.g., when entering tt(xd ulb) tt(xd) may find several | |
61 | alternatives, like | |
60 | 62 | verb( |
61 | 63 | 1: /usr/lib/base-config |
62 | 64 | 2: /usr/lib/bonobo |
63 | 65 | 3: /usr/lib/bonobo-activation |
64 | 66 | 4: /usr/local/bin |
65 | 67 | ) |
66 | If these are the alternatives, this is exactly what tt(xd) will show | |
67 | you. Then, by simply pressing the tt(3) key (em(no) tt(Enter) key required) | |
68 | tt(xd) will produce the required tt(/usr/local/bin). | |
69 | ||
70 | Commands to tt(xd) can be specified so as to fine-tune tt(xd)'s behavior: | |
68 | If these are the alternatives, then this is exactly what tt(xd) shows | |
69 | you. Then, by simply pressing the tt(4) key (em(no) tt(Enter) key required) | |
70 | tt(xd) performs the required tt(/usr/local/bin). | |
71 | ||
72 | tt(Xd's) behavious can be fine-tuned in various ways: | |
71 | 73 | itemization( |
72 | it() By default (as specified by the configuration file, see below) | |
73 | expansions may start at the user's home directory or at the system's root | |
74 | directory. | |
75 | it() Initial character bf(/): If the first character of the command is | |
74 | it() by default (as specified by the configuration file, see below) tt(xd) | |
75 | looks for expansions starting at the user's home directory or at the system's | |
76 | root directory; | |
77 | ||
78 | it() initial character bf(/): if the first character of the command is | |
76 | 79 | tt(/) then all expansions are performed from the system's root |
77 | directory. E.g., tt(xd /t) results in tt(/tmp) but not in tt(/home/user/tmp). | |
78 | it() Initial character bf(.): If the first character of the command is | |
80 | directory. E.g., tt(xd /t) produces tt(/tmp) but not tt(/home/user/tmp); | |
81 | ||
82 | it() initial character bf(.): if the first character of the command is | |
79 | 83 | tt(.) then by default all expansions are performed from the user's home |
80 | 84 | directory. E.g., tt(xd .t) results in tt(/home/user/tmp) but not in |
81 | 85 | tt(/tmp). The home directory recognition character can be altered using the |
82 | tt(--homedir-char) option, see below (section bf(OPTIONS)). | |
83 | it() Initial character bf(0): If the first character of the command is | |
86 | tt(--homedir-char) option, see below (section bf(OPTIONS)); | |
87 | ||
88 | it() initial character bf(0): If the first character of the command is | |
84 | 89 | tt(0), then all expansions start at the current working directory. In fact, |
85 | 90 | this is a specialization of the following, more general form: |
86 | it() Initial character bf(1..9): If the first character of the command is | |
91 | ||
92 | it() initial character bf(1..9): If the first character of the command is | |
87 | 93 | a digit between tt(1) and tt(9) then all expansions start at that parent |
88 | 94 | directory level of the current working directory (up to the system's root |
89 | 95 | directory). E.g., if the current working directory is tt(/usr/share/doc) then |
90 | 96 | tt(xd 2lb) will offer the alternative tt(/usr/local/bin): two steps up, then |
91 | 97 | look for directories starting with tt(l) and therein directories starting with |
92 | tt(b). | |
93 | it() Separators (space, and the forward slash (`tt(/)')): sometimes it is | |
98 | tt(b); | |
99 | ||
100 | it() separators (space, and the forward slash (`tt(/)')): sometimes it is | |
94 | 101 | clear that there are many alternatives and the intention is to reduce that |
95 | 102 | number. By using separators subsequently nested directories must start with |
96 | the characters between the separators. E.g., tt(xd u l bi) never produces the | |
97 | alternative tt(/usr/lib/base-config) anymore, since tt(base-config) does not | |
98 | start with tt(bi). In this case only tt(/usr/local/bin) is produced. When used | |
99 | as initial character in a pattern the forward slash always indicates the | |
100 | root-directory. | |
103 | the characters between the separators. E.g., tt(xd u l bi) doesn't produce | |
104 | the alternative tt(/usr/lib/base-config) anymore, since tt(base-config) does | |
105 | not start with tt(bi). In this case only tt(/usr/local/bin) is produced. When | |
106 | used as initial character in a pattern the forward slash always indicates the | |
107 | root-directory; | |
101 | 108 | COMMENT( |
102 | 109 | Separators may be mixed (tt(xd u/l bi) is identical to tt(xd u l |
103 | 110 | bi)). Since the tt(/) can also be used as a root-directory specification, |
107 | 114 | to solve the conflict (which in practice hardly ever occurs). |
108 | 115 | END) |
109 | 116 | |
110 | it() Search patterns may contain dots (like tt(.s)). In such cases the dot | |
117 | it() search patterns may contain dots (like tt(.s)). In such cases the dot | |
111 | 118 | represents hidden directories. However, tt(xd) usually also finds patterns |
112 | 119 | containing tt(/./), as the current directory matches the dot. Such patterns |
113 | 120 | are considered spurious and are not reported. |
114 | 121 | ) |
115 | 122 | |
116 | If there's only one solution, tt(Xd) writes that directory to its standard | |
117 | output stream. If there are multiple solutions, then a list of at most 62 | |
118 | alternatives (10 for the numbers 0..9, 26 for the letters a..z and 26 for the | |
119 | letters A..Z) is written to the standard error stream from which the user | |
120 | may select an alternative by simply pressing the key associated with the | |
121 | selection of choice. If no selection is requested any other key may be pressed | |
122 | (e.g., the space bar or the tt(Enter) key). If there is no solutioon tt(xd) | |
123 | writes the text tt(No Solutions) to the standard error stream. | |
123 | If there's only one solution, tt(Xd) prepares for a directory change to | |
124 | the solution's directory. | |
125 | ||
126 | If there are multiple solutions, then by default (but see also section | |
127 | tt(VERSION 4.00.00)) lists of at most 62 alternatives (10 for the numbers | |
128 | 0..9, 26 for the letters a..z and 26 for the letters A..Z) are written to the | |
129 | standard error stream from which the user may select an alternative by simply | |
130 | pressing the key associated with the selection of choice. If no selection is | |
131 | requested any other key may be pressed (e.g., the space bar or the tt(Enter) | |
132 | key). If there is no solutioon tt(xd) writes the text tt(No Solutions) to the | |
133 | standard error stream. | |
124 | 134 | |
125 | 135 | When tt(xd) is given at least one argument, all its output is sent to the |
126 | standard error stream, but for the selected directory name which is written to | |
127 | the standard output stream. If no selection is made or if the selection | |
128 | process is aborted a single dot is written to the standard output | |
129 | stream. Usually tt(xd) will be called by a shell alias, providing the | |
130 | tt(cd) command with tt(xd)'s output (see below at the bf(SHELL SCRIPTS) | |
131 | section) executing tt(cd `xd $*`). The default dot produced by tt(xd) | |
132 | prevents an unintended change of directory. | |
136 | standard error stream, except for the selected directory name which should | |
137 | become the next working directory. | |
138 | ||
139 | If no selection is made or if the | |
140 | selection process is aborted a single dot is written to the standard output | |
141 | stream. Usually tt(xd) will be called by a shell alias, providing the tt(cd) | |
142 | command with tt(xd)'s output (see below at the bf(SHELL SCRIPTS) section) | |
143 | executing tt(cd `xd $*`). The default dot produced by tt(xd) prevents an | |
144 | unintended change of directory. | |
133 | 145 | |
134 | 146 | When tt(xd) is merely given an initial directory specification, like a |
135 | 147 | single dot (tt(.)) or digit (a digit in the set tt([0..9])) then tt(xd) |
137 | 149 | entering `tt(xd 5)' when the current working directory is `tt(/tmp)') results |
138 | 150 | in writing the root directory (`tt(/)') to the standard output stream. |
139 | 151 | |
140 | If tt(xd) is called without arguments then em(usage) information is | |
152 | If tt(xd) is called without arguments its em(usage) information is | |
141 | 153 | written to the standard error stream. |
142 | 154 | |
143 | 155 | tt(Xd) may be further configured using options and a configuration file, |
144 | 156 | discussed in the bf(OPTIONS) and bf(CONFIGURATION FILE) sections below. |
145 | 157 | |
158 | manpagesection(VERSION 4.00.00) | |
159 | ||
160 | Starting with tt(xd) version 4.00.00 several major changes were implemented: | |
161 | itemization( | |
162 | it() tt(xd) may insert the tt(cd) command directly into the command shell | |
163 | from where tt(xd) was called. | |
164 | ||
165 | Before version 4.00.00 the selected directory was written to the | |
166 | standard output stream, where a a shell alias or script, passes | |
167 | tt(xd)'s output to the tt(cd) command (cf. section bf(SHELL | |
168 | SCRIPTS)). In this mode of operation tt(xd) returns a single dot if no | |
169 | selection is made, preventing an unintended change of directory. | |
170 | ||
171 | This mode of operation is still tt(xd's) default mode of operation. By | |
172 | specifying option tt(--input) (or by entering tt(input) in the | |
173 | configuration file) the additional shell alias or script is no longer | |
174 | necessary. In this tt(input) mode tt(xd) directly inserts the | |
175 | requested tt(cd) command into the shell's input buffer. This mode has | |
176 | an additional feature: if a key is pressed that is not assiciated with | |
177 | a possible directory then the current directory is kept, and the | |
178 | character corresponding to the pressed key is entered into the shell's | |
179 | input buffer. E.g., if tt(xd ulb) shows a list of five alternatives, | |
180 | but the tt(L) key is pressed then tt(xd) ends and the shell's input | |
181 | buffer shows tt(l). Merely pressing tt(s) + Enter will then show the | |
182 | current directory content. To merely end tt(xd) in this mode the space | |
183 | bar or Enter key can be pressed; | |
184 | ||
185 | it() the option tt(--block-size <nr>) (or specifying tt(block-size <nr>) | |
186 | in the configuration file), the possible directories matching tt(xd's) | |
187 | argument are listed in blocks of tt(<nr>) elements. The built-in | |
188 | minimum block size is 5. If there are fewer alternatives then this | |
189 | built-in minimum then the actually available alternatives are | |
190 | displayed; | |
191 | ||
192 | When alternatives are split up in blocks, a tt(+) is displayed after | |
193 | listing the first block, a tt(-) is displayed after listing the last | |
194 | block, and tt(-+) is displayed after listing the intermediate | |
195 | blocks. In these cases, pressing - redisplays the previous block, | |
196 | pressing + displays the next block; | |
197 | ||
198 | Although these block-end prompts only show - and +, the characters , | |
199 | and < (usually combined in one key) can be used instead of -, while | |
200 | . and > (also usually combined in one key) can be used instead of +. | |
201 | ) | |
202 | ||
203 | ||
146 | 204 | manpagesection(GENERALIZED DIRECTORY SEARCH) |
147 | 205 | |
148 | Starting with version 3.10.0 tt(xd) also supports generalized directory | |
149 | search command processing (GDS). When GDS is requested separators are no | |
150 | longer required, and tt(xd) will find all possible alternatives resulting from | |
151 | all possible sequential combinations of the initial search command. GDS is | |
152 | activated either by specifying the tt(-g) command line flag or by entering | |
153 | tt(generalized-search) in tt(xd)'s configuration file. Alternatively, when the | |
154 | latter is specified then the tt(--traditional) command line option will | |
155 | suppress GDS. | |
206 | tt(Xd) also supports generalized directory search commands (GDS). When GDS | |
207 | is requested separators are no longer required, and tt(xd) finds all possible | |
208 | alternatives resulting from all possible sequential combinations of the | |
209 | initial search command. GDS is activated either by specifying the tt(-g) | |
210 | option or by entering tt(generalized-search) in tt(xd)'s configuration | |
211 | file. Alternatively, when the latter is specified then the tt(--traditional) | |
212 | command line option suppresses GDS. | |
156 | 213 | |
157 | 214 | When using GDS each initial substring of the command to tt(xd) is |
158 | 215 | considered as the initial characters of a directory. E.g., if the command |
168 | 225 | it() tt(/tmp*/s*/) |
169 | 226 | it() tt(/tmps*/) |
170 | 227 | ) |
171 | Using the traditional processing mode only the first one of these | |
228 | With the traditional processing mode only the first one of these | |
172 | 229 | alternative patterns is considered. |
173 | 230 | |
174 | Multiple command line arguments, the slash and the underscore can still be | |
175 | used with GDS in which case they force a directory change in the considered | |
176 | patterns. E.g., with the command tt(xd tm/ps) the following patterns will be | |
177 | considered: | |
231 | Multiple command line arguments, the slash, and the underscore can still | |
232 | be used with GDS. In this case they force a directory change using the | |
233 | considered patterns. E.g., with the command tt(xd tm/ps) the following | |
234 | patterns will be considered: | |
178 | 235 | itemization( |
179 | 236 | it() tt(/t*/m*/p*/s*/) |
180 | 237 | it() tt(/t*/m*/ps*/) |
188 | 245 | manpagesection(RETURN VALUE) |
189 | 246 | |
190 | 247 | tt(Xd) returns 0 to the operating system unless an error occurs (e.g., |
191 | when a non-existing configuration file is specified), or tt(xd)'s version or | |
192 | usage info is shown or requested. | |
248 | when a non-existing configuration file is specified, or when tt(xd) | |
249 | automatically (i.e., without having received option tt(--help)) shows its | |
250 | usage info). | |
193 | 251 | |
194 | 252 | manpageoptions() |
195 | 253 | |
196 | 254 | If available, single letter options are listed between parentheses |
197 | 255 | following their associated long-option variants. Single letter options require |
198 | 256 | arguments if their associated long options require arguments as well. |
257 | ||
258 | Most options can also be specified in tt(xd's) configuration file, in which | |
259 | case the long option variants must be used, omitting the initial two dashes | |
260 | (see the section tt(CONFIGURATION FILE) below for specific details about the | |
261 | configuration file. | |
262 | ||
263 | By default the options can also be specified in the configuration | |
264 | file. If an option cannot be specifiied in the configuration file it is | |
265 | explicitly stated at its description. | |
266 | ||
267 | Options that are specified as command-line options take priority over options | |
268 | specified in the configuration file. | |
269 | ||
199 | 270 | itemization( |
200 | 271 | it() loption(add-root) tt(condition)nl() |
201 | 272 | If the search starts at the user's home directory an additional |
202 | 273 | search starting at the system's root directory may be performed as well, |
203 | depending on the value specified for the tt(add-root) option. Alternatives are | |
204 | tt(never) (no additional search is performed); tt(if-empty) (an additional | |
205 | search is performed if the initial search did not yield any directory); or | |
206 | tt(always) (an additional search is always performed). There is also a | |
207 | configuration file directive tt(add-root) (see below). | |
208 | ||
274 | depending on the value specified for the tt(add-root) option. Conditions are | |
275 | quote( | |
276 | itemization( | |
277 | it() tt(never) (no additional search is performed), | |
278 | it() tt(if-empty) (an additional search is performed if the initial | |
279 | search did not yield any directory), | |
280 | it() tt(always) (an additional search is always performed); | |
281 | ) | |
282 | ) | |
209 | 283 | it() loption(all) soption(a)nl() |
210 | 284 | If the configuration file (see below) contains tt(ignore) directives |
211 | then these directives are ignored when computing the alternatives from which | |
212 | the user may select a directory to change to. | |
285 | then those directives are ignored when computing the alternatives from which | |
286 | the user may select a directory to change to; | |
287 | ||
288 | it() lsoption(block-size)(b)(nr)nl() | |
289 | The possible directories matching tt(xd's) argument are listed in | |
290 | blocks of tt(<nr>) elements. See also the previous section tt(VERSION | |
291 | 4.00.00), | |
213 | 292 | |
214 | 293 | it() lsoption(config-file)(c)(filename)nl() |
215 | The name of an tt(xd) configuration file. By default tt(xd) | |
216 | looks for the file tt(.xdrc) in the user's home directory. The | |
217 | existence of the default file is optional. | |
294 | The name of an tt(xd) configuration file. By default tt(xd) looks for | |
295 | the file tt(.xdrc) in the user's home directory. The existence of the | |
296 | default file is optional. | |
297 | ||
298 | This option cannot be specified in the configuration file; | |
218 | 299 | |
219 | 300 | it() loption(directories) tt(inclusion)nl() |
220 | Directories may be also be reached via symbolic links. The inclusion | |
221 | type tt(all) adds these symbolic links to the list of alternatives. The | |
222 | inclusion type tt(unique) prevents symbolic links from being added to | |
223 | the list of alternatives. There is also a configuration file directive | |
224 | tt(directories) (see below). | |
301 | Directories may be also be reached via symbolic links. The (default) | |
302 | inclusion type tt(all) adds these symbolic links to the list of | |
303 | alternatives. The inclusion type tt(unique) prevents symbolic links | |
304 | from being added to the list of alternatives; | |
305 | ||
306 | it() loption(generalized-search) soption(g)nl() | |
307 | When specified tt(xd) uses GDS unless the directive tt(traditional) is | |
308 | specified in the configuration file; | |
309 | ||
310 | it() loption(help) (soption(h))nl() | |
311 | Basic usage information is written to the standard error stream, | |
312 | whereafter tt(xd) terminates. | |
313 | ||
314 | This option cannot be specified in the configuration file; | |
225 | 315 | |
226 | 316 | it() loption(homedir-char) tt(ch)nl() |
227 | By default an initial dot character (`tt(.)') initiates a search from | |
228 | the user's home directory. There is a slight disadvantage to using the dot, as | |
229 | it is also be the initial character of `hidden' directories. Assuming that you | |
230 | have a directory tt(~/.ssh) then the command to xd to that directory would be | |
231 | tt(xd ..s), the first dot being the home directory indicator, after which | |
232 | tt(.s) is used to find tt(.ssh). The option tt(--homedir-char) can be used to | |
233 | specify another character. Homedir characters cannot be digits or a slash | |
234 | (`tt(/)') as these are used to specify, respectively, parent directories and | |
235 | the computer's root directory. Characters like ``tt(, @ % ^)'' or maybe | |
236 | `tt(H)' (assuming that it doesn't interfere with an existing directory | |
237 | beginning with tt(H)) could be used as homedir-characters, other than the | |
238 | default dot character. | |
239 | ||
240 | Caveat: command shells by default interpret characters like ``tt(~ $ \ ' " ` < | |
241 | > |)'' etc., which therefore should probably not be specified as | |
242 | home directory specifiers. | |
243 | ||
244 | There is also a configuration file directive tt(homedir-char) (see below). | |
245 | ||
246 | it() loption(generalized-search) soption(g)nl() | |
247 | When this option is specified tt(xd) uses GDS unless the | |
248 | directive tt(traditional) is specified in the configuration file. | |
249 | ||
250 | it() loption(help) (soption(h))nl() | |
251 | Basic usage information is written to the standard error stream. | |
317 | By default an initial dot character (`tt(.)') initiates a search from | |
318 | the user's home directory. There is a slight disadvantage to using the | |
319 | dot, as it is also be the initial character of `hidden' | |
320 | directories. Assuming that you have a directory tt(~/.ssh) then the | |
321 | command to xd to that directory would be tt(xd ..s), the first dot | |
322 | being the home directory indicator, after which tt(.s) is used to find | |
323 | tt(.ssh). The option tt(--homedir-char) can be used to specify another | |
324 | character. Homedir characters cannot be digits or a slash (`tt(/)') as | |
325 | these are used to specify, respectively, parent directories and the | |
326 | computer's root directory. Characters like ``tt(, @ % ^)'' or maybe | |
327 | `tt(H)' (assuming that it doesn't interfere with an existing directory | |
328 | beginning with tt(H)) could be used as homedir-characters, other than | |
329 | the default dot character. | |
330 | ||
331 | Caveat: command shells by default interpret characters like ``tt(~ $ \ | |
332 | ' " ` < > |)'' etc., which therefore should probably not be specified | |
333 | as home directory specifiers; | |
252 | 334 | |
253 | 335 | it() loption(history) tt([filename])nl() |
254 | A history of previously made choices is kept in the file | |
255 | tt(filename). If tt(--history) is specified, but the filename is | |
256 | left empty the history file tt($HOME/.xd.his) is used. This file should only | |
257 | be modified by tt(xd) itself. If you can't resist editing it then use the | |
258 | following example showing the format of the lines in the history file. | |
259 | verb( | |
336 | A history of previously made choices is kept in the file | |
337 | tt(filename). If tt(--history) is specified, but the filename is left | |
338 | empty the history file tt($HOME/.xd.his) is used. This file should | |
339 | only be modified by tt(xd) itself. If you can't resist editing it then | |
340 | use the following example showing the format of the lines in the | |
341 | history file. | |
342 | verb( | |
260 | 343 | 1292596154 1 /home/frank/svn/xd/ |
261 | 344 | ) |
262 | The first field is the time (in seconds since the epoch) the entry was | |
263 | written, the second field is the number of times the entry has been selected | |
264 | and the third field is the associated path. | |
345 | The first field is the time (in seconds since the epoch) the entry was | |
346 | written, the second field is the number of times the entry has been | |
347 | selected and the third field is the associated path. | |
348 | ||
349 | The following tt(history-...) options are only interpreted if the | |
350 | tt(history) option is also specified. | |
265 | 351 | |
266 | 352 | it() loption(history-lifetime) tt(spec)nl() |
267 | The lifetime of the entries in the history file. The specification | |
268 | consists of a number followed by tt(D, W, M) or tt(Y), representing, | |
269 | resp. days, weeks, months, or years. A month is considered a period of 30 | |
270 | days, a year a period of 365 days. If the specification is omitted a lifetime | |
271 | of tt(1M) (one month) is used. Entries older than tt(history-lifetime) are | |
272 | disregarded as history-items and are removed from the history file. | |
353 | The lifetime of the entries in the history file. The specification | |
354 | consists of a number followed by tt(D, W, M) or tt(Y), representing, | |
355 | resp. days, weeks, months, or years. A month is considered a period of | |
356 | 30 days, a year a period of 365 days. If the specification is omitted | |
357 | a lifetime of tt(1M) (one month) is used. Entries older than | |
358 | tt(history-lifetime) are disregarded as history-items and are removed | |
359 | from the history file; | |
273 | 360 | |
274 | 361 | it() loption(history-maxsize) tt(nr)nl() |
275 | The maximum number of entries the history file may contain. By default | |
276 | there is no limit. When tt(history-maxsize) is specified and more than the | |
277 | maximum number of history items are found in the history file then the tt(nr) | |
278 | most popular choices are kept. Usually the cut-off point will be somewhere | |
279 | within a popularity category. In that case the most recently selected | |
280 | alternatives within that category are kept. | |
362 | The maximum number of entries the history file may contain. By default | |
363 | there is no limit. When tt(history-maxsize) is specified and more than | |
364 | the maximum number of history items are found in the history file then | |
365 | the tt(nr) most popular choices are kept. Usually the cut-off point | |
366 | will be somewhere within a popularity category. In that case the most | |
367 | recently selected alternatives within that category are kept; | |
281 | 368 | |
282 | 369 | it() loption(history-position) tt([top|bottom])nl() |
283 | When this option is specified then previously found alternatives | |
284 | are displayed either at the top of the list or at the bottom | |
285 | of the list. If this option is omitted then the elements in the history will | |
286 | be intermixed with new alternatives. The next option tt(history-separate) is | |
287 | only used when this option is also specified. By merely specifying | |
288 | tt(history-position) the history items are shown at the top of the list. | |
370 | Previously found alternatives are displayed either at the top of the | |
371 | list or at the bottom of the list. If this option is omitted then the | |
372 | elements in the history are intermixed with new alternatives. The next | |
373 | option tt(history-separate) is only used when this option is also | |
374 | specified. By merely specifying tt(history-position) the history items | |
375 | are shown at the top of the list; | |
289 | 376 | |
290 | 377 | it() loption(history-separate)nl() |
291 | When specified, a blank line is written between the items in the history | |
292 | and new alternatives (not previously selected). This option is only | |
293 | interpreted when the previous option is also specified. | |
294 | ||
295 | it() loption(icase) soption(i)nl() | |
296 | This option is used to specify case-insensitive pattern matching. E.g., | |
297 | specifying tt(xd /ub) returns the directory tt(/usr/bin), but not a directory | |
298 | like tt(/UnSpecified/Books), which is returned by tt(xd /UB). However, tt(xd | |
299 | -i /ub) (using any letter casing for the specification) returns both | |
300 | directories. The option tt(icase) could of course be specified in the | |
301 | configuration file, which which case case-insensitive matching is used by | |
302 | default. In the latter case specifying tt(-i) as a command line option reverts | |
303 | the matching procedure to case-sensitive directory matching. In general, when | |
304 | an even number of em(icase) specifications is provided tt(xd) uses | |
305 | case-sensitive directory matching, while an odd number of em(icase) | |
306 | specifications results in case-insensitive directory matching. | |
378 | When specified a blank line is written between the items in the | |
379 | history and new alternatives (not previously selected). This option is | |
380 | only interpreted when the previous option is also specified; | |
381 | ||
382 | it() loption(icase) soption(i)nl() | |
383 | Specify this option to use case-insensitive pattern matching. E.g., | |
384 | specifying tt(xd /ub) returns the directory tt(/usr/bin), but not a | |
385 | directory like tt(/UnSpecified/Books), which is returned by tt(xd | |
386 | /UB). However, tt(xd -i /ub) (using any letter casing for the | |
387 | specification) returns both directories. The option tt(icase) could of | |
388 | course be specified in the configuration file, which which case | |
389 | case-insensitive matching is used by default. In the latter case | |
390 | specifying tt(-i) as a command line option reverts the matching | |
391 | procedure to case-sensitive directory matching. In general, when an | |
392 | even number of em(icase) specifications is provided tt(xd) uses | |
393 | case-sensitive directory matching, while an odd number of em(icase) | |
394 | specifications results in case-insensitive directory matching; | |
395 | ||
396 | it() bf(ignore) tt(path) nl() | |
397 | This option cannot be specified as command-line option. Instead, the | |
398 | configuration file may contain multiple tt(ignore) directives which | |
399 | are (different from the way other directives are handled) all | |
400 | interpreted. Each tt(ignore) directive is followed by a path | |
401 | specification as shown in a list of alternatives produced by tt(xd) or | |
402 | an initial substring of such a path terminating in a tt(*) | |
403 | character. When tt(xd) encounters a path matching any of the | |
404 | tt(ignore) directives (interpreting the final tt(*) as `any further | |
405 | directory name' specification) it will not display that path in its | |
406 | list of alternatives. | |
407 | ||
408 | This directive is overruled by the tt(---all) command line option; | |
409 | ||
410 | it() loption(input)nl() | |
411 | tt(Xd) itself issues the tt(cd) command for the selected directory to | |
412 | the shell, and enters other (non alternative-selecting characters) | |
413 | into the shell's input. See also the previous section tt(VERSION | |
414 | 4.00.00). | |
415 | ||
416 | To merely end tt(xd) press the Enter key or space-bar; | |
307 | 417 | |
308 | 418 | it() loption(start-at) tt(origin)nl() |
309 | Defines the default start location of directory searches. Origin | |
310 | tt(home) results in all default searches to start at the user's home | |
311 | directory. Origin tt(root) results in searches to begin at the disk's root | |
312 | (tt(/)) directory. There is also a configuration file directive tt(start-at) | |
313 | (see below). | |
419 | Defines the default start location of directory searches. Origin | |
420 | tt(home) (the default) results in all default searches to start at the | |
421 | user's home directory. Origin tt(root) results in searches to begin at | |
422 | the disk's root (tt(/)) directory; | |
314 | 423 | |
315 | 424 | it() loption(traditional)nl() |
316 | When this option is specified tt(xd) will not use GDS but will use its | |
317 | traditional mode. It overrules a tt(generalized-search) directive specified in | |
318 | the configuration file as well as the tt(-g) option. | |
425 | tt(Xd) does not use GDS but uses its traditional mode. It overrules a | |
426 | tt(generalized-search) directive specified in the configuration file | |
427 | as well as the tt(-g) option; | |
319 | 428 | |
320 | 429 | it() loption(verbose) (soption(V))nl() |
321 | More extensive information about the actions taken by the tt(xd) | |
322 | program is written to the standard error stream. | |
430 | More extensive information about the actions taken by the tt(xd) | |
431 | program is written to the standard error stream. | |
432 | ||
433 | This option cannot be specified in the configuration file; | |
323 | 434 | |
324 | 435 | it() loption(version) (soption(v))nl() |
325 | tt(Xd)'s version number is written to the standard error stream. | |
436 | tt(Xd)'s version number is written to the standard error stream | |
437 | whereafter tt(xd) terminates. | |
438 | ||
439 | This option cannot be specified in the configuration file. | |
326 | 440 | ) |
327 | 441 | |
328 | 442 | |
329 | 443 | manpagesection(CONFGURATION FILE) |
330 | 444 | |
331 | 445 | The default configuration file is tt(.xdrc) in the user's home directory. It |
332 | may be overruled by the program's tt(--config-file) option. | |
446 | may be overruled by the program's tt(--config-file) command-line option. | |
333 | 447 | |
334 | 448 | Empty lines are ignored. Information at and beyond tt(#)-characters is |
335 | interpreted as comment and is ignored as well. | |
336 | ||
337 | All directives in tt(xd) configuration files follow the pattern | |
449 | interpreted as comment and is also ignored. | |
450 | ||
451 | Directives in tt(xd) configuration files follow the pattern | |
338 | 452 | verb( |
339 | 453 | directive value |
340 | 454 | ) |
341 | but for some directives tt(value) is optional. | |
342 | ||
343 | A line may at most contain one directive, but white space (including | |
344 | comment at the end of the line) is OK. The same directive may be specified | |
345 | multiple times, in which case the em(last) directive will be used (with the | |
346 | exception of the em(ignore) directive, see below). All | |
347 | directives are interpreted em(case sensitively). Non-empty lines | |
348 | not beginning with a recognized directive are silently ignored. | |
349 | ||
350 | The following directives can be used in the | |
351 | configuration file. Default values are shown between parentheses. | |
352 | itemization( | |
353 | it() bf(add-root) tt(when) (if-empty)nl() | |
354 | If the search starts at the user's home directory an additional | |
355 | search starting at the system's root directory may be performed as well, | |
356 | depending on the value specified for the tt(add-root) directive. nl() | |
357 | If tt(when) is specified as tt(always) then an additional search is | |
358 | always performed.nl() | |
359 | If it is specified as tt(if-empty) then an additional search is | |
360 | performed if the initial search (starting at the user's home directory) did | |
361 | not yield any directory.nl() | |
362 | If it is specified as tt(never) no additional search is | |
363 | performed. | |
364 | ||
365 | This directive is overruled by the tt(---add-root) command line option. | |
366 | ||
367 | it() bf(directories) tt(which) (all)nl() | |
368 | Directories may be also be reached via symbolic links. The | |
369 | specification tt(all) will add these symbolic links to the list of | |
370 | alternatives. The specification tt(unique) will prevent the symbolic links | |
371 | from being added to the list of alternatives. | |
372 | ||
373 | This directive is overruled by the tt(---directories) command line option. | |
374 | ||
375 | it() bf(homedir-char) tt(ch)nl() | |
376 | By default an initial dot character (`tt(.)') initiates a search from | |
377 | the user's home directory. There is a slight disadvantage to using the dot, as | |
378 | it is also be the initial character of `hidden' directories. Assuming that you | |
379 | have a directory tt(~/.ssh) then the command to xd to that directory would be | |
380 | tt(xd ..s), the first dot being the home directory indicator, after which | |
381 | tt(.s) is used to find tt(.ssh). The specification tt(homedir-char ch) can be | |
382 | used to specify another home directory indicating character tt(ch), as in: | |
383 | verb( | |
384 | homedir-char , | |
385 | ) | |
386 | Homedir characters cannot be digits or a | |
387 | slash (`tt(/)') as these are used to specify, respectively, parent directories | |
388 | and the computer's root directory. Characters like ``tt(, @ % ^)'' or maybe | |
389 | `tt(H)' (assuming that it doesn't interfere with an existing directory | |
390 | beginning with tt(H)) could be used as homedir-characters, other than the | |
391 | default dot character. | |
392 | ||
393 | Caveat: command shells by default interpret characters like ``tt(~ $ \ ' " ` < | |
394 | > |)'' etc., which therefore should probably not be specified as | |
395 | home directory specifiers. | |
396 | ||
397 | This directive is overruled by the tt(---homedir-char) command line option. | |
398 | ||
399 | it() bf(generalized-search) nl() | |
400 | When this directive is specified tt(xd) will use GDS by default. | |
401 | ||
402 | it() bf(history) tt([filename])nl() | |
403 | A history of previously made choices is kept in the file | |
404 | tt(filename). If tt(history) is specified, but the filename is | |
405 | left empty the history file tt($HOME/.xd.his) is used. This file should only | |
406 | be modified by tt(xd) itself. If you can't resist editing it then use the | |
407 | following example showing the format of the lines in the history file. | |
408 | verb( | |
409 | 1292596154 1 /home/frank/svn/xd/ | |
410 | ) | |
411 | The first field is the time (in seconds since the epoch) the entry was | |
412 | written, the second field is the number of times the entry has been selected | |
413 | and the third field is the associated path. | |
414 | ||
415 | it() bf(history-lifetime) tt(spec)nl() | |
416 | The lifetime of the entries in the history file. The specification | |
417 | consists of a number followed by tt(D, W, M) or tt(Y), representing, | |
418 | resp. days, weeks, months, or years. A month is considered a period of 30 | |
419 | days, a year a period of 365 days. If the specification is omitted a lifetime | |
420 | of tt(1M) (one month) is used. Entries older than tt(history-lifetime) are | |
421 | disregarded as history-items and are removed from the history file. | |
422 | ||
423 | it() bf(history-maxsize) tt(nr)nl() | |
424 | The maximum number of entries the history file may contain. By default | |
425 | there is no limit. When tt(history-maxsize) is specified and more than the | |
426 | maximum number of history items are found in the history file then the tt(nr) | |
427 | latest choices are kept. Each previously made selection counts as one. If a | |
428 | new alternative is selected it always becomes an element in the history list. | |
429 | ||
430 | it() bf(history-position) tt([top|bottom])nl() | |
431 | When specified alternatives found in the history will be displayed either | |
432 | at the top of the list or at the bottom of the list. If this option is omitted | |
433 | then the elements in the history will be intermixed with new alternatives. The | |
434 | next directive tt(history-separate) is only used when this directive is also | |
435 | specified. By merely specifying tt(history-position) the history items are | |
436 | shown at the top of the list. | |
437 | ||
438 | it() bf(history-separate)nl() | |
439 | When specified, a blank line is written between the items in the history | |
440 | and new alternatives (not previously selected). This directive is only | |
441 | interpreted when the previous directive is also specified. | |
442 | ||
443 | it() loption(icase) soption(i)nl() | |
444 | This specification is used to request case-insensitive pattern | |
445 | matching. If this option is entered in the configuration file then specifying | |
446 | tt(xd /ub) returns the directory tt(/usr/bin) as welll as a directory like | |
447 | (assuming it exists) tt(/UnSpecified/Books). When specified in the | |
448 | configuration file, the command-line option tt(-i) reverts the matching | |
449 | procedure back to case-sensitive directory matching. In general, when an even | |
450 | number of em(icase) specifications is provided tt(xd) uses case-sensitive | |
451 | directory matching, while an odd number of em(icase) specifications results in | |
452 | case-insensitive directory matching. | |
453 | ||
454 | it() bf(ignore) tt(path) nl() | |
455 | The configuration file may contain multiple tt(ignore) directives | |
456 | which are --different from the way other directives are handled-- all | |
457 | interpreted. Each tt(ignore) directive is followed by a path specification as | |
458 | shown in a list of alternatives produced by tt(xd) or an initial substring of | |
459 | such a path terminating in a tt(*) character. When tt(xd) encounters a path | |
460 | matching any of the tt(ignore) directives (with the tt(*) interpreted as `any | |
461 | further directory name' specification) it will not display that path in its | |
462 | list of alternatives. | |
463 | ||
464 | This directive is overruled by the tt(---all) command line option. | |
465 | ||
466 | it() bf(start-at) tt(value) (home) nl() | |
467 | Defines the default start location of directory searches. Values | |
468 | are tt(home) and tt(root). When tt(home) is specified all searches start at | |
469 | the user's home directory. When tt(root) is specified searches start at the | |
470 | disk's root (tt(/)) directory. If the directory is omitted or if another value | |
471 | is specified then the default is used, which is tt(home). | |
472 | ||
473 | This directive is overruled by the tt(---start-at) command line option. | |
474 | ||
475 | it() bf(traditional) nl() | |
476 | This directive may be used to request the use of tt(xd)'s traditional | |
477 | mode. It overrules the tt(-g) command line option and the | |
478 | tt(generalized-search) directive. | |
479 | ) | |
480 | ||
455 | (for some directives there is no tt(value) term). | |
456 | ||
457 | A line may at most contain one directive, but white space (including comment | |
458 | at the end of the line) is OK. The same directive may be specified multiple | |
459 | times, in which case the em(last) directive will be used (except for the | |
460 | em(ignore) directive, which are all interpreted). All directives are | |
461 | interpreted em(case sensitively) unless option tt(icase) is specified. | |
462 | Non-empty lines not beginning with a recognized directive are silently | |
463 | ignored. | |
481 | 464 | |
482 | 465 | manpagesection(SHELL SCRIPTS) |
466 | ||
467 | If the tt(input) option is specified (as command-line or configuration | |
468 | file option) then this section can be ignored. | |
483 | 469 | |
484 | 470 | Assuming tt(xd) is installed in tt(/usr/bin) scripts can be defined around |
485 | 471 | tt(xd) for various shell programs. This allows the shell to change directories |
0 | #ifndef INCLUDED_ENUMS_H_ | |
1 | #define INCLUDED_ENUMS_H_ | |
2 | ||
3 | enum TriState // used by Alternatives | |
4 | { | |
5 | NEVER, | |
6 | IF_EMPTY, | |
7 | ALWAYS | |
8 | }; | |
9 | ||
10 | enum Position // used by History | |
11 | { | |
12 | TOP, | |
13 | BOTTOM | |
14 | }; | |
15 | ||
16 | ||
17 | #endif |
0 | #include "filter.ih" | |
1 | ||
2 | bool Filter::decided() const | |
3 | { | |
4 | d_alternatives.update(d_index); | |
5 | ||
6 | return d_index != d_alternatives.size(); | |
7 | } |
0 | #ifndef _FILTER_H_ | |
1 | #define _FILTER_H_ | |
2 | ||
3 | #include <string> | |
4 | ||
5 | #include "../alternatives/alternatives.h" | |
6 | ||
7 | class Filter | |
8 | { | |
9 | size_t d_index; | |
10 | Alternatives &d_alternatives; | |
11 | ||
12 | public: | |
13 | Filter(Alternatives &alternatives); | |
14 | ||
15 | void select(); | |
16 | bool decided() const; | |
17 | ||
18 | private: | |
19 | void showAlternatives() const; | |
20 | size_t show(size_t begin, char first, char last, | |
21 | size_t separateAt) const; | |
22 | void setIndex(); | |
23 | }; | |
24 | ||
25 | #endif |
0 | #include "filter.h" | |
1 | ||
2 | #include <iostream> | |
3 | #include <iomanip> | |
4 | ||
5 | #include <bobcat/onekey> | |
6 | #include <bobcat/mstream> | |
7 | ||
8 | using namespace std; | |
9 | using namespace FBB; |
0 | #include "filter.ih" | |
1 | ||
2 | Filter::Filter(Alternatives &alternatives) | |
3 | : | |
4 | d_index(alternatives.size()), | |
5 | d_alternatives(alternatives) | |
6 | {} |
0 | #include "filter.ih" | |
1 | ||
2 | void Filter::select() | |
3 | { | |
4 | if (d_alternatives.size() == 0) | |
5 | throw 0; | |
6 | ||
7 | if (d_alternatives.size() == 1) | |
8 | { | |
9 | imsg << endl; | |
10 | d_index = 0; // forced selection: one option | |
11 | } | |
12 | else | |
13 | { | |
14 | showAlternatives(); | |
15 | setIndex(); | |
16 | } | |
17 | ||
18 | cout << d_alternatives[d_index] << endl; | |
19 | } |
0 | #include "filter.ih" | |
1 | ||
2 | void Filter::setIndex() | |
3 | { | |
4 | int c; | |
5 | OneKey oneKey; | |
6 | ||
7 | c = oneKey.get(); // get the replay | |
8 | ||
9 | if (c == '0') | |
10 | d_index = 9; | |
11 | else if (isdigit(c)) | |
12 | d_index = c - '1'; | |
13 | else if (islower(c)) | |
14 | d_index = '9' - '0' + 1 + c - 'a'; | |
15 | else if (isupper(c)) | |
16 | d_index = '9' - '0' + 1 + 'z' - 'a' + 1 + c - 'A'; | |
17 | else | |
18 | throw 1; | |
19 | ||
20 | if (d_index > d_alternatives.size()) | |
21 | throw 1; | |
22 | } |
0 | #include "filter.ih" | |
1 | ||
2 | size_t Filter::show(size_t begin, char first, char last, size_t separateAt) | |
3 | const | |
4 | { | |
5 | size_t end = min(begin + last - first + 1, d_alternatives.size()); | |
6 | ||
7 | for (; begin != end; ++begin, ++first) | |
8 | { | |
9 | if (begin == separateAt) | |
10 | cerr << '\n'; | |
11 | cerr << setw(2) << first << ": " << d_alternatives[begin] << '\n'; | |
12 | } | |
13 | ||
14 | return begin; | |
15 | } |
0 | #include "filter.ih" | |
1 | ||
2 | void Filter::showAlternatives() const | |
3 | { | |
4 | imsg << endl; | |
5 | ||
6 | size_t separateAt = d_alternatives.separateAt(); | |
7 | ||
8 | size_t begin = show(0, '1', '9', separateAt); | |
9 | ||
10 | begin = show(begin, '0', '0', separateAt); | |
11 | begin = show(begin, 'a', 'z', separateAt); | |
12 | begin = show(begin, 'A', 'Z', separateAt); | |
13 | } |
0 | #include "main.ih" | |
1 | ||
2 | int handle(exception_ptr ptr) | |
3 | try | |
4 | { | |
5 | rethrow_exception(ptr); | |
6 | } | |
7 | catch(exception const &err) // handle exceptions | |
8 | { | |
9 | cerr << err.what() << '\n'; | |
10 | ||
11 | // preventa a directory change | |
12 | noInput(); // if --input wasn't specified | |
13 | ||
14 | return 1; | |
15 | } | |
16 | catch(int x) | |
17 | { | |
18 | if (ArgConfig::instance().option("hv")) | |
19 | x = 0; | |
20 | else if (x == 0) | |
21 | cerr << "No Solutions\n"; | |
22 | ||
23 | noInput(); | |
24 | ||
25 | return x; | |
26 | } | |
27 | ||
28 | ||
29 | ||
30 | ||
31 |
0 | inline History::HistoryInfo::HistoryInfo(size_t time, size_t count, | |
1 | std::string const &path) | |
2 | : | |
3 | time(time), | |
4 | count(count), | |
5 | path(path) | |
6 | {} | |
7 | ||
8 | inline bool History::find(std::string const &path) const | |
9 | { | |
10 | return findIter(path) != d_history.end(); | |
11 | } | |
12 | ||
13 | inline std::vector<History::HistoryInfo>::const_iterator | |
14 | History::findIter(std::string const &path) const | |
15 | { | |
16 | return | |
17 | find_if( | |
18 | d_history.begin(), d_history.end(), | |
19 | [&](HistoryInfo const &history) | |
20 | { | |
21 | return history.path == path; | |
22 | } | |
23 | ); | |
24 | } | |
25 | ||
26 | inline Position History::position() const | |
27 | { | |
28 | return d_options.historyPosition(); | |
29 | } | |
30 | ||
31 | inline bool History::rotate() const | |
32 | { | |
33 | return not d_historyFilename.empty() && | |
34 | d_options.historyPosition() == BOTTOM; | |
35 | } | |
36 | ||
37 | inline std::ostream &operator<<(std::ostream &out, | |
38 | History::HistoryInfo const &hi) | |
39 | { | |
40 | return out << hi.time << ' ' << hi.count << ' ' << hi.path; | |
41 | } | |
42 | ||
43 | ||
44 | ||
45 |
5 | 5 | #include <iostream> |
6 | 6 | #include <algorithm> |
7 | 7 | |
8 | namespace FBB | |
9 | { | |
10 | class ArgConfig; | |
11 | } | |
8 | #include "../enums/enums.h" | |
9 | #include "../options/options.h" | |
12 | 10 | |
13 | 11 | class History |
14 | 12 | { |
15 | public: | |
16 | enum Position | |
17 | { | |
18 | TOP, | |
19 | BOTTOM | |
20 | }; | |
13 | struct HistoryInfo | |
14 | { | |
15 | size_t time; | |
16 | size_t count; | |
17 | std::string path; | |
21 | 18 | |
22 | private: | |
23 | struct HistoryInfo | |
24 | { | |
25 | size_t time; | |
26 | size_t count; | |
27 | std::string path; | |
19 | HistoryInfo() = default; | |
20 | HistoryInfo(size_t time, size_t count, std::string const &path); | |
21 | }; | |
28 | 22 | |
29 | HistoryInfo() = default; | |
30 | HistoryInfo(size_t time, size_t count, std::string const &path); | |
31 | }; | |
23 | friend std::istream &operator>>(std::istream &in, HistoryInfo &hl); | |
24 | friend std::ostream &operator<<(std::ostream &in, | |
25 | HistoryInfo const &hl); | |
32 | 26 | |
33 | friend std::istream &operator>>(std::istream &in, HistoryInfo &hl); | |
34 | friend std::ostream &operator<<(std::ostream &in, | |
35 | HistoryInfo const &hl); | |
27 | Options const &d_options; | |
36 | 28 | |
37 | FBB::ArgConfig &d_arg; | |
29 | std::string d_historyFilename; // name of the history file | |
38 | 30 | |
39 | size_t d_now; // current time | |
31 | size_t d_now; // current time | |
40 | 32 | |
41 | size_t d_oldest; | |
42 | Position d_position; // TOP or BOTTOM (TOP) | |
43 | std::string d_name; // name of the history file | |
44 | // (empty: no history used) | |
33 | std::vector<HistoryInfo> d_history; | |
45 | 34 | |
46 | std::vector<HistoryInfo> d_history; | |
47 | ||
48 | static char s_defaultHistory[]; | |
35 | static char s_defaultHistory[]; | |
49 | 36 | |
50 | 37 | public: |
51 | History(FBB::ArgConfig &arg, std::string const &homeDir); | |
38 | History(); | |
39 | ||
40 | Position position() const; | |
41 | ||
52 | 42 | void setLocation(size_t nInHistory); |
53 | 43 | void save(std::string const &choice); |
54 | 44 | bool rotate() const; |
55 | Position position() const; | |
45 | ||
56 | 46 | // see if a path is in the history |
57 | 47 | bool find(std::string const &path) const; |
58 | 48 | |
59 | 49 | private: |
60 | 50 | std::vector<HistoryInfo>::const_iterator findIter( |
61 | 51 | std::string const &path) const; |
62 | ||
63 | ||
64 | void load(std::string const &homeDir); | |
65 | void setData(); | |
52 | void load(); | |
66 | 53 | |
67 | 54 | static void maybeInsert(HistoryInfo const &historyInfo, |
68 | 55 | std::vector<HistoryInfo> &history, |
72 | 59 | static bool compareCounts(HistoryInfo const &first, |
73 | 60 | HistoryInfo const &second); |
74 | 61 | |
75 | // static bool findEntry(HistoryInfo const &history, | |
76 | // std::string const &entry); | |
77 | ||
78 | 62 | }; |
79 | 63 | |
80 | inline History::HistoryInfo::HistoryInfo(size_t time, size_t count, | |
81 | std::string const &path) | |
82 | : | |
83 | time(time), | |
84 | count(count), | |
85 | path(path) | |
86 | {} | |
64 | #include "history.f" | |
87 | 65 | |
88 | inline History::Position History::position() const | |
89 | { | |
90 | return d_position; | |
91 | } | |
92 | ||
93 | inline std::vector<History::HistoryInfo>::const_iterator History::findIter( | |
94 | std::string const &path) const | |
95 | { | |
96 | return | |
97 | find_if( | |
98 | d_history.begin(), d_history.end(), | |
99 | [&](HistoryInfo const &history) | |
100 | { | |
101 | return history.path == path; | |
102 | } | |
103 | ); | |
104 | } | |
105 | ||
106 | inline bool History::find(std::string const &path) const | |
107 | { | |
108 | return findIter(path) != d_history.end(); | |
109 | } | |
110 | ||
111 | inline std::ostream &operator<<(std::ostream &out, | |
112 | History::HistoryInfo const &hi) | |
113 | { | |
114 | return out << hi.time << ' ' << hi.count << ' ' << hi.path; | |
115 | } | |
116 | ||
117 | inline bool History::rotate() const | |
118 | { | |
119 | return d_name.length() && d_position == BOTTOM; | |
120 | } | |
121 | 66 | |
122 | 67 | #endif |
0 | 0 | #include "history.h" |
1 | 1 | |
2 | 2 | #include <climits> |
3 | #include <sstream> | |
3 | 4 | |
4 | 5 | #include <bobcat/a2x> |
5 | 6 | #include <bobcat/mstream> |
6 | #include <bobcat/argconfig> | |
7 | 7 | #include <bobcat/string> |
8 | 8 | |
9 | 9 | using namespace std; |
0 | 0 | #include "history.ih" |
1 | 1 | |
2 | History::History(ArgConfig &arg, string const &homeDir) | |
2 | History::History() | |
3 | 3 | : |
4 | d_arg(arg), | |
5 | d_now(time(0)) | |
4 | d_options(Options::instance()), | |
5 | d_now(d_options.now()) | |
6 | 6 | { |
7 | setData(); | |
8 | load(homeDir); | |
7 | if (not d_options.history().empty()) | |
8 | { | |
9 | d_historyFilename = d_options.homeDir() + d_options.history(); | |
10 | load(); | |
11 | } | |
9 | 12 | } |
0 | ../icmconf.lib⏎ |
0 | 0 | #include "history.ih" |
1 | 1 | |
2 | void History::load(string const &homeDir) | |
2 | void History::load() | |
3 | 3 | { |
4 | if (d_arg.option(&d_name, "history") && d_name.empty()) | |
5 | d_name = homeDir + s_defaultHistory; | |
6 | ||
7 | ifstream in(d_name); | |
4 | ifstream in{ d_historyFilename }; | |
8 | 5 | if (!in) |
9 | 6 | { |
10 | imsg << "History file `" << d_name << "' not readable" << endl; | |
7 | imsg << "History file `" << d_historyFilename << "' not readable" << endl; | |
11 | 8 | return; |
12 | 9 | } |
13 | 10 | |
14 | imsg << "History file `" << d_name << '\'' << endl; | |
11 | imsg << "History file `" << d_historyFilename << '\'' << endl; | |
15 | 12 | |
16 | 13 | for_each( |
17 | 14 | istream_iterator<HistoryInfo>(in), |
18 | 15 | istream_iterator<HistoryInfo>(), |
19 | 16 | [&](HistoryInfo const &historyInfo) |
20 | 17 | { |
21 | maybeInsert(historyInfo, d_history, d_oldest); | |
18 | maybeInsert(historyInfo, d_history, d_options.historyLifetime()); | |
22 | 19 | } |
23 | 20 | ); |
24 | 21 | } |
0 | 0 | #include "history.ih" |
1 | ||
2 | // choice: chosen directory to cd to | |
1 | 3 | |
2 | 4 | void History::save(string const &choice) |
3 | 5 | { |
4 | if (d_name.empty()) // no history file in use | |
6 | if (d_historyFilename.empty()) // no history file in use | |
5 | 7 | return; |
6 | 8 | |
7 | ofstream out(d_name); | |
9 | ofstream out(d_historyFilename); | |
8 | 10 | if (!out) |
9 | 11 | { |
10 | imsg << "cannot write history file `" << d_name << '\'' << endl; | |
12 | imsg << "cannot write history file `" << d_historyFilename << '\'' << | |
13 | endl; | |
11 | 14 | return; |
12 | 15 | } |
13 | 16 | |
25 | 28 | sort(d_history.begin(), d_history.end(), compareTimes); |
26 | 29 | // stable_sort(d_history.begin(), d_history.end(), compareCounts); |
27 | 30 | |
28 | string value; | |
29 | size_t maxSize = d_arg.option(&value, "history-maxsize") ? | |
30 | A2x(value) | |
31 | : | |
32 | UINT_MAX; | |
33 | ||
34 | if (maxSize != UINT_MAX) | |
31 | if (size_t maxSize = d_options.historyMaxSize(); maxSize != UINT_MAX) | |
35 | 32 | { |
36 | 33 | imsg << "Max. history size: " << maxSize << endl; |
37 | 34 | |
42 | 39 | copy(d_history.begin(), d_history.end(), |
43 | 40 | ostream_iterator<HistoryInfo>(out, "\n")); |
44 | 41 | } |
42 |
0 | #include "history.ih" | |
1 | ||
2 | void History::setData() | |
3 | { | |
4 | string value; | |
5 | ||
6 | d_position = | |
7 | d_arg.option(&value, "history-position") && value == "bottom" ? | |
8 | BOTTOM | |
9 | : | |
10 | TOP; | |
11 | ||
12 | imsg << "History elements at the " << | |
13 | (d_position == TOP ? "top" : "bottom") << endl; | |
14 | ||
15 | if (not d_arg.option(&value, "history-lifetime")) | |
16 | { | |
17 | d_oldest = d_now - 24 * 60 * 60 * 30; // 1 month lifetime | |
18 | imsg << "History lifetime: 1M" << endl; | |
19 | return; | |
20 | } | |
21 | ||
22 | A2x a2x(value); | |
23 | ||
24 | d_oldest = a2x; | |
25 | if (a2x.lastFail()) | |
26 | { | |
27 | imsg << "Cannot determine history-lifetime " << value << | |
28 | ", using 1M" << endl; | |
29 | ||
30 | d_oldest = d_now - 24 * 60 * 60 * 30; // 1 month lifetime | |
31 | } | |
32 | else | |
33 | { | |
34 | int lastChar = toupper(*value.rbegin()); | |
35 | ||
36 | imsg << "History lifetime: " << d_oldest << | |
37 | static_cast<char>(lastChar) << endl; | |
38 | d_oldest = d_now - d_oldest * 24 * 60 * 60 * | |
39 | ( | |
40 | lastChar == 'W' ? 7 : | |
41 | lastChar == 'M' ? 30 : | |
42 | lastChar == 'Y' ? 365 : 1 | |
43 | ); | |
44 | } | |
45 | } |
5 | 5 | #define LIBRARY "modules" |
6 | 6 | #define SHAREDREQ "" |
7 | 7 | #define IH ".ih" |
8 | #define PRECOMP "-x c++-header" | |
9 | //#define CLS | |
10 | //#define USE_ALL "a" | |
8 | //#define PRECOMP "-x c++-header" | |
9 | ||
10 | #define CLS | |
11 | ||
12 | #define USE_ALL "a" | |
11 | 13 | #define SOURCES "*.cc" |
12 | 14 | #define USE_ECHO ON |
13 | 15 | #define TMP_DIR "tmp" |
0 | #define CLS | |
1 | #define LIBRARY "modules" | |
2 | #define SOURCES "*.cc" | |
3 | #define OBJ_EXT ".o" | |
4 | #define TMP_DIR "tmp" | |
5 | ||
6 | #define USE_ECHO ON | |
7 | #define IH ".ih" | |
8 | //#define PRECOMP "-x c++-header" | |
9 | //#define USE_ALL "a" | |
10 | ||
11 | #define CXX "g++" | |
12 | #define CXXFLAGS " --std=c++20 -Wall -O2 " \ | |
13 | " -fdiagnostics-color=never " | |
14 | ||
15 | //#define REFRESH | |
16 | //#define LDFLAGS "-s" | |
17 | #define ADD_LIBRARIES "bobcat" | |
18 | #define ADD_LIBRARY_PATHS "" | |
19 | ||
20 | #define DEFCOM "library" |
0 | #include "main.ih" // program header file | |
0 | #include "main.ih" | |
1 | ||
2 | namespace | |
3 | { | |
4 | ArgConfig::LongOption longOpts[] = | |
5 | { | |
6 | {"add-root", ArgConfig::Required}, | |
7 | {"all", 'a'}, | |
8 | {"block-size", 'b'}, | |
9 | {"config-file", 'c'}, | |
10 | {"directories", ArgConfig::Required}, | |
11 | {"generalized-search", 'g'}, | |
12 | {"help", 'h'}, | |
13 | {"input", ArgConfig::None}, | |
14 | {"history", ArgConfig::Optional}, | |
15 | {"history-lifetime", ArgConfig::Required}, | |
16 | {"history-maxsize", ArgConfig::Required}, // history/load.cc | |
17 | {"history-position", ArgConfig::Required}, // top, bottom | |
18 | {"history-separate", ArgConfig::None}, | |
19 | {"homedir-char", ArgConfig::Required}, | |
20 | {"icase", 'i'}, | |
21 | {"start-at", ArgConfig::Required}, | |
22 | {"traditional", ArgConfig::None}, | |
23 | {"verbose", 'V'}, | |
24 | {"version", 'v'}, | |
25 | }; | |
26 | auto longEnd = longOpts + size(longOpts); | |
27 | } | |
1 | 28 | |
2 | 29 | int main(int argc, char **argv) |
3 | 30 | try |
4 | 31 | { |
5 | arguments(argc, argv); | |
32 | Options::initialize("ab:c:gihvV", longOpts, longEnd, argc, argv, | |
33 | Icmbuild::version, usage); | |
6 | 34 | |
7 | 35 | Alternatives alternatives; |
8 | 36 | // select viable alternatives |
11 | 39 | |
12 | 40 | alternatives.order(); // history alternatives first or last |
13 | 41 | |
14 | Filter filter(alternatives); | |
42 | Selector selector(alternatives); | |
15 | 43 | |
16 | filter.select(); // make the selection | |
44 | selector.select(); // make the selection | |
17 | 45 | |
18 | return filter.decided() ? 0 : 1; // return 0 to the OS if the filter | |
46 | return selector.decided() ? 0 : 1; // return 0 to the OS if the selector | |
19 | 47 | // did do its work |
20 | 48 | } |
21 | catch(exception const &err) // handle exceptions | |
49 | catch(...) | |
22 | 50 | { |
23 | cerr << err.what() << endl; | |
24 | cout << ".\n"; // to prevent a directory change | |
25 | return 1; | |
51 | return handle(current_exception()); | |
26 | 52 | } |
27 | catch(int x) | |
28 | { | |
29 | if (x == 0) | |
30 | cerr << "No Solutions\n"; | |
31 | 53 | |
32 | if (ArgConfig::instance().option("hv")) | |
33 | return 0; | |
34 | ||
35 | cout << ".\n"; | |
36 | return x; | |
37 | } |
5 | 5 | #include <bobcat/argconfig> |
6 | 6 | #include <bobcat/mstream> |
7 | 7 | |
8 | #include "options/options.h" | |
8 | 9 | #include "alternatives/alternatives.h" |
9 | #include "filter/filter.h" | |
10 | #include "selector/selector.h" | |
10 | 11 | |
11 | 12 | namespace Icmbuild |
12 | 13 | { |
15 | 16 | extern char author[]; |
16 | 17 | }; |
17 | 18 | |
18 | void arguments(int argc, char **argv); | |
19 | void usage(std::string const &progname); | |
20 | ||
21 | 19 | using namespace std; |
22 | 20 | using namespace FBB; |
21 | ||
22 | int handle(exception_ptr ptr); | |
23 | void noInput(); | |
24 | void usage(string const &progname); | |
25 |
0 | #include "main.ih" | |
1 | ||
2 | void noInput() | |
3 | { | |
4 | if (not Options::input()) | |
5 | cout << ".\n"; // prevents a directory change | |
6 | } |
0 | #include "options.ih" | |
1 | ||
2 | unique_ptr<Options> Options::s_options; | |
3 | ||
4 | bool Options::s_input; | |
5 | ||
6 | char Options::s_defaultConfig[] = ".xdrc"; // in $HOME | |
7 | char Options::s_defaultHistory[] = ".xd.his"; // in $HOME | |
8 | ||
9 | bool Options::s_fromHome[] = // values correspond to | |
10 | { // s_startAt entries | |
11 | true, | |
12 | false, | |
13 | true | |
14 | }; | |
15 | ||
16 | string const Options::s_startAt[] = | |
17 | { | |
18 | "home", | |
19 | "root", | |
20 | "" | |
21 | }; | |
22 | // the last element is used for the default value if | |
23 | // valid alternatives aren't used | |
24 | string const *Options::s_endStartAt = s_startAt + size(s_startAt) - 1; | |
25 | ||
26 | bool Options::s_allDirs[] = | |
27 | { | |
28 | true, | |
29 | false, | |
30 | true | |
31 | }; | |
32 | ||
33 | string const Options::s_dirs[] = | |
34 | { | |
35 | "all", | |
36 | "unique", | |
37 | "" | |
38 | }; | |
39 | ||
40 | string const *Options::s_endDirs = s_dirs + size(s_dirs) - 1; | |
41 | ||
42 | TriState Options::s_addRoot[] = | |
43 | { | |
44 | NEVER, | |
45 | IF_EMPTY, | |
46 | ALWAYS, | |
47 | IF_EMPTY | |
48 | }; | |
49 | ||
50 | string const Options::s_triState[] = | |
51 | { | |
52 | "never", | |
53 | "if-empty", | |
54 | "always", | |
55 | "" | |
56 | }; | |
57 | ||
58 | string const *Options::s_endTriState = s_triState + size(s_triState) - 1; | |
59 | ||
60 | ||
61 | ||
62 | ||
63 |
0 | #include "options.ih" | |
1 | ||
2 | size_t Options::find(char const *longOpt, | |
3 | string const *begin, string const *end) | |
4 | { | |
5 | string value; | |
6 | if (d_arg.option(&value, longOpt) == 0) // not specified, use the | |
7 | { // default | |
8 | imsg << "Option or configfile: No key `" << longOpt << '\'' << endl; | |
9 | return end - begin; | |
10 | } | |
11 | ||
12 | auto ret = find_if( | |
13 | begin, end, | |
14 | [&](string const &entry) | |
15 | { | |
16 | return value == entry; | |
17 | } | |
18 | ); | |
19 | ||
20 | if (ret != end) | |
21 | imsg << "Option or config `" << longOpt << ": " << value << '\'' << | |
22 | endl; | |
23 | else | |
24 | imsg << "`" << longOpt << " " << value << | |
25 | "' not supported. Using the default" << endl; | |
26 | ||
27 | return ret - begin; | |
28 | } |
0 | #include "options.ih" | |
1 | ||
2 | // static | |
3 | string Options::getHome() | |
4 | { | |
5 | string homeDir; | |
6 | ||
7 | char *cp = getenv("HOME"); // determine the homedir | |
8 | ||
9 | if (!cp) // save it | |
10 | homeDir = '/'; | |
11 | else | |
12 | { | |
13 | homeDir = cp; | |
14 | if (homeDir.back() != '/') // ensure final / at the homedir | |
15 | homeDir += '/'; | |
16 | } | |
17 | ||
18 | imsg << "Home directory: " << homeDir << endl; | |
19 | ||
20 | return homeDir; | |
21 | } |
0 | #include "options.ih" | |
1 | ||
2 | int Options::homedirChar() const | |
3 | { | |
4 | string value; | |
5 | ||
6 | if (d_arg.option(&value, "homedir-char") == 0) | |
7 | return '.'; | |
8 | ||
9 | if ("0123456789/"s.find(value.front()) != string::npos) | |
10 | throw Exception{ 1 } << "Character `" << value.front() << | |
11 | "' cannot be used as homedir-character"; | |
12 | ||
13 | return value.front(); | |
14 | } |
0 | ../icmconf.lib⏎ |
0 | #include "options.ih" | |
1 | ||
2 | Options &Options::initialize( | |
3 | char const *optString, | |
4 | ArgConfig::LongOption const *const begin, | |
5 | ArgConfig::LongOption const *const end, | |
6 | int argc, char **argv, char const *version, | |
7 | void (*usage)(string const &) | |
8 | ) | |
9 | { | |
10 | if (s_options) | |
11 | throw Exception{} << "Options already initialized"; | |
12 | ||
13 | s_options = unique_ptr<Options>{ | |
14 | new Options{ optString, begin, end, argc, argv, | |
15 | version, usage } | |
16 | }; | |
17 | ||
18 | return *s_options; | |
19 | } |
0 | #include "options.ih" | |
1 | ||
2 | Options &Options::instance() | |
3 | { | |
4 | if (not s_options) | |
5 | throw Exception{} << "Options not yet initialized"; | |
6 | ||
7 | return *s_options; | |
8 | } |
0 | inline TriState Options::addRoot() const | |
1 | { | |
2 | return d_addRoot; | |
3 | } | |
4 | ||
5 | inline bool Options::all() const | |
6 | { | |
7 | return d_arg.option('a'); | |
8 | } | |
9 | ||
10 | inline bool Options::allDirs() const | |
11 | { | |
12 | return d_allDirs; | |
13 | } | |
14 | ||
15 | inline FBB::Ranger<char const **> Options::args() const | |
16 | { | |
17 | return FBB::ranger(d_arg.argPointers(), d_arg.nArgs()); | |
18 | } | |
19 | ||
20 | inline size_t Options::blockSize() const | |
21 | { | |
22 | return d_blockSize; | |
23 | } | |
24 | ||
25 | ||
26 | inline bool Options::fromHome() const | |
27 | { | |
28 | return d_fromHome; | |
29 | } | |
30 | ||
31 | inline bool Options::generalized() const | |
32 | { | |
33 | return d_arg.option('g'); | |
34 | } | |
35 | ||
36 | inline size_t Options::historyLifetime() const | |
37 | { | |
38 | return d_historyLifetime; | |
39 | } | |
40 | ||
41 | inline size_t Options::historyMaxSize() const | |
42 | { | |
43 | return d_historyMaxSize; | |
44 | } | |
45 | ||
46 | inline std::string const &Options::history() const | |
47 | { | |
48 | return d_history; | |
49 | } | |
50 | ||
51 | inline std::string const &Options::homeDir() const | |
52 | { | |
53 | return d_homeDir; | |
54 | } | |
55 | ||
56 | inline size_t Options::icase() const | |
57 | { | |
58 | return d_arg.option('i'); | |
59 | } | |
60 | ||
61 | // static | |
62 | inline bool Options::input() | |
63 | { | |
64 | return s_input; | |
65 | } | |
66 | ||
67 | inline auto Options::ignore() const | |
68 | { | |
69 | return d_arg.beginEndRE("^\\s*ignore\\s+\\S+\\s*$"); | |
70 | } | |
71 | ||
72 | inline size_t Options::now() const | |
73 | { | |
74 | return d_now; | |
75 | } | |
76 | ||
77 | inline Position Options::historyPosition() const | |
78 | { | |
79 | return d_historyPosition; | |
80 | } | |
81 | ||
82 | inline bool Options::separate() const | |
83 | { | |
84 | return d_separate; | |
85 | } | |
86 | ||
87 | inline bool Options::traditional() const | |
88 | { | |
89 | return d_arg.option(0, "traditional"); | |
90 | } | |
91 | ||
92 | ||
93 | inline std::string const &Options::triStateStr() const | |
94 | { | |
95 | return s_triState[d_addRoot]; | |
96 | } | |
97 | ||
98 | ||
99 | ||
100 | ||
101 | ||
102 | ||
103 |
0 | #ifndef INCLUDED_OPTIONS_ | |
1 | #define INCLUDED_OPTIONS_ | |
2 | ||
3 | #include <string> | |
4 | #include <memory> | |
5 | ||
6 | #include <bobcat/argconfig> | |
7 | #include <bobcat/ranger> | |
8 | ||
9 | #include "../enums/enums.h" | |
10 | ||
11 | class Options | |
12 | { | |
13 | FBB::ArgConfig &d_arg; | |
14 | ||
15 | bool d_allDirs; | |
16 | TriState d_addRoot; | |
17 | size_t d_blockSize; | |
18 | bool d_fromHome; | |
19 | std::string d_history; // history filename | |
20 | size_t d_historyLifetime; | |
21 | size_t d_historyMaxSize; | |
22 | Position d_historyPosition; | |
23 | std::string d_homeDir; | |
24 | size_t d_now; | |
25 | bool d_separate; // separate previously made choices from | |
26 | // new ones by a blank line | |
27 | ||
28 | static bool s_input; | |
29 | ||
30 | static char s_defaultConfig[]; | |
31 | static char s_defaultHistory[]; | |
32 | ||
33 | static std::unique_ptr<Options> s_options; | |
34 | ||
35 | static bool s_fromHome[]; | |
36 | static std::string const s_startAt[]; | |
37 | static std::string const *s_endStartAt; | |
38 | ||
39 | static bool s_allDirs[]; | |
40 | static std::string const s_dirs[]; | |
41 | static std::string const *s_endDirs; | |
42 | ||
43 | static TriState s_addRoot[]; | |
44 | static std::string const s_triState[]; | |
45 | static std::string const *s_endTriState; | |
46 | ||
47 | public: | |
48 | Options(Options const &other) = delete; | |
49 | ||
50 | static Options &initialize( | |
51 | char const *optString, | |
52 | FBB::ArgConfig::LongOption const *const begin, | |
53 | FBB::ArgConfig::LongOption const *const end, | |
54 | int argc, char **argv, char const *version, | |
55 | void (*usage)(std::string const &) | |
56 | ); | |
57 | static Options &instance(); | |
58 | ||
59 | TriState addRoot() const; // .f | |
60 | ||
61 | bool all() const; // option -a / --all // .f | |
62 | ||
63 | bool allDirs() const; // .f | |
64 | ||
65 | FBB::Ranger<char const **> args() const; | |
66 | ||
67 | size_t blockSize() const; // .f | |
68 | ||
69 | bool fromHome() const; // .f | |
70 | ||
71 | bool generalized() const; // --generalized-search / -g .f | |
72 | ||
73 | std::string const &history() const; // .f | |
74 | size_t historyLifetime() const; // .f | |
75 | size_t historyMaxSize() const; // .f | |
76 | ||
77 | std::string const &homeDir() const; // .f | |
78 | ||
79 | int homedirChar() const; | |
80 | ||
81 | size_t icase() const; // .f | |
82 | ||
83 | auto ignore() const; // .f | |
84 | ||
85 | static bool input(); // .f | |
86 | ||
87 | size_t now() const; // .f | |
88 | ||
89 | Position historyPosition() const; // .f | |
90 | ||
91 | bool separate() const; // .f | |
92 | ||
93 | bool traditional() const; // --traditional .f | |
94 | ||
95 | std::string const &triStateStr() const; // .f | |
96 | ||
97 | private: | |
98 | Options(char const *optString, | |
99 | FBB::ArgConfig::LongOption const *const begin, | |
100 | FBB::ArgConfig::LongOption const *const end, | |
101 | int argc, char **argv, char const *version, | |
102 | void (*usage)(std::string const &)); | |
103 | ||
104 | size_t find(char const *longOpt, | |
105 | std::string const *begin, std::string const *end); | |
106 | ||
107 | static std::string getHome(); | |
108 | ||
109 | std::string readConfigFile(); // ret. value not empty: imsg | |
110 | ||
111 | void setBlockSize(); | |
112 | ||
113 | void setHistory(); // history filename | |
114 | void setHistoryLifetime(); | |
115 | void setMaxSize(); | |
116 | void setPosition(); | |
117 | ||
118 | void versionHelp(char const *version, | |
119 | void (*usage)(std::string const &)) const; | |
120 | ||
121 | }; | |
122 | ||
123 | #include "options.f" | |
124 | ||
125 | #endif | |
126 | ||
127 | ||
128 |
0 | #include "options.h" | |
1 | ||
2 | #include <ctime> | |
3 | ||
4 | #include <iostream> | |
5 | #include <string_view> | |
6 | #include <algorithm> | |
7 | ||
8 | #include <bobcat/exception> | |
9 | #include <bobcat/mstream> | |
10 | #include <bobcat/stat> | |
11 | ||
12 | using namespace std; | |
13 | using namespace FBB; |
0 | #define XERR | |
1 | #include "options.ih" | |
2 | ||
3 | Options::Options(char const *optString, | |
4 | ArgConfig::LongOption const *const begin, | |
5 | ArgConfig::LongOption const *const end, | |
6 | int argc, char **argv, char const *version, | |
7 | void (*usage)(std::string const &)) | |
8 | : | |
9 | d_arg(ArgConfig::initialize(optString, begin, end, argc, argv)), | |
10 | d_now(time(0)), | |
11 | d_separate(d_arg.option(0, "history-separate")) | |
12 | { | |
13 | string_view last{ argv[argc - 1] }; // remove a last / from the last | |
14 | if (last.back() == '/') // argv element | |
15 | argv[argc - 1][last.length() - 1] = 0; | |
16 | ||
17 | d_arg.setCommentHandling(ArgConfig::RemoveComment); | |
18 | ||
19 | imsg.reset(cerr); // mstream messages go to cerr | |
20 | imsg.setActive(d_arg.option('V')); | |
21 | ||
22 | fmsg.reset(cerr); | |
23 | ||
24 | d_homeDir = getHome(); | |
25 | ||
26 | string msg = readConfigFile(); | |
27 | ||
28 | s_input = d_arg.option(0, "input") != 0; | |
29 | ||
30 | versionHelp(version, usage); | |
31 | ||
32 | if (not msg.empty()) | |
33 | imsg << msg << endl; | |
34 | ||
35 | if (s_input) | |
36 | imsg << "shell-input a non selection/space character" << endl; | |
37 | else | |
38 | imsg << "xd ends at a non selection/space character" << endl; | |
39 | ||
40 | d_fromHome = s_fromHome[ find("start-at", s_startAt, s_endStartAt) ]; | |
41 | d_allDirs = s_allDirs[ find("directories", s_dirs, s_endDirs) ]; | |
42 | ||
43 | d_addRoot = s_addRoot[ find("add-root", s_triState, s_endTriState) ]; | |
44 | ||
45 | ||
46 | setHistory(); // history filename | |
47 | setMaxSize(); // history max size | |
48 | setHistoryLifetime(); | |
49 | setPosition(); // history position | |
50 | setBlockSize(); | |
51 | } | |
52 | ||
53 | ||
54 | ||
55 | ||
56 | ||
57 | ||
58 |
0 | #include "options.ih" | |
1 | ||
2 | string Options::readConfigFile() | |
3 | { | |
4 | string confName; | |
5 | if (d_arg.option(&confName, 'c')) // at -c: read the specified | |
6 | d_arg.open(confName); // configfile | |
7 | else | |
8 | { // otherwise | |
9 | confName = d_homeDir + s_defaultConfig; | |
10 | ||
11 | if (Stat confStat{ confName }; confStat) | |
12 | { | |
13 | if ((not confStat.mode()) & Stat::UR) | |
14 | wmsg << "Can't read " << confName << endl; | |
15 | else | |
16 | d_arg.open(confName); | |
17 | } | |
18 | } | |
19 | ||
20 | return "Configuration file: " + confName; | |
21 | } |
0 | #include "options.ih" | |
1 | ||
2 | void Options::setBlockSize() | |
3 | { | |
4 | string value; | |
5 | d_blockSize = d_arg.option(&value, 'b') ? stoul(value) : UINT_MAX; | |
6 | ||
7 | imsg << "Block size: " << d_blockSize << endl; | |
8 | } |
0 | // --history | |
1 | // --------------------------------- | |
2 | // no empty non-empty | |
3 | // default default as spec'd | |
4 | // ---------------------------------- | |
5 | ||
6 | #include "options.ih" | |
7 | ||
8 | void Options::setHistory() // history filename | |
9 | { | |
10 | if (not d_arg.option(&d_history, "history")) | |
11 | { | |
12 | imsg << "History file: not used" << endl; | |
13 | return; | |
14 | } | |
15 | ||
16 | if (d_history.empty()) | |
17 | d_history = s_defaultHistory; // set default history filename | |
18 | ||
19 | imsg << "History file: " << d_history << endl; | |
20 | } | |
21 | ||
22 |
0 | #include "options.ih" | |
1 | ||
2 | void Options::setHistoryLifetime() | |
3 | { | |
4 | string value; | |
5 | ||
6 | if (not d_arg.option(&value, "history-lifetime")) | |
7 | { | |
8 | d_historyLifetime = d_now - 24 * 60 * 60 * 30; // 1 month lifetime | |
9 | imsg << "History lifetime: 1M" << endl; | |
10 | return; | |
11 | } | |
12 | ||
13 | try | |
14 | { | |
15 | d_historyLifetime = stoul(value); | |
16 | } | |
17 | catch (...) | |
18 | { | |
19 | imsg << "Cannot determine history-lifetime " << value << | |
20 | ", using 1M" << endl; | |
21 | ||
22 | d_historyLifetime = d_now - 24 * 60 * 60 * 30; // 1 month lifetime | |
23 | return; | |
24 | } | |
25 | ||
26 | int lastChar = toupper(*value.rbegin()); | |
27 | ||
28 | imsg << "History lifetime: " << d_historyLifetime << | |
29 | static_cast<char>(lastChar) << endl; | |
30 | ||
31 | d_historyLifetime = d_now - d_historyLifetime * 24 * 60 * 60 * | |
32 | ( | |
33 | lastChar == 'W' ? 7 : | |
34 | lastChar == 'M' ? 30 : | |
35 | lastChar == 'Y' ? 365 : 1 | |
36 | ); | |
37 | } |
0 | #include "options.ih" | |
1 | ||
2 | void Options::setMaxSize() | |
3 | { | |
4 | string value; | |
5 | if (d_arg.option(&value, "history-maxsize")) | |
6 | { | |
7 | d_historyMaxSize = stoul(value); | |
8 | imsg << "History max size: " << d_historyMaxSize << " elements" << | |
9 | endl; | |
10 | } | |
11 | else | |
12 | { | |
13 | d_historyMaxSize = UINT_MAX; | |
14 | imsg << "History max size: none" << endl; | |
15 | } | |
16 | } |
0 | #include "options.ih" | |
1 | ||
2 | void Options::setPosition() | |
3 | { | |
4 | string value; | |
5 | ||
6 | d_historyPosition = | |
7 | d_arg.option(&value, "history-position") && value == "bottom" ? | |
8 | BOTTOM | |
9 | : | |
10 | TOP; | |
11 | ||
12 | imsg << "History elements at the " << | |
13 | (d_historyPosition == TOP ? "top" : "bottom") << endl; | |
14 | ||
15 | } |
0 | #include "options.ih" | |
1 | ||
2 | void Options::versionHelp(char const *version, | |
3 | void (*usage)(string const &)) const | |
4 | { | |
5 | streambuf *buf = cout.rdbuf(cerr.rdbuf()); // make sure that | |
6 | try // versionHelp doesn't | |
7 | { // write to cout | |
8 | ||
9 | d_arg.versionHelp(usage, version, 1); // need at least 1 arg | |
10 | cout.rdbuf(buf); // insert the help | |
11 | } | |
12 | catch(...) | |
13 | { | |
14 | cout.rdbuf(buf); // missing argument: | |
15 | throw; // help is provided and | |
16 | // ends the program | |
17 | } | |
18 | ||
19 | } |
0 | #std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >#std::string# | |
1 | #, std::default_delete<Record>## | |
2 | #std::__detail::_Node_iterator<std::pair<unsigned long const, std::unique_ptr<Record > >, false, false>#RecordMap::iterator# | |
3 | #, std::hash<unsigned long>, std::equal_to<unsigned long>, std::allocator<std::pair<unsigned long const, IPbase::KeyMapStruct> >## | |
4 | #[abi:cxx11]## | |
5 | #std::set<std::string, std::less<std::string >, std::allocator<std::string > >#std::set<std::string># |
0 | #include "selector.ih" | |
1 | ||
2 | // alternatives is +.> or -,< | |
3 | // if ch in alternatives, use alternatives.front() for accepted: | |
4 | // accepted is + - or -+ | |
5 | // | |
6 | ||
7 | // static | |
8 | bool Selector::accept(int ch, string const &alternatives, | |
9 | string const &accepted) | |
10 | { | |
11 | return alternatives.find(ch) != string::npos // +.> -,< or both | |
12 | and | |
13 | accepted.find(alternatives.front()) != string::npos; | |
14 | } |
0 | #include "selector.ih" | |
1 | ||
2 | Selector::Action Selector::action(Block const &block) | |
3 | { | |
4 | OneKey oneKey; | |
5 | ||
6 | int ch = oneKey.get(); // get the reply | |
7 | ||
8 | if (accept(ch, s_inc, block.prompt)) // go to the next block | |
9 | return INC; | |
10 | ||
11 | if (accept(ch, s_dec, block.prompt)) // to the previous block | |
12 | return DEC; | |
13 | ||
14 | string blockChars = s_allChars.substr(0, block.end - block.begin); | |
15 | ||
16 | if (size_t idx = blockChars.find(ch); idx != string::npos) | |
17 | d_index = block.begin + idx; | |
18 | else | |
19 | d_index = block.end; | |
20 | ||
21 | //cerr << "action: ch = " << (char)ch << ", int: " << ch << | |
22 | //", d_index = " << d_index << | |
23 | //"selected: " << d_alternatives[d_index] << '\n'; | |
24 | ||
25 | if (ch == '\n') // change \n to ' ' to | |
26 | ch = ' '; // prevent extra prompt | |
27 | ||
28 | if (d_index < block.end) // directory was selected | |
29 | chdir(); // chdir to the alt.[d_index] | |
30 | else | |
31 | noCD(ch); // at --input: shell-input | |
32 | // the entered character | |
33 | return INPUT; | |
34 | } |
0 | #include "selector.ih" | |
1 | ||
2 | vector<Selector::Block> Selector::blockVector(size_t nBlocks) | |
3 | { | |
4 | vector<Block> blocks(nBlocks, {0, 0, "-+" }); | |
5 | ||
6 | blocks.front().prompt = "+"; | |
7 | blocks.front().end = d_blockSize; | |
8 | ||
9 | for (size_t idx = 1, end = blocks.size(); idx != end; ++idx) | |
10 | set(blocks[idx], blocks[idx - 1].end); | |
11 | ||
12 | blocks.back().prompt = "-"; | |
13 | ||
14 | if (blocks.back().end > d_index) // back may not exceed | |
15 | blocks.back().end = d_index; // nAlternatives | |
16 | ||
17 | set(*(blocks.rbegin() + 1), blocks.back()); // inspect the last two sizes | |
18 | ||
19 | return blocks; | |
20 | } |
0 | #include "selector.ih" | |
1 | ||
2 | void Selector::chdir() | |
3 | { | |
4 | d_chdir = true; | |
5 | ||
6 | if (d_ioctl) // --input was specified. | |
7 | input("cd " + d_alternatives[d_index] + '\n'); | |
8 | else | |
9 | cout << d_alternatives[d_index] << '\n'; | |
10 | } |
0 | #include "selector.ih" | |
1 | ||
2 | string Selector::s_allChars{ "123456790" | |
3 | "abcdefghijklmnopqrstuvwxyz" | |
4 | "ABCDEFGHIJKLMNOPQRSTUVWXYZ" }; | |
5 | ||
6 | string Selector::s_inc{ "+.>" }; | |
7 | string Selector::s_dec{ "-,<" }; | |
8 |
0 | #include "selector.ih" | |
1 | ||
2 | bool Selector::decided() const | |
3 | { | |
4 | if (not d_chdir) | |
5 | return false; | |
6 | ||
7 | d_alternatives.update(d_index); | |
8 | return true; | |
9 | } |
0 | ../icmconf.lib⏎ |
0 | #include "selector.ih" | |
1 | ||
2 | // static | |
3 | void Selector::input(string const &text) | |
4 | { | |
5 | Tty tty{ Tty::OFF }; | |
6 | ||
7 | for (char ch: text) | |
8 | ioctl(0, TIOCSTI, &ch); | |
9 | } |
0 | #include "selector.ih" | |
1 | ||
2 | void Selector::noCD(int ch) | |
3 | { | |
4 | if (not d_ioctl) | |
5 | cout << ".\n"; | |
6 | else // --input was specified. | |
7 | { | |
8 | if (not isblank(ch)) | |
9 | input(string{ static_cast<char>(ch) }); | |
10 | } | |
11 | } |
0 | #include "selector.ih" | |
1 | ||
2 | void Selector::select() | |
3 | { | |
4 | switch (d_alternatives.size()) | |
5 | { | |
6 | case 0: // no alternatives, throw avoids | |
7 | throw 0; // updating the alternatives hist. | |
8 | ||
9 | case 1: // one alternative: do the cd | |
10 | imsg << endl; | |
11 | d_index = 0; | |
12 | chdir(); | |
13 | break; | |
14 | ||
15 | default: // otherwise: show all alternatives | |
16 | showAlternatives(); // show the alternatives | |
17 | break; | |
18 | } | |
19 | } |
0 | #ifndef _SELECTOR_H_ | |
1 | #define _SELECTOR_H_ | |
2 | ||
3 | #include <iosfwd> | |
4 | #include <string> | |
5 | #include <vector> | |
6 | ||
7 | class Alternatives; | |
8 | ||
9 | class Selector | |
10 | { | |
11 | enum | |
12 | { | |
13 | MIN_BLOCK_SIZE = 5 | |
14 | }; | |
15 | ||
16 | enum Action | |
17 | { | |
18 | DEC, | |
19 | INC, | |
20 | INPUT | |
21 | }; | |
22 | ||
23 | struct Block | |
24 | { | |
25 | size_t begin; | |
26 | size_t end; | |
27 | std::string prompt; | |
28 | }; | |
29 | ||
30 | Alternatives &d_alternatives; | |
31 | ||
32 | size_t d_index; // constructor: #alternatives, | |
33 | // at select(): selected alternative | |
34 | size_t d_blockSize; | |
35 | bool d_ioctl; // true: --input was specified | |
36 | bool d_chdir; // a chdir decision was made | |
37 | ||
38 | std::string d_selectChars; // d_blockSize substr of s_allChars | |
39 | ||
40 | static std::string s_dec; // chars used to inc. the block-index | |
41 | static std::string s_inc; // chars used to dec. the block-index | |
42 | static std::string s_allChars; // all possible alternative selection | |
43 | // chars. | |
44 | ||
45 | public: | |
46 | Selector(Alternatives &alternatives); | |
47 | ||
48 | void select(); | |
49 | bool decided() const; | |
50 | ||
51 | private: | |
52 | static bool accept(int ch, std::string const &alternatives, | |
53 | std::string const &accepted); | |
54 | Action action(Block const &block); | |
55 | std::vector<Block> blockVector(size_t nBlocks); | |
56 | ||
57 | void chdir(); // changes dir to d_alt.[d_index] | |
58 | static void input(std::string const &text); | |
59 | void noCD(int ch); | |
60 | // set bextBlock's begin/end | |
61 | // fields | |
62 | void set(Block &nextBlock, size_t lastEnd) const; // 1 | |
63 | void set(Block &beforeLast, Block &last); // 2 | |
64 | void setBlockSize(); | |
65 | void showAlternatives(); | |
66 | void show(Block const &block) const; | |
67 | ||
68 | // unused: | |
69 | // size_t show(size_t begin, char first, char last, | |
70 | // size_t separateAt) const; | |
71 | }; | |
72 | ||
73 | #endif |
0 | #include "selector.h" | |
1 | ||
2 | #include <sys/ioctl.h> | |
3 | ||
4 | #include <iostream> | |
5 | #include <iomanip> | |
6 | ||
7 | #include <bobcat/onekey> | |
8 | #include <bobcat/mstream> | |
9 | #include <bobcat/tty> | |
10 | ||
11 | #include "../options/options.h" | |
12 | #include "../alternatives/alternatives.h" | |
13 | ||
14 | using namespace std; | |
15 | using namespace FBB; |
0 | #include "selector.ih" | |
1 | ||
2 | Selector::Selector(Alternatives &alternatives) | |
3 | : | |
4 | d_alternatives(alternatives), | |
5 | d_index(d_alternatives.size()), | |
6 | d_ioctl(Options::instance().input()), | |
7 | d_chdir(false) | |
8 | { | |
9 | setBlockSize(); | |
10 | ||
11 | // d_selectChars = s_selectChars.substr(0, d_blockSize); | |
12 | } |
0 | #include "selector.ih" | |
1 | ||
2 | void Selector::set(Block &nextBlok, size_t lastEnd) const | |
3 | { | |
4 | nextBlok.begin = lastEnd; | |
5 | nextBlok.end = lastEnd + d_blockSize; | |
6 | } |
0 | #include "selector.ih" | |
1 | ||
2 | void Selector::set(Block &beforeLast, Block &last) | |
3 | { | |
4 | if (last.end - last.begin >= MIN_BLOCK_SIZE) // last block: big enough | |
5 | return; | |
6 | ||
7 | size_t beforeSize = (last.end - beforeLast.begin + 1) / 2; | |
8 | ||
9 | beforeLast.end = beforeLast.begin + beforeSize; | |
10 | last.begin = beforeLast.end; | |
11 | } |
0 | #include "selector.ih" | |
1 | ||
2 | void Selector::setBlockSize() | |
3 | { | |
4 | // blockSize cannot exceed the #available | |
5 | // selection chars or the #available | |
6 | // alternatives | |
7 | d_blockSize = Options::instance().blockSize(); | |
8 | ||
9 | if (d_blockSize < MIN_BLOCK_SIZE) | |
10 | d_blockSize = MIN_BLOCK_SIZE; | |
11 | else if (d_blockSize > d_index) | |
12 | d_blockSize = d_index <= s_allChars.size() ? d_index | |
13 | : s_allChars.size(); | |
14 | } | |
15 |
0 | #include "selector.ih" | |
1 | ||
2 | void Selector::show(Block const &block) const | |
3 | { | |
4 | imsg << endl; | |
5 | ||
6 | for ( | |
7 | size_t chIdx = 0, idx = block.begin, | |
8 | separateAt = d_alternatives.separateAt(); | |
9 | idx != block.end; | |
10 | ++idx, ++chIdx | |
11 | ) | |
12 | { | |
13 | if (idx == separateAt) | |
14 | cerr << '\n'; | |
15 | cerr << setw(2) << s_allChars[chIdx] << ": " << | |
16 | d_alternatives[idx] << '\n'; | |
17 | } | |
18 | ||
19 | if (not block.prompt.empty()) | |
20 | cerr << ' ' << block.prompt << '\n'; | |
21 | } | |
22 |
0 | #include "selector.ih" | |
1 | ||
2 | void Selector::showAlternatives() | |
3 | { | |
4 | // # used blocks | |
5 | size_t nBlocks = (d_index + d_blockSize - 1) / d_blockSize; | |
6 | ||
7 | if (nBlocks == 1) // one block: | |
8 | { | |
9 | Block block{ 0, d_index, "" }; | |
10 | show(block); // show the alternatives | |
11 | action(block); // and make a selection | |
12 | return; | |
13 | } | |
14 | ||
15 | vector<Block> blocks = blockVector(nBlocks); | |
16 | ||
17 | size_t idx = 0; | |
18 | while (true) | |
19 | { | |
20 | show(blocks[idx]); | |
21 | switch (action(blocks[idx])) | |
22 | { | |
23 | case Action::DEC: | |
24 | --idx; | |
25 | break; | |
26 | ||
27 | case Action::INC: | |
28 | ++idx; | |
29 | break; | |
30 | ||
31 | case Action::INPUT: | |
32 | return; | |
33 | } | |
34 | } | |
35 | } | |
36 | ||
37 | ||
38 |
0 | 0 | // usage.cc |
1 | 1 | |
2 | 2 | #include "main.ih" |
3 | ||
4 | namespace | |
5 | { | |
6 | ||
7 | char const info1[] = | |
8 | R"( [options] args | |
9 | Where: | |
10 | [options] - optional arguments (short options and default values between | |
11 | parentheses): | |
12 | --all (-a) - skip `ignore' specification in the | |
13 | configuration file | |
14 | --block-size (-b) size - show the alternatives in blocks of max. | |
15 | 'size' alternatives (spacebar to continue) | |
16 | --config-file (-c) <file> - path to the config file to use | |
17 | ($HOME/.xdrc) | |
18 | --add-root <when> - search expansions from / (if-empty) | |
19 | --directories <which> - which directories to show? (default: all) | |
20 | --generalized-search (-g) - use the GDS mode | |
21 | --help (-h) - provide this help | |
22 | --history <fname> - use <fname> to store info about choices | |
23 | (no history unless specified) | |
24 | --history-lifetime <spec> - specify the max. lifetime of previously made | |
25 | choices. Use <int>[DWMY] for a lifetime of | |
26 | Days, Months, Weeks, or Years | |
27 | --history-position <where = TOP> - where to put the previously made choices | |
28 | (TOP, BOTTOM) | |
29 | --history-maxsize <size = UINT_MAX> - display at most <size> previously | |
30 | made choices | |
31 | --history-separate - separate previously made choices from new ones | |
32 | by a blank line (not with --block-size) | |
33 | --input - a non-selection character ends XD and is entered | |
34 | into the shell's input stream | |
35 | --start-at <origin> - where to start the search? (default: home dir.) | |
36 | --traditional - use the traditional mode | |
37 | --version (-v) - show version information and terminate | |
38 | --verbose (-V) - show )"; | |
39 | ||
40 | char const info2[] = | |
41 | R"('s actions in detail | |
42 | args - arguments, possibly containing directory separators [/-]. | |
43 | ||
44 | )"; | |
45 | ||
46 | char const info3[] = | |
47 | R"( eXchanges Directories by interpreting the characters of its | |
48 | argument(s) as the initial characters of nested subdirectories. | |
49 | Multiple arguments or arguments separated by / or - define the | |
50 | initial characters of subsequently nested subdirectories. | |
51 | ||
52 | If the first argument starts with . expansion starts at the user's | |
53 | home directory; if it's 0 expansion starts in the current directory; | |
54 | if it's / expansion starts at the root; if it's a number (1 .. 9) | |
55 | expansion starts at parent <number>; otherwise expansion starts | |
56 | at the location defined by the configuration file | |
57 | ||
58 | When the specification results in multiple solutions, a final | |
59 | selection is requested from a displayed list of alternatives. | |
60 | ||
61 | Use 'man xd' or read the xdrc file provided with the distribution | |
62 | for details about ")"; | |
63 | ||
64 | char const info4[] = | |
65 | R"('s configuration file | |
66 | ||
67 | )"; | |
68 | ||
69 | } | |
3 | 70 | |
4 | 71 | void usage(std::string const &progname) |
5 | 72 | { |
7 | 74 | progname << " by " << Icmbuild::author << "\n" << |
8 | 75 | progname << " V" << Icmbuild::version << " " << Icmbuild::year << "\n" |
9 | 76 | "\n" |
10 | "Usage: " << progname << " [options] args\n" | |
11 | "Where:\n" | |
12 | " [options] - optional arguments (short options and default values " | |
13 | "between\n" | |
14 | " parentheses):\n" | |
15 | " --all (-a) - skip `ignore' specification in the\n" | |
16 | " configuration file\n" | |
17 | " --config-file (-c) <file> - path to the config file to use\n" | |
18 | " ($HOME/.xdrc)\n" | |
19 | " --add-root <when> - search expansions from /\n" | |
20 | " (if-empty)\n" | |
21 | " --directories <which> - which directories to show?\n" | |
22 | " (all)\n" | |
23 | " --generalized-search (-g) - use the GDS mode\n" | |
24 | " --help (-h) - provide this help\n" | |
25 | " --history <fname> - use <fname> to store info about choices\n" | |
26 | " (no history unless specified)\n" | |
27 | " --history-lifetime <spec> - specify the max. lifetime of previously " | |
28 | "made\n" | |
29 | " choices. Use <int>[DWMY] for a lifetime\n" | |
30 | " of Days, Months, Weeks, or Years\n" | |
31 | " --history-position <where = TOP> - where to put the previously made " | |
32 | "choices\n" | |
33 | " (TOP, BOTTOM)\n" | |
34 | " --history-maxsize <size = UINT_MAX> - display at most <size> " | |
35 | "previously\n" | |
36 | " made choices\n" | |
37 | " --history-separate - separate previously made choices from new\n" | |
38 | " ones by a blank line\n" | |
77 | "Usage: " << progname << info1 << progname << info2 << | |
78 | progname << info3 << progname << info4; | |
79 | } | |
39 | 80 | |
40 | " --start-at <origin> - where to start the search? (home)\n" | |
41 | " --traditional - use the traditional mode\n" | |
42 | " --version (-v) - show version information and terminate\n" | |
43 | " --verbose (-V) - show " << progname << "'s actions in " | |
44 | "detail\n" | |
45 | " args - arguments, possibly containing directory separators [/-].\n" | |
46 | "\n" << | |
47 | progname << | |
48 | " eXchanges Directories by interpreting the characters of its\n" | |
49 | "argument(s) as the initial characters of nested subdirectories.\n" | |
50 | "Multiple arguments or arguments separated by / or - define the\n" | |
51 | "initial characters of subsequently nested subdirectories.\n" | |
52 | "\n" | |
53 | "If the first argument starts with . expansion starts at the user's\n" | |
54 | "home directory; if it's 0 expansion starts in the current directory;\n" | |
55 | "if it's / expansion starts at the root; if it's a number (1 .. 9) \n" | |
56 | "expansion starts at parent <number>; otherwise expansion starts\n" | |
57 | "at the location defined by the configuration file\n" | |
58 | "\n" | |
59 | "When the specification results in multiple solutions, a final\n" | |
60 | "selection is requested from a displayed list of alternatives.\n" | |
61 | "\n" | |
62 | "Use 'man xd' or read the xdrc file provided with the distribution\n" | |
63 | "for details about " << progname << "'s configuration file\n" | |
64 | "\n"; | |
65 | } | |
81 | ||
82 | ||
83 | ||
84 | ||
85 |
0 | 0 | oxref by Frank B. Brokken (f.b.brokken@rug.nl) |
1 | oxref V1.00.06 2012-2015 | |
2 | ||
3 | CREATED Thu, 24 Jan 2019 10:58:07 +0000 | |
4 | CROSS REFERENCE FOR: -fxs tmp/libmodules.a | |
1 | oxref V2.00.01 2012-2021 | |
2 | ||
3 | CREATED Sun, 19 Jun 2022 10:48:53 +0000 | |
4 | CROSS REFERENCE FOR: -r replacements -t main -fxs tmp/libmodules.a tmp/main.o | |
5 | ||
5 | 6 | ---------------------------------------------------------------------- |
7 | CROSS REFERENCE LISTING: | |
8 | ||
9 | accept(int, std::string const&, std::string const&) | |
10 | Full name: Selector::accept(int, std::string const&, std::string const&) | |
11 | Source: accept.cc | |
12 | Used By: | |
13 | action.cc: Selector::action(Selector::Block const&) | |
14 | ||
15 | action(Selector::Block const&) | |
16 | Full name: Selector::action(Selector::Block const&) | |
17 | Source: action.cc | |
18 | Used By: | |
19 | showalternatives.cc: Selector::showAlternatives() | |
6 | 20 | |
7 | 21 | add(char const*) |
8 | 22 | Full name: Alternatives::add(char const*) |
9 | Source: add.cc | |
23 | Source: add.cc | |
10 | 24 | Used By: |
11 | 25 | globfilter.cc: Alternatives::globFilter(char const*, Alternatives::GlobContext&) |
12 | 26 | |
13 | addIgnored(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&) | |
14 | Full name: Alternatives::addIgnored(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&) | |
15 | Source: addignored.cc | |
16 | Used By: | |
17 | globfrom.cc: Alternatives::globFrom(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) | |
27 | addIgnored(std::string const&, std::set<std::string>&) | |
28 | Full name: Alternatives::addIgnored(std::string const&, std::set<std::string>&) | |
29 | Source: addignored.cc | |
30 | Used By: | |
31 | globfrom.cc: Alternatives::globFrom(std::string) | |
32 | ||
33 | Alternatives() | |
34 | Full name: Alternatives::Alternatives() | |
35 | Source: alternatives1.cc | |
36 | Used By: | |
37 | main.cc: main | |
18 | 38 | |
19 | 39 | author |
20 | 40 | Full name: Icmbuild::author |
21 | Source: version.cc | |
22 | Used By: | |
23 | usage.cc: usage(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) | |
24 | ||
25 | checkCase(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, unsigned long*) const | |
26 | Full name: Alternatives::checkCase(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, unsigned long*) const | |
27 | Source: checkcase.cc | |
28 | Used By: | |
29 | globpattern.cc: Alternatives::globPattern(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, unsigned long*, Alternatives::GlobContext&) | |
41 | Source: version.cc | |
42 | Used By: | |
43 | usage.cc: usage(std::string const&) | |
44 | ||
45 | blockVector(unsigned long) | |
46 | Full name: Selector::blockVector(unsigned long) | |
47 | Source: blockvector.cc | |
48 | Used By: | |
49 | showalternatives.cc: Selector::showAlternatives() | |
50 | ||
51 | chdir() | |
52 | Full name: Selector::chdir() | |
53 | Source: chdir.cc | |
54 | Used By: | |
55 | action.cc: Selector::action(Selector::Block const&) | |
56 | select.cc: Selector::select() | |
57 | ||
58 | checkCase(std::string&, unsigned long*) const | |
59 | Full name: Alternatives::checkCase(std::string&, unsigned long*) const | |
60 | Source: checkcase.cc | |
61 | Used By: | |
62 | globpattern.cc: Alternatives::globPattern(std::string, std::string&, unsigned long*, Alternatives::GlobContext&) | |
30 | 63 | |
31 | 64 | Command() |
32 | 65 | Full name: Command::Command() |
33 | Source: command1.cc | |
66 | Source: command1.cc | |
34 | 67 | Used By: |
35 | 68 | alternatives1.cc: Alternatives::Alternatives() |
36 | 69 | |
37 | 70 | compareTimes(History::HistoryInfo const&, History::HistoryInfo const&) |
38 | 71 | Full name: History::compareTimes(History::HistoryInfo const&, History::HistoryInfo const&) |
39 | Source: comparetimes.cc | |
40 | Used By: | |
41 | save.cc: History::save(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) | |
72 | Source: comparetimes.cc | |
73 | Used By: | |
74 | save.cc: History::save(std::string const&) | |
42 | 75 | |
43 | 76 | concatArgs() |
44 | 77 | Full name: Command::concatArgs() |
45 | Source: concatargs.cc | |
78 | Source: concatargs.cc | |
46 | 79 | Used By: |
47 | 80 | command1.cc: Command::Command() |
48 | 81 | |
49 | configFile() | |
50 | Full name: Alternatives::configFile() | |
51 | Source: configfile.cc | |
52 | Used By: | |
53 | alternatives1.cc: Alternatives::Alternatives() | |
54 | ||
55 | cxx11]() | |
56 | Full name: Alternatives::determineInitialDirectory[abi:cxx11]() | |
57 | Source: determineinitialdir.cc | |
58 | Used By: | |
59 | viable.cc: Alternatives::viable() | |
60 | ||
61 | cxx11]() | |
62 | Full name: Alternatives::getHome[abi:cxx11]() | |
63 | Source: gethome.cc | |
64 | Used By: | |
65 | alternatives1.cc: Alternatives::Alternatives() | |
82 | decided() const | |
83 | Full name: Selector::decided() const | |
84 | Source: decided.cc | |
85 | Used By: | |
86 | main.cc: main | |
66 | 87 | |
67 | 88 | determineAction() |
68 | 89 | Full name: Command::determineAction() |
69 | Source: determineaction.cc | |
90 | Source: determineaction.cc | |
70 | 91 | Used By: |
71 | 92 | command1.cc: Command::Command() |
72 | 93 | |
73 | generalizedGlob(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, Alternatives::GlobContext&) | |
74 | Full name: Alternatives::generalizedGlob(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, Alternatives::GlobContext&) | |
75 | Source: generalizedglob.cc | |
76 | Used By: | |
77 | globfrom.cc: Alternatives::globFrom(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) | |
94 | determineInitialDirectory() | |
95 | Full name: Alternatives::determineInitialDirectory() | |
96 | Source: determineinitialdir.cc | |
97 | Used By: | |
98 | viable.cc: Alternatives::viable() | |
99 | ||
100 | dotPattern(std::string const&, Alternatives::GlobContext const&) | |
101 | Full name: Alternatives::dotPattern(std::string const&, Alternatives::GlobContext const&) | |
102 | Source: dotpattern.cc | |
103 | Used By: | |
104 | globfilter.cc: Alternatives::globFilter(char const*, Alternatives::GlobContext&) | |
105 | ||
106 | find(char const*, std::string const*, std::string const*) | |
107 | Full name: Options::find(char const*, std::string const*, std::string const*) | |
108 | Source: find.cc | |
109 | Used By: | |
110 | options1.cc: Options::Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) | |
111 | ||
112 | generalizedGlob(std::string, Alternatives::GlobContext&) | |
113 | Full name: Alternatives::generalizedGlob(std::string, Alternatives::GlobContext&) | |
114 | Source: generalizedglob.cc | |
115 | Used By: | |
116 | globfrom.cc: Alternatives::globFrom(std::string) | |
78 | 117 | |
79 | 118 | getCwd(std::unique_ptr<char, std::default_delete<char> >*) |
80 | 119 | Full name: Alternatives::getCwd(std::unique_ptr<char, std::default_delete<char> >*) |
81 | Source: getcwd.cc | |
82 | Used By: | |
83 | determineinitialdir.cc: Alternatives::determineInitialDirectory[abi:cxx11]() | |
84 | ||
85 | glob(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, Alternatives::GlobContext&) | |
86 | Full name: Alternatives::glob(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, Alternatives::GlobContext&) | |
87 | Source: glob.cc | |
88 | Used By: | |
89 | globfrom.cc: Alternatives::globFrom(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) | |
120 | Source: getcwd.cc | |
121 | Used By: | |
122 | determineinitialdir.cc: Alternatives::determineInitialDirectory() | |
123 | ||
124 | getHome() | |
125 | Full name: Options::getHome() | |
126 | Source: gethome.cc | |
127 | Used By: | |
128 | options1.cc: Options::Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) | |
129 | ||
130 | glob(std::string, Alternatives::GlobContext&) | |
131 | Full name: Alternatives::glob(std::string, Alternatives::GlobContext&) | |
132 | Source: glob.cc | |
133 | Used By: | |
134 | globfrom.cc: Alternatives::globFrom(std::string) | |
90 | 135 | |
91 | 136 | globFilter(char const*, Alternatives::GlobContext&) |
92 | 137 | Full name: Alternatives::globFilter(char const*, Alternatives::GlobContext&) |
93 | Source: globfilter.cc | |
94 | Used By: | |
95 | glob.cc: Alternatives::glob(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, Alternatives::GlobContext&) | |
96 | globpattern.cc: Alternatives::globPattern(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, unsigned long*, Alternatives::GlobContext&) | |
97 | ||
98 | globFrom(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) | |
99 | Full name: Alternatives::globFrom(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) | |
100 | Source: globfrom.cc | |
138 | Source: globfilter.cc | |
139 | Used By: | |
140 | glob.cc: Alternatives::glob(std::string, Alternatives::GlobContext&) | |
141 | globpattern.cc: Alternatives::globPattern(std::string, std::string&, unsigned long*, Alternatives::GlobContext&) | |
142 | ||
143 | globFrom(std::string) | |
144 | Full name: Alternatives::globFrom(std::string) | |
145 | Source: globfrom.cc | |
101 | 146 | Used By: |
102 | 147 | viable.cc: Alternatives::viable() |
103 | 148 | |
104 | globHead(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, Alternatives::GlobContext&) | |
105 | Full name: Alternatives::globHead(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, Alternatives::GlobContext&) | |
106 | Source: globhead.cc | |
107 | Used By: | |
108 | generalizedglob.cc: Alternatives::generalizedGlob(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, Alternatives::GlobContext&) | |
109 | globpattern.cc: Alternatives::globPattern(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, unsigned long*, Alternatives::GlobContext&) | |
110 | ||
111 | globPattern(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, unsigned long*, Alternatives::GlobContext&) | |
112 | Full name: Alternatives::globPattern(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, unsigned long*, Alternatives::GlobContext&) | |
113 | Source: globpattern.cc | |
114 | Used By: | |
115 | globhead.cc: Alternatives::globHead(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, Alternatives::GlobContext&) | |
116 | ||
117 | History(FBB::ArgConfig&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) | |
118 | Full name: History::History(FBB::ArgConfig&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) | |
119 | Source: history1.cc | |
149 | globHead(std::string const&, std::string, Alternatives::GlobContext&) | |
150 | Full name: Alternatives::globHead(std::string const&, std::string, Alternatives::GlobContext&) | |
151 | Source: globhead.cc | |
152 | Used By: | |
153 | generalizedglob.cc: Alternatives::generalizedGlob(std::string, Alternatives::GlobContext&) | |
154 | globpattern.cc: Alternatives::globPattern(std::string, std::string&, unsigned long*, Alternatives::GlobContext&) | |
155 | ||
156 | globPattern(std::string, std::string&, unsigned long*, Alternatives::GlobContext&) | |
157 | Full name: Alternatives::globPattern(std::string, std::string&, unsigned long*, Alternatives::GlobContext&) | |
158 | Source: globpattern.cc | |
159 | Used By: | |
160 | globhead.cc: Alternatives::globHead(std::string const&, std::string, Alternatives::GlobContext&) | |
161 | ||
162 | handle(std::__exception_ptr::exception_ptr) | |
163 | Full name: handle(std::__exception_ptr::exception_ptr) | |
164 | Source: handle.cc | |
165 | Used By: | |
166 | main.cc: main | |
167 | ||
168 | History() | |
169 | Full name: History::History() | |
170 | Source: history1.cc | |
120 | 171 | Used By: |
121 | 172 | alternatives1.cc: Alternatives::Alternatives() |
122 | 173 | |
123 | load(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) | |
124 | Full name: History::load(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) | |
125 | Source: load.cc | |
126 | Used By: | |
127 | history1.cc: History::History(FBB::ArgConfig&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) | |
128 | ||
129 | matchIgnore(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) | |
130 | Full name: Alternatives::matchIgnore(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) | |
131 | Source: matchignore.cc | |
132 | Used By: | |
133 | globfilter.cc: Alternatives::globFilter(char const*, Alternatives::GlobContext&) | |
174 | homedirChar() const | |
175 | Full name: Options::homedirChar() const | |
176 | Source: homedirchar.cc | |
177 | Used By: | |
178 | command1.cc: Command::Command() | |
179 | ||
180 | initialize(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) | |
181 | Full name: Options::initialize(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) | |
182 | Source: initialize.cc | |
183 | Used By: | |
184 | main.cc: main | |
185 | ||
186 | input(std::string const&) | |
187 | Full name: Selector::input(std::string const&) | |
188 | Source: input.cc | |
189 | Used By: | |
190 | chdir.cc: Selector::chdir() | |
191 | nocd.cc: Selector::noCD(int) | |
192 | ||
193 | instance() | |
194 | Full name: Options::instance() | |
195 | Source: instance.cc | |
196 | Used By: | |
197 | command1.cc: Command::Command() | |
198 | concatargs.cc: Command::concatArgs() | |
199 | alternatives1.cc: Alternatives::Alternatives() | |
200 | selector1.cc: Selector::Selector(Alternatives&) | |
201 | setblocksize.cc: Selector::setBlockSize() | |
202 | history1.cc: History::History() | |
203 | ||
204 | load() | |
205 | Full name: History::load() | |
206 | Source: load.cc | |
207 | Used By: | |
208 | history1.cc: History::History() | |
209 | ||
210 | matchIgnore(std::string const&, std::string const&) | |
211 | Full name: Alternatives::matchIgnore(std::string const&, std::string const&) | |
212 | Source: matchignore.cc | |
213 | Used By: | |
214 | dotpattern.cc: Alternatives::dotPattern(std::string const&, Alternatives::GlobContext const&) | |
134 | 215 | |
135 | 216 | maybeInsert(History::HistoryInfo const&, std::vector<History::HistoryInfo, std::allocator<History::HistoryInfo> >&, unsigned long) |
136 | 217 | Full name: History::maybeInsert(History::HistoryInfo const&, std::vector<History::HistoryInfo, std::allocator<History::HistoryInfo> >&, unsigned long) |
137 | Source: maybeinsert.cc | |
138 | Used By: | |
139 | load.cc: History::load(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) | |
218 | Source: maybeinsert.cc | |
219 | Used By: | |
220 | load.cc: History::load() | |
221 | ||
222 | noCD(int) | |
223 | Full name: Selector::noCD(int) | |
224 | Source: nocd.cc | |
225 | Used By: | |
226 | action.cc: Selector::action(Selector::Block const&) | |
227 | ||
228 | noInput() | |
229 | Full name: noInput() | |
230 | Source: noinput.cc | |
231 | Used By: | |
232 | handle.cc: handle(std::__exception_ptr::exception_ptr) | |
140 | 233 | |
141 | 234 | operator>>(std::istream&, History::HistoryInfo&) |
142 | 235 | Full name: operator>>(std::istream&, History::HistoryInfo&) |
143 | Source: infoopextract.cc | |
144 | Used By: | |
145 | load.cc: History::load(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) | |
236 | Source: infoopextract.cc | |
237 | Used By: | |
238 | load.cc: History::load() | |
239 | ||
240 | Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) | |
241 | Full name: Options::Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) | |
242 | Source: options1.cc | |
243 | Used By: | |
244 | initialize.cc: Options::initialize(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) | |
245 | ||
246 | order() | |
247 | Full name: Alternatives::order() | |
248 | Source: order.cc | |
249 | Used By: | |
250 | main.cc: main | |
251 | ||
252 | readConfigFile() | |
253 | Full name: Options::readConfigFile() | |
254 | Source: readconfigfile.cc | |
255 | Used By: | |
256 | options1.cc: Options::Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) | |
146 | 257 | |
147 | 258 | s_action |
148 | 259 | Full name: Command::s_action |
149 | Source: data.cc | |
260 | Source: data.cc | |
150 | 261 | Used By: |
151 | 262 | command1.cc: Command::Command() |
152 | 263 | |
264 | s_addRoot | |
265 | Full name: Options::s_addRoot | |
266 | Source: data.cc | |
267 | Used By: | |
268 | options1.cc: Options::Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) | |
269 | ||
270 | s_allChars | |
271 | Full name: Selector::s_allChars | |
272 | Source: data.cc | |
273 | Used By: | |
274 | action.cc: Selector::action(Selector::Block const&) | |
275 | setblocksize.cc: Selector::setBlockSize() | |
276 | show.cc: Selector::show(Selector::Block const&) const | |
277 | ||
278 | s_allDirs | |
279 | Full name: Options::s_allDirs | |
280 | Source: data.cc | |
281 | Used By: | |
282 | options1.cc: Options::Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) | |
283 | ||
284 | s_dec | |
285 | Full name: Selector::s_dec | |
286 | Source: data.cc | |
287 | Used By: | |
288 | action.cc: Selector::action(Selector::Block const&) | |
289 | ||
153 | 290 | s_defaultConfig |
154 | Full name: Alternatives::s_defaultConfig | |
155 | Source: data.cc | |
156 | Used By: | |
157 | configfile.cc: Alternatives::configFile() | |
291 | Full name: Options::s_defaultConfig | |
292 | Source: data.cc | |
293 | Used By: | |
294 | readconfigfile.cc: Options::readConfigFile() | |
158 | 295 | |
159 | 296 | s_defaultHistory |
160 | Full name: History::s_defaultHistory | |
161 | Source: data.cc | |
162 | Used By: | |
163 | load.cc: History::load(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) | |
297 | Full name: Options::s_defaultHistory | |
298 | Source: data.cc | |
299 | Used By: | |
300 | sethistory.cc: Options::setHistory() | |
164 | 301 | |
165 | 302 | s_dirs |
166 | Full name: Alternatives::s_dirs | |
167 | Source: data.cc | |
168 | Used By: | |
169 | viable.cc: Alternatives::viable() | |
170 | ||
171 | s_dirsEnd | |
172 | Full name: Alternatives::s_dirsEnd | |
173 | Source: data.cc | |
174 | Used By: | |
175 | viable.cc: Alternatives::viable() | |
303 | Full name: Options::s_dirs | |
304 | Source: data.cc | |
305 | Used By: | |
306 | options1.cc: Options::Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) | |
307 | ||
308 | s_endDirs | |
309 | Full name: Options::s_endDirs | |
310 | Source: data.cc | |
311 | Used By: | |
312 | options1.cc: Options::Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) | |
313 | ||
314 | s_endStartAt | |
315 | Full name: Options::s_endStartAt | |
316 | Source: data.cc | |
317 | Used By: | |
318 | options1.cc: Options::Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) | |
319 | ||
320 | s_endTriState | |
321 | Full name: Options::s_endTriState | |
322 | Source: data.cc | |
323 | Used By: | |
324 | options1.cc: Options::Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) | |
325 | ||
326 | s_fromHome | |
327 | Full name: Options::s_fromHome | |
328 | Source: data.cc | |
329 | Used By: | |
330 | options1.cc: Options::Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) | |
331 | ||
332 | s_inc | |
333 | Full name: Selector::s_inc | |
334 | Source: data.cc | |
335 | Used By: | |
336 | action.cc: Selector::action(Selector::Block const&) | |
337 | ||
338 | s_input | |
339 | Full name: Options::s_input | |
340 | Source: data.cc | |
341 | Used By: | |
342 | noinput.cc: noInput() | |
343 | options1.cc: Options::Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) | |
344 | selector1.cc: Selector::Selector(Alternatives&) | |
345 | ||
346 | s_options | |
347 | Full name: Options::s_options | |
348 | Source: data.cc | |
349 | Used By: | |
350 | initialize.cc: Options::initialize(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) | |
351 | instance.cc: Options::instance() | |
176 | 352 | |
177 | 353 | s_separators |
178 | 354 | Full name: Command::s_separators |
179 | Source: data.cc | |
355 | Source: data.cc | |
180 | 356 | Used By: |
181 | 357 | command1.cc: Command::Command() |
182 | 358 | |
183 | 359 | s_startAt |
184 | Full name: Alternatives::s_startAt | |
185 | Source: data.cc | |
186 | Used By: | |
360 | Full name: Options::s_startAt | |
361 | Source: data.cc | |
362 | Used By: | |
363 | options1.cc: Options::Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) | |
364 | ||
365 | s_triState | |
366 | Full name: Options::s_triState | |
367 | Source: data.cc | |
368 | Used By: | |
369 | options1.cc: Options::Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) | |
187 | 370 | viable.cc: Alternatives::viable() |
188 | 371 | |
189 | s_startAtEnd | |
190 | Full name: Alternatives::s_startAtEnd | |
191 | Source: data.cc | |
192 | Used By: | |
193 | viable.cc: Alternatives::viable() | |
194 | ||
195 | s_triState | |
196 | Full name: Alternatives::s_triState | |
197 | Source: data.cc | |
198 | Used By: | |
199 | viable.cc: Alternatives::viable() | |
200 | ||
201 | s_triStateEnd | |
202 | Full name: Alternatives::s_triStateEnd | |
203 | Source: data.cc | |
204 | Used By: | |
205 | viable.cc: Alternatives::viable() | |
206 | ||
207 | save(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) | |
208 | Full name: History::save(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) | |
209 | Source: save.cc | |
210 | Used By: | |
211 | decided.cc: Filter::decided() const | |
372 | save(std::string const&) | |
373 | Full name: History::save(std::string const&) | |
374 | Source: save.cc | |
375 | Used By: | |
376 | decided.cc: Selector::decided() const | |
377 | ||
378 | select() | |
379 | Full name: Selector::select() | |
380 | Source: select.cc | |
381 | Used By: | |
382 | main.cc: main | |
383 | ||
384 | Selector(Alternatives&) | |
385 | Full name: Selector::Selector(Alternatives&) | |
386 | Source: selector1.cc | |
387 | Used By: | |
388 | main.cc: main | |
212 | 389 | |
213 | 390 | separateAt() const |
214 | 391 | Full name: Alternatives::separateAt() const |
215 | Source: separateat.cc | |
216 | Used By: | |
217 | showalternatives.cc: Filter::showAlternatives() const | |
218 | ||
219 | set(char const*, char const* const*, char const* const*, unsigned long) | |
220 | Full name: Alternatives::set(char const*, char const* const*, char const* const*, unsigned long) | |
221 | Source: set2.cc | |
222 | Used By: | |
223 | viable.cc: Alternatives::viable() | |
224 | ||
225 | setData() | |
226 | Full name: History::setData() | |
227 | Source: setdata.cc | |
228 | Used By: | |
229 | history1.cc: History::History(FBB::ArgConfig&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) | |
230 | ||
231 | setIndex() | |
232 | Full name: Filter::setIndex() | |
233 | Source: setindex.cc | |
234 | Used By: | |
235 | select.cc: Filter::select() | |
236 | ||
237 | show(unsigned long, char, char, unsigned long) const | |
238 | Full name: Filter::show(unsigned long, char, char, unsigned long) const | |
239 | Source: show.cc | |
240 | Used By: | |
241 | showalternatives.cc: Filter::showAlternatives() const | |
242 | ||
243 | showAlternatives() const | |
244 | Full name: Filter::showAlternatives() const | |
245 | Source: showalternatives.cc | |
246 | Used By: | |
247 | select.cc: Filter::select() | |
248 | ||
249 | usage(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) | |
250 | Full name: usage(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) | |
251 | Source: usage.cc | |
252 | Used By: | |
253 | arguments.cc: arguments(int, char**) | |
392 | Source: separateat.cc | |
393 | Used By: | |
394 | show.cc: Selector::show(Selector::Block const&) const | |
395 | ||
396 | set(Selector::Block&, Selector::Block&) | |
397 | Full name: Selector::set(Selector::Block&, Selector::Block&) | |
398 | Source: set2.cc | |
399 | Used By: | |
400 | blockvector.cc: Selector::blockVector(unsigned long) | |
401 | ||
402 | set(Selector::Block&, unsigned long) const | |
403 | Full name: Selector::set(Selector::Block&, unsigned long) const | |
404 | Source: set1.cc | |
405 | Used By: | |
406 | blockvector.cc: Selector::blockVector(unsigned long) | |
407 | ||
408 | setBlockSize() | |
409 | Full name: Selector::setBlockSize() | |
410 | Source: setblocksize.cc | |
411 | Used By: | |
412 | selector1.cc: Selector::Selector(Alternatives&) | |
413 | ||
414 | setBlockSize() | |
415 | Full name: Options::setBlockSize() | |
416 | Source: setblocksize.cc | |
417 | Used By: | |
418 | options1.cc: Options::Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) | |
419 | ||
420 | setHistory() | |
421 | Full name: Options::setHistory() | |
422 | Source: sethistory.cc | |
423 | Used By: | |
424 | options1.cc: Options::Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) | |
425 | ||
426 | setHistoryLifetime() | |
427 | Full name: Options::setHistoryLifetime() | |
428 | Source: sethistorylifetime.cc | |
429 | Used By: | |
430 | options1.cc: Options::Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) | |
431 | ||
432 | setMaxSize() | |
433 | Full name: Options::setMaxSize() | |
434 | Source: setmaxsize.cc | |
435 | Used By: | |
436 | options1.cc: Options::Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) | |
437 | ||
438 | setPosition() | |
439 | Full name: Options::setPosition() | |
440 | Source: setposition.cc | |
441 | Used By: | |
442 | options1.cc: Options::Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) | |
443 | ||
444 | show(Selector::Block const&) const | |
445 | Full name: Selector::show(Selector::Block const&) const | |
446 | Source: show.cc | |
447 | Used By: | |
448 | showalternatives.cc: Selector::showAlternatives() | |
449 | ||
450 | showAlternatives() | |
451 | Full name: Selector::showAlternatives() | |
452 | Source: showalternatives.cc | |
453 | Used By: | |
454 | select.cc: Selector::select() | |
455 | ||
456 | splitBase() | |
457 | Full name: Command::splitBase() | |
458 | Source: splitbase.cc | |
459 | Used By: | |
460 | command1.cc: Command::Command() | |
461 | ||
462 | trailingDotPatterns(std::string const&) | |
463 | Full name: Alternatives::trailingDotPatterns(std::string const&) | |
464 | Source: trailingdotpatterns.cc | |
465 | Used By: | |
466 | globfilter.cc: Alternatives::globFilter(char const*, Alternatives::GlobContext&) | |
467 | ||
468 | usage(std::string const&) | |
469 | Full name: usage(std::string const&) | |
470 | Source: usage.cc | |
471 | Used By: | |
472 | main.cc: main | |
254 | 473 | |
255 | 474 | version |
256 | 475 | Full name: Icmbuild::version |
257 | Source: version.cc | |
258 | Used By: | |
259 | arguments.cc: arguments(int, char**) | |
260 | usage.cc: usage(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) | |
476 | Source: version.cc | |
477 | Used By: | |
478 | usage.cc: usage(std::string const&) | |
479 | main.cc: main | |
480 | ||
481 | versionHelp(char const*, void (*)(std::string const&)) const | |
482 | Full name: Options::versionHelp(char const*, void (*)(std::string const&)) const | |
483 | Source: versionhelp.cc | |
484 | Used By: | |
485 | options1.cc: Options::Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) | |
486 | ||
487 | viable() | |
488 | Full name: Alternatives::viable() | |
489 | Source: viable.cc | |
490 | Used By: | |
491 | main.cc: main | |
261 | 492 | |
262 | 493 | year |
263 | 494 | Full name: Icmbuild::year |
264 | Source: version.cc | |
265 | Used By: | |
266 | usage.cc: usage(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) | |
495 | Source: version.cc | |
496 | Used By: | |
497 | usage.cc: usage(std::string const&) | |
498 | ||
499 | ||
500 | ---------------------------------------------------------------------- | |
501 | CALL TREE FOR: main | |
502 | ||
503 | main | |
504 | +-handle(std::__exception_ptr::exception_ptr) | |
505 | | +-noInput() | |
506 | | +-Options::s_input | |
507 | +-usage(std::string const&) | |
508 | | +-Icmbuild::author | |
509 | | +-Icmbuild::version | |
510 | | +-Icmbuild::year | |
511 | +-Icmbuild::version | |
512 | +-Options::initialize(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) | |
513 | | +-Options::s_options | |
514 | | +-Options::Options(char const*, FBB::LongOption__ const*, FBB::LongOption__ const*, int, char**, char const*, void (*)(std::string const&)) | |
515 | | +-Options::s_input | |
516 | | +-Options::s_triState | |
517 | | +-Options::s_startAt | |
518 | | +-Options::s_dirs | |
519 | | +-Options::s_endTriState | |
520 | | +-Options::s_addRoot | |
521 | | +-Options::s_endDirs | |
522 | | +-Options::s_allDirs | |
523 | | +-Options::s_endStartAt | |
524 | | +-Options::s_fromHome | |
525 | | +-Options::find(char const*, std::string const*, std::string const*) | |
526 | | +-Options::getHome() | |
527 | | +-Options::readConfigFile() | |
528 | | | +-Options::s_defaultConfig | |
529 | | +-Options::versionHelp(char const*, void (*)(std::string const&)) const | |
530 | | +-Options::setHistory() | |
531 | | | +-Options::s_defaultHistory | |
532 | | +-Options::setMaxSize() | |
533 | | +-Options::setHistoryLifetime() | |
534 | | +-Options::setPosition() | |
535 | | +-Options::setBlockSize() | |
536 | +-Alternatives::Alternatives() | |
537 | | +-Options::instance() | |
538 | | | +-Options::s_options | |
539 | | +-Command::Command() | |
540 | | | +-Options::homedirChar() const | |
541 | | | +-Options::instance() | |
542 | | | | +-Options::s_options | |
543 | | | +-Command::concatArgs() | |
544 | | | | +-Options::instance() | |
545 | | | | +-Options::s_options | |
546 | | | +-Command::determineAction() | |
547 | | | +-Command::s_separators | |
548 | | | +-Command::splitBase() | |
549 | | | +-Command::s_action | |
550 | | +-History::History() | |
551 | | +-Options::instance() | |
552 | | | +-Options::s_options | |
553 | | +-History::load() | |
554 | | +-operator>>(std::istream&, History::HistoryInfo&) | |
555 | | +-History::maybeInsert(History::HistoryInfo const&, std::vector<History::HistoryInfo, std::allocator<History::HistoryInfo> >&, unsigned long) | |
556 | +-Alternatives::order() | |
557 | +-Alternatives::viable() | |
558 | | +-Options::s_triState | |
559 | | +-Alternatives::determineInitialDirectory() | |
560 | | | +-Alternatives::getCwd(std::unique_ptr<char, std::default_delete<char> >*) | |
561 | | +-Alternatives::globFrom(std::string) | |
562 | | +-Alternatives::addIgnored(std::string const&, std::set<std::string>&) | |
563 | | +-Alternatives::generalizedGlob(std::string, Alternatives::GlobContext&) | |
564 | | | +-Alternatives::globHead(std::string const&, std::string, Alternatives::GlobContext&) | |
565 | | | +-Alternatives::globPattern(std::string, std::string&, unsigned long*, Alternatives::GlobContext&) | |
566 | | | +-Alternatives::checkCase(std::string&, unsigned long*) const | |
567 | | | +-Alternatives::globHead(std::string const&, std::string, Alternatives::GlobContext&) ==> 4 | |
568 | | | +-Alternatives::globFilter(char const*, Alternatives::GlobContext&) | |
569 | | | +-Alternatives::add(char const*) | |
570 | | | +-Alternatives::dotPattern(std::string const&, Alternatives::GlobContext const&) | |
571 | | | | +-Alternatives::matchIgnore(std::string const&, std::string const&) | |
572 | | | +-Alternatives::trailingDotPatterns(std::string const&) | |
573 | | +-Alternatives::glob(std::string, Alternatives::GlobContext&) | |
574 | | +-Alternatives::globFilter(char const*, Alternatives::GlobContext&) | |
575 | | +-Alternatives::add(char const*) | |
576 | | +-Alternatives::dotPattern(std::string const&, Alternatives::GlobContext const&) | |
577 | | | +-Alternatives::matchIgnore(std::string const&, std::string const&) | |
578 | | +-Alternatives::trailingDotPatterns(std::string const&) | |
579 | +-Selector::decided() const | |
580 | | +-History::save(std::string const&) | |
581 | | +-History::compareTimes(History::HistoryInfo const&, History::HistoryInfo const&) | |
582 | +-Selector::select() | |
583 | | +-Selector::chdir() | |
584 | | | +-Selector::input(std::string const&) | |
585 | | +-Selector::showAlternatives() | |
586 | | +-Selector::action(Selector::Block const&) | |
587 | | | +-Selector::accept(int, std::string const&, std::string const&) | |
588 | | | +-Selector::s_inc | |
589 | | | +-Selector::s_dec | |
590 | | | +-Selector::s_allChars | |
591 | | | +-Selector::chdir() | |
592 | | | | +-Selector::input(std::string const&) | |
593 | | | +-Selector::noCD(int) | |
594 | | | +-Selector::input(std::string const&) | |
595 | | +-Selector::blockVector(unsigned long) | |
596 | | | +-Selector::set(Selector::Block&, unsigned long) const | |
597 | | | +-Selector::set(Selector::Block&, Selector::Block&) | |
598 | | +-Selector::show(Selector::Block const&) const | |
599 | | +-Alternatives::separateAt() const | |
600 | | +-Selector::s_allChars | |
601 | +-Selector::Selector(Alternatives&) | |
602 | +-Options::s_input | |
603 | +-Options::instance() | |
604 | | +-Options::s_options | |
605 | +-Selector::setBlockSize() | |
606 | +-Options::instance() | |
607 | | +-Options::s_options | |
608 | +-Selector::s_allChars |
5 | 5 | # file using the --config-file command line option then program defined |
6 | 6 | # defaults (shown here as well) will be used. |
7 | 7 | |
8 | # All directives and values are interpreted case sensitively | |
8 | # By default directives and values are interpreted case sensitively | |
9 | 9 | |
10 | 10 | # When directives are provided repeatedly the last directive will be used |
11 | 11 | # (except for ignore, which are all interpreted) |
12 | 12 | |
13 | # The program defined default is shown where applicable as a commented out | |
14 | # example | |
13 | # The commented-out examples show the default specifications or (if | |
14 | # indicated so by extra comment) show the specification format | |
15 | 15 | |
16 | 16 | |
17 | 17 | # The add-root directive determines when to perform an additional search |
18 | #starting from the root (/) directory: | |
18 | # starting from the root (/) directory: | |
19 | 19 | # always - an additional search is always performed. |
20 | 20 | # if-empty - an additional search is performed if the initial search |
21 | 21 | # did not yield any directory. |
22 | 22 | # never - no additional search is performed. |
23 | 23 | #add-root if-empty |
24 | 24 | |
25 | # The directories directive defines which directives are shown: | |
26 | # all - show all alternatives, including symbolic links (symlinks) | |
27 | # unique - do not show symlinks to directories | |
25 | # The 'all' directive suppresses the 'ignore' directives. | |
26 | #all # Not used by default, usually specified as command-line option | |
27 | ||
28 | ||
29 | # The block-size directive specifies the max. number of directory alternatives | |
30 | # that are displayed in a block. | |
31 | #block-size 10 # by default no limit, the 10 used here is an example | |
32 | ||
33 | # The directories directive defines which directives are shown: | |
34 | # all - show all alternatives, including symbolic links (symlinks) | |
35 | # unique - do not show symlinks to directories | |
28 | 36 | #directories all |
29 | 37 | |
30 | 38 | # The generalized-search (GDS) on is specified bf(xd) directory separators are |
32 | 40 | # all possible sequential combinations of the initial search command. |
33 | 41 | # Directory separators are honored when specified, even when |
34 | 42 | # generalized-search is specified. However, they are *required* if |
35 | # generalized-search is not specified or (same thing) if | |
36 | #traditional | |
37 | # is instead specified. | |
38 | generalized-search | |
43 | # generalized-search is not specified or (same thing) if 'traditional' | |
44 | # is specified. | |
45 | #generalized-search | |
39 | 46 | |
40 | # The ignore directives (multiple ignore directives are all interpreted) | |
41 | # defines directories that should not appear in alternative | |
42 | # lists. Specifications may end in a final *, indicating that all | |
43 | # directories matching the provided pattern will be ignored. | |
44 | # There is no default. Some exampes: | |
45 | # ignore /usr/lib/bonobo/ | |
46 | # ignore /usr/lib/bonobo-activation/ | |
47 | # or, using a wildcard: | |
48 | # ignore /usr/lib/bonobo* | |
47 | # The homedir-char directive defines the initial specification char used to | |
48 | # specify the user's home-dir | |
49 | #homedir-char . | |
50 | ||
51 | # Specify the name of the history file if a history of previously made | |
52 | # choices most be kept. If only the 'history' directive is specified the | |
53 | # history file is $HOME/.xd.his | |
54 | # The next history directives are only interpreted if the 'history' | |
55 | # directive is specified | |
56 | #history | |
57 | ||
58 | # The lifetime of the entries in the history file. | |
59 | # using D, W, M and Y to represent resp. days, weeks, months, or years. | |
60 | #history-lifetime 1M | |
61 | ||
62 | # The maximum number of entries the history file may contain. | |
63 | #history-maxsize 50 # by default no limit, the 50 used here is an example | |
64 | ||
65 | # Previously found directory alternatives are displayed either | |
66 | # at the top of the list or at the bottom of the list. If omitted then the | |
67 | # elements in the history are intermixed with new alternatives. | |
68 | #history-position top # by default not used, here using 'top' as an example | |
69 | ||
70 | # A blank line is written between the items in the history and new | |
71 | # alternatives (not previously selected). | |
72 | # This option is only interpreted when the previous option is also specified | |
73 | #history-separate # by default not used | |
74 | ||
75 | # The icase option is used to specify case-insensitive pattern matching. By | |
76 | # default case sensitive pattern matching is used. | |
77 | #icase # by default not used | |
78 | ||
79 | # Multiple ignore specifications may be specified. Directories matching the | |
80 | # specification will not show up in the list of alternatives. Specifications | |
81 | # may end in a * | |
82 | #ignore /usr/lib/bonobo* # by default not used: the specification is | |
83 | # provided as an example | |
84 | ||
85 | # The ignore directives (multiple ignore directives are all interpreted) | |
86 | # defines directories that should not appear in alternative | |
87 | # lists. Specifications may end in a final *, indicating that all | |
88 | # directories matching the provided pattern will be ignored. | |
89 | # There is no default. Some examples: | |
90 | # ignore /usr/lib/bonobo/ | |
91 | # ignore /usr/lib/bonobo-activation/ | |
92 | # or, using wildcards: | |
93 | # ignore /usr/lib/bonobo* | |
94 | ||
95 | # Xd itself issues the tt(cd) command for the selected directory to the shell, | |
96 | # and enters other (non alternative-selecting characters) into the shell's | |
97 | # input. | |
98 | #input # by default not used | |
49 | 99 | |
50 | 100 | # The start-at directive defines the origin of the search: |
51 | 101 | # home - start the search from the user's home dir. |
52 | 102 | # root - start the search from the root (/) directory. |
53 | 103 | #start-at home |
54 | 104 | |
55 | # Specify the name of the history file if a history of previously made | |
56 | # choices most be kept. If only the 'history' directive is specified the | |
57 | # history file will be $HOME/.xd.his | |
58 | # Remaining history- directives only have an effect if the 'history' | |
59 | # directive is also specified | |
60 | #history | |
61 | ||
62 | # Specify the maximum lifetime of history items. Use D(ays), W(eeks), | |
63 | # M(onths) or Y(ears), prefixed by a number. By default 1M is used | |
64 | #history-lifetime 1M | |
65 | ||
66 | # Specify the maximum size of the history. By default no limit. | |
67 | # The value shown serves as an example. | |
68 | #history-maxsize 10 | |
69 | ||
70 | # Specify the postion of the history items. When merely the directive is | |
71 | # specified the history items are shown at the top of the | |
72 | # list. Alternatively, use 'history-position bottom' | |
73 | #history-position top | |
74 | ||
75 | # When history-position is specified then 'history-separate' can be used to | |
76 | # insert a blank line between history items and new alternatives. | |
77 | history-separate | |
78 | ||
79 | # Multiple ignore specifications may be specified. Directories matching the | |
80 | # specification will not show up in the list of alternatives. Specifications | |
81 | # should end in a * | |
82 | #ignore /usr/lib/bonobo* | |
83 | ||
84 | # The icase option is used to specify case-insensitive pattern matching. By | |
85 | # default case sensitive pattern matching is used. | |
86 | #icase | |
105 | # Xd does not use GDS but uses its traditional mode | |
106 | #traditional # by default not used |