Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Minor cosmetic changes for help printing

  • Loading branch information...
commit 5fa50704409e4276480462d706262873809f0ae5 1 parent 58faaf2
znort987 authored
7 callback.cpp
View
@@ -37,7 +37,7 @@ Callback *Callback::find(
while(i!=e) {
const char *nm = *(i++);
size_t x = std::min(sz, strlen(nm));
- if(0==memcmp(nm, name, x)) found[(uintptr_t)c] = c;
+ if(0==strncasecmp(nm, name, x)) found[(uintptr_t)c] = c;
}
}
if(1==found.size()) return found.begin()->second;
@@ -94,19 +94,20 @@ struct Writer {
void Callback::showAllHelps()
{
+ Writer writer;
auto e = callbacks->end();
auto i = callbacks->begin();
std::sort(i, e, Cmp());
while(i!=e) {
Callback *c = *(i++);
+ printf(" parser %s", c->name());
const option::Descriptor *usage = c->usage();
if(usage) {
- Writer writer;
- printf("\n");
option::printUsage(&writer, usage);
}
+ printf("\n");
}
printf("\n");
}
4 cb/allBalances.cpp
View
@@ -14,8 +14,8 @@
enum optionIndex { kUnknown };
static const option::Descriptor usageDescriptor[] =
{
- { kUnknown, 0, "", "", option::Arg::None, CBNAME ":\n" },
- { 0, 0, 0, 0, 0, 0 }
+ { kUnknown, 0, "", "", option::Arg::None, "\n\n dump balance of all addresses ever used." },
+ { 0, 0, 0, 0, 0, 0 }
};
struct Addr
14 cb/help.cpp
View
@@ -1,6 +1,7 @@
// Dump help
+#include <stdio.h>
#include <common.h>
#include <option.h>
#include <callback.h>
@@ -9,8 +10,8 @@
enum optionIndex { kUnknown };
static const option::Descriptor usageDescriptor[] =
{
- { kUnknown, 0, "", "", option::Arg::None, CBNAME ":\n" },
- { 0, 0, 0, 0, 0, 0 }
+ { kUnknown, 0, "", "", option::Arg::None, "\n\n print this help message" },
+ { 0, 0, 0, 0, 0, 0 }
};
struct Help:public Callback
@@ -31,6 +32,15 @@ struct Help:public Callback
option::Parser parse(usageDescriptor, argc, argv, options, buffer);
if(parse.error()) exit(1);
+ printf("\n");
+ printf("Usage: parser <command> <command options> <command data>\n");
+ printf("\n");
+ printf(" Note that <command> can be abbreviated and has mutlipled aliases.\n");
+ printf(" For example, \"parser tx\", \"parser tr\", and \"parser transactions\" are equivalent.\n");
+ printf("\n");
+ printf("Available commands:\n");
+ printf("\n");
+
Callback::showAllHelps();
delete [] options;
12 cb/taint.cpp
View
@@ -5,20 +5,20 @@
- Each input i of a given TX has a value Vi and a "taint" Ti (taint = fraction of Vi that's "bad")
- - Each transaction mixer gets from each input:
+ - The TX mixer gets from each input:
Vi * ( Ti) "bad content"
Vi * (1-Ti) "good content"
- - Mixer final taint is : (sum of all "bad content" in inputs) / (sum of all content in inputs)
+ The TX mixer final taint is : (sum of all "bad content" in inputs) / (sum of all content in inputs)
- In other words:
taint = Sum(i, Vi * Ti)/Sum(i, Vi)
- - Finally outputs of a given TX have the exact same taint (fraction of the mixer that's "bad content")
+ - All outputs of TX have the exact same taint (fraction of the TX mixer that's "bad")
- - Apply this recursively from initial TX that's the source of taint
+ - Apply this recursively from initial TX that's the source of taint to all downstream TX
*/
@@ -59,8 +59,8 @@ struct Taint:public Callback
bool ok = (0==argc || 1==argc);
if(!ok) return -1;
- //const uint8_t *defaultTX = (const uint8_t*)"34b84108a142ad7b6c36f0f3549a3e83dcdbb60e0ba0df96cd48f852da0b1acb"; // Linode slush hack
- const uint8_t *defaultTX = (const uint8_t*)"a1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d"; // Expensive pizza
+ //const uint8_t *defaultTX = (const uint8_t*)"a1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d"; // Expensive pizza
+ const uint8_t *defaultTX = (const uint8_t*)"34b84108a142ad7b6c36f0f3549a3e83dcdbb60e0ba0df96cd48f852da0b1acb"; // Linode slush hack
const uint8_t *tx = argc ? (const uint8_t*)argv[0] : defaultTX;
size_t sz = strlen((const char*)tx);
7 cb/transactions.cpp
View
@@ -14,8 +14,8 @@
enum optionIndex { kUnknown, kCSV };
static const option::Descriptor usageDescriptor[] =
{
- { kUnknown, 0, "", "", option::Arg::None, CBNAME ":\n" },
- { kCSV, 0, "", "csv", option::Arg::None, "--csv Dump CSV instead of formatted" },
+ { kUnknown, 0, "", "", option::Arg::None, "[--csv] <addresses>\n" },
+ { kCSV, 0, "", "csv", option::Arg::None, " --csv Dump CSV instead of formatted" },
{ 0, 0, 0, 0, 0, 0 }
};
@@ -84,8 +84,7 @@ struct Transactions:public Callback
uint8_t addrType[3];
uint160_t pubKeyHash;
int type = solveOutputScript(pubKeyHash.v, script, scriptSize, addrType);
- if(unlikely(type<0))
- return;
+ if(unlikely(type<0)) return;
bool match = (addrMap.end() != addrMap.find(pubKeyHash.v));
if(unlikely(match)) {
Please sign in to comment.
Something went wrong with that request. Please try again.