diff options
author | login (tilde.club) <login@tilde.club> | 2020-07-24 16:25:37 +0000 |
---|---|---|
committer | login (tilde.club) <login@tilde.club> | 2020-07-24 16:25:37 +0000 |
commit | 41f968db2a6680e27e35ff21a93bc55d70dc26d7 (patch) | |
tree | 01fd14c034d2af188f974fffed6fb91cb77107ef | |
parent | 08783c2043ba8cf9837267905a32e515a4300c2e (diff) | |
download | tcoin-41f968db2a6680e27e35ff21a93bc55d70dc26d7.tar.gz |
Custom host name possible in tcoin --help now
1. Custom host name now possible in tcoin --help 2. Changes to ntcoin and ntcoin_openbsd_tildeinstitute to fix a bug in -d/--def. 3. Changes to ntcoin and ntcoin_openbsd_tildeinstitute to check for the correct number of arguments. 4. Changes to ntcoin and ntcoin_openbsd_tildeinstitute to include the host name as a preprocessor constant.
-rwxr-xr-x[-rw-r--r--] | ntcoin | 17 | ||||
-rwxr-xr-x | ntcoin_openbsd_tildeinstitute | 15 | ||||
-rw-r--r-- | tcoin.cpp | 7 |
3 files changed, 27 insertions, 12 deletions
diff --git a/ntcoin b/ntcoin index 5f7582d..36b3249 100644..100755 --- a/ntcoin +++ b/ntcoin @@ -1,15 +1,15 @@ -#!/usr/local/bin/bash +#!/usr/bin/bash if [ "$#" -eq 0 ] || [ "$1" = "--help" ] || [ "$1" = "-h" ] then /bin/echo "Usage:" - /bin/echo " ntcoin <path (no slash)> <bin path (no slash)> <n> : to create the tcoin directory in <path (no slash)> with the executable saved to <bin path (no slash)> and with <n> basecoins per user" - /bin/echo " ntcoin <path (no slash)> <bin path (no slash)> [ --def | -d ]: to print only the #define preprocessor directives without creating any directories" + /bin/echo " ntcoin <path (no slash)> <bin path (no slash)> <n> <host name>: to create the tcoin directory in <path (no slash)> with the executable saved to <bin path (no slash)> and with <n> basecoins per user with the help showing the host name <host name>" + /bin/echo " ntcoin <path (no slash)> <bin path (no slash)> <host name> --def | -d: to print only the #define preprocessor directives without creating any directories" /bin/echo " ntcoin [ --help | -h ] : to print this help" -elif [ "$3" = "--def" ] || [ "$3" = "-d" ] +elif [ "$4" = "--def" ] || [ "$4" = "-d" ] then /bin/echo "Printing tcoin.cpp (and pcoin.cpp) preprocessor directives." - /bin/echo 'Paste the following in '`/usr/bin/realpath -s $2`'/tcoin/bin/tcoin_defs.cpp (and '`/usr/bin/realpath -s $1`'/tcoin/bin/pcoin_defs.cpp): + /bin/echo 'Paste the following in '`/usr/bin/realpath -s $1`'/tcoin/bin/tcoin_defs.cpp (and '`/usr/bin/realpath -s $1`'/tcoin/bin/pcoin_defs.cpp): ' /bin/echo '#define TCOIN_PATH "'`/usr/bin/realpath -s $1`'/tcoin" #define TCOIN_MSG_PATH "'`/usr/bin/realpath -s $1`'/tcoin/messages/" @@ -24,6 +24,7 @@ then #define TCOIN_SCRYPT_PATH "'`/usr/bin/realpath -s $1`'/tcoin/bin/scrypt" #define PCOIN_BIN_PATH "'`/usr/bin/realpath -s $2`'/pcoin" #define PCOIN_BIN_PATH_W_SPACE "'`/usr/bin/realpath -s $2`'/pcoin " +#define TCOIN_HOST_NAME "'$3'" #define KROWBAR_OFF #define DA_OFF #define MINERCOIN_OFF' @@ -33,6 +34,11 @@ else ''|*[!0-9]*) /bin/echo "Sorry, the number of basecoins <n> should be a positive integer."; exit 1 ;; *) ;; esac + if [ "$#" -ne 4 ] + then + /bin/echo "Sorry, the number of arguments must be exactly 4." + exit 1 + fi if [ -d "`/usr/bin/realpath -s $1`/tcoin" ] then /bin/echo "Sorry, '`/usr/bin/realpath -s $1`/tcoin' already exists." @@ -152,6 +158,7 @@ else #define TCOIN_BIN_PATH_W_SPACE "'`/usr/bin/realpath -s $2`'/tcoin " #define TCOIN_PATH_W_SLASH "'`/usr/bin/realpath -s $1`'/tcoin/" #define TCOIN_SCRYPT_PATH "'`/usr/bin/realpath -s $1`'/tcoin/bin/scrypt" +#define TCOIN_HOST_NAME "'$4'" #define KROWBAR_OFF #define DA_OFF #define MINERCOIN_OFF' > "`/usr/bin/realpath -s $1`/tcoin/bin/tcoin_defs.cpp" diff --git a/ntcoin_openbsd_tildeinstitute b/ntcoin_openbsd_tildeinstitute index 129e3b8..5f91e88 100755 --- a/ntcoin_openbsd_tildeinstitute +++ b/ntcoin_openbsd_tildeinstitute @@ -3,13 +3,13 @@ if [ "$#" -eq 0 ] || [ "$1" = "--help" ] || [ "$1" = "-h" ] then /bin/echo "Usage:" - /bin/echo " ntcoin <path (no slash)> <bin path (no slash)> <n> : to create the tcoin directory in <path (no slash)> with the executable saved to <bin path (no slash)> and with <n> basecoins per user" - /bin/echo " ntcoin <path (no slash)> <bin path (no slash)> [ --def | -d ]: to print only the #define preprocessor directives without creating any directories" + /bin/echo " ntcoin <path (no slash)> <bin path (no slash)> <n> <host name>: to create the tcoin directory in <path (no slash)> with the executable saved to <bin path (no slash)> and with <n> basecoins per user with the help showing the host name <host name>" + /bin/echo " ntcoin <path (no slash)> <bin path (no slash)> <host name> --def | -d: to print only the #define preprocessor directives without creating any directories" /bin/echo " ntcoin [ --help | -h ] : to print this help" -elif [ "$3" = "--def" ] || [ "$3" = "-d" ] +elif [ "$4" = "--def" ] || [ "$4" = "-d" ] then /bin/echo "Printing tcoin.cpp (and pcoin.cpp) preprocessor directives." - /bin/echo 'Paste the following in '`/usr/local/bin/grealpath -s $2`'/tcoin/bin/tcoin_defs.cpp (and '`/usr/local/bin/grealpath -s $1`'/tcoin/bin/pcoin_defs.cpp): + /bin/echo 'Paste the following in '`/usr/local/bin/grealpath -s $1`'/tcoin/bin/tcoin_defs.cpp (and '`/usr/local/bin/grealpath -s $1`'/tcoin/bin/pcoin_defs.cpp): ' /bin/echo '#define TCOIN_PATH "'`/usr/local/bin/grealpath -s $1`'/tcoin" #define TCOIN_MSG_PATH "'`/usr/local/bin/grealpath -s $1`'/tcoin/messages/" @@ -24,6 +24,7 @@ then #define TCOIN_SCRYPT_PATH "'`/usr/local/bin/grealpath -s $1`'/tcoin/bin/scrypt" #define PCOIN_BIN_PATH "'`/usr/local/bin/grealpath -s $2`'/pcoin" #define PCOIN_BIN_PATH_W_SPACE "'`/usr/local/bin/grealpath -s $2`'/pcoin " +#define TCOIN_HOST_NAME "'$3'" #define KROWBAR_OFF #define DA_OFF #define MINERCOIN_OFF' @@ -33,6 +34,11 @@ else ''|*[!0-9]*) /bin/echo "Sorry, the number of basecoins <n> should be a positive integer."; exit 1 ;; *) ;; esac + if [ "$#" -ne 4 ] + then + /bin/echo "Sorry, the number of arguments must be exactly 4." + exit 1 + fi if [ -d "`/usr/local/bin/grealpath -s $1`/tcoin" ] then /bin/echo "Sorry, '`/usr/local/bin/grealpath -s $1`/tcoin' already exists." @@ -152,6 +158,7 @@ else #define TCOIN_BIN_PATH_W_SPACE "'`/usr/local/bin/grealpath -s $2`'/tcoin " #define TCOIN_PATH_W_SLASH "'`/usr/local/bin/grealpath -s $1`'/tcoin/" #define TCOIN_SCRYPT_PATH "'`/usr/local/bin/grealpath -s $1`'/tcoin/bin/scrypt" +#define TCOIN_HOST_NAME "'$4'" #define KROWBAR_OFF #define DA_OFF #define MINERCOIN_OFF' > "`/usr/local/bin/grealpath -s $1`/tcoin/bin/tcoin_defs.cpp" diff --git a/tcoin.cpp b/tcoin.cpp index 5c9226e..7e01d1f 100644 --- a/tcoin.cpp +++ b/tcoin.cpp @@ -1496,10 +1496,11 @@ int send(const char* sender_username, const char* receiver_username, const long void help(long long int &base_amount) { - std::cout << "\n - tildecoin (also called tcoin) is tilde.town's very own digital (non-crypto) currency."; - std::cout << "\n - to participate in tilde.town's internal economy by creating your own tcoin account, run `tcoin init`."; + std::cout << "\n - tildecoin (also called tcoin) is " << TCOIN_HOST_NAME << "'s very own digital (non-crypto) currency."; + std::cout << "\n - to participate in " << TCOIN_HOST_NAME << "'s internal economy by creating your own tcoin account, run `tcoin init`."; std::cout << "\n - all users get "; cout_formatted_amount(base_amount); std::cout << " coins to start, and can send and receive coins from other users (and programs)."; std::cout << "\n - more information about tildecoin is available at \"https://tilde.town/~login/tcoin.html\".\n"; + std::cout << "\n`tcoin`: check your balance and the 10 latest lines of messages"; std::cout << "\n`tcoin on`: log on to tildecoin"; std::cout << "\n`tcoin off`: out out of tildecoin"; @@ -1514,7 +1515,7 @@ void help(long long int &base_amount) std::cout << "\n`tcoin silentsend <username> <amount> [\"<message>\"]`, `tcoin send -s <username> <amount> [\"<message>\"]` or `tcoin -ss <username> <amount> [\"<message>\"]`: send <amount> tildecoins to <username> with an optional (as indicated by [ and ], which should not be included in the actual comment) message included without printing anything"; std::cout << "\nIn the commands with `<username> <amount>`, switching the two arguments around (i.e., from `<username> <amount>` to `<amount> <username>`) will also work"; std::cout << "\n`tcoin --help`, `tcoin help` or `tcoin -h`: print this help text"; - std::cout << "\nSend an email to `login@tilde.town` (tilde.town local email) or `login@tilde.team` (internet-wide email), or `/query login` on IRC to request a passphrase reset.\n\n"; + std::cout << "\nSend an email to "; `login@tilde.town` (tilde.town local email) or `login@tilde.team` (internet-wide email), or `/query login` on IRC to request a passphrase reset.\n\n"; } bool is_number(const char* test_string) |