From 41f968db2a6680e27e35ff21a93bc55d70dc26d7 Mon Sep 17 00:00:00 2001 From: "login (tilde.club)" Date: Fri, 24 Jul 2020 16:25:37 +0000 Subject: 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. --- ntcoin | 17 ++++++++++++----- ntcoin_openbsd_tildeinstitute | 15 +++++++++++---- tcoin.cpp | 7 ++++--- 3 files changed, 27 insertions(+), 12 deletions(-) mode change 100644 => 100755 ntcoin diff --git a/ntcoin b/ntcoin old mode 100644 new mode 100755 index 5f7582d..36b3249 --- 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 : to create the tcoin directory in with the executable saved to and with basecoins per user" - /bin/echo " ntcoin [ --def | -d ]: to print only the #define preprocessor directives without creating any directories" + /bin/echo " ntcoin : to create the tcoin directory in with the executable saved to and with basecoins per user with the help showing the host name " + /bin/echo " ntcoin --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 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 : to create the tcoin directory in with the executable saved to and with basecoins per user" - /bin/echo " ntcoin [ --def | -d ]: to print only the #define preprocessor directives without creating any directories" + /bin/echo " ntcoin : to create the tcoin directory in with the executable saved to and with basecoins per user with the help showing the host name " + /bin/echo " ntcoin --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 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 [\"\"]`, `tcoin send -s [\"\"]` or `tcoin -ss [\"\"]`: send tildecoins to 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 ` `, switching the two arguments around (i.e., from ` ` to ` `) 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) -- cgit 1.4.1-2-gfad0 /a>
1
2
3
4
5
6
7
8
9