check return value from GNUNET_PROGRAM_run in taler-wire
This commit is contained in:
parent
7d142ad261
commit
8d26ab35e0
@ -16,7 +16,6 @@
|
|||||||
License along with TALER; see the file COPYING. If not,
|
License along with TALER; see the file COPYING. If not,
|
||||||
see <http://www.gnu.org/licenses/>
|
see <http://www.gnu.org/licenses/>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file taler-wire.c
|
* @file taler-wire.c
|
||||||
* @brief Utility performing wire transfers.
|
* @brief Utility performing wire transfers.
|
||||||
@ -102,7 +101,7 @@ struct TALER_WIRE_Plugin *plugin_handle;
|
|||||||
* @return #GNUNET_OK to continue, #GNUNET_SYSERR to
|
* @return #GNUNET_OK to continue, #GNUNET_SYSERR to
|
||||||
* abort iteration
|
* abort iteration
|
||||||
*/
|
*/
|
||||||
int
|
static int
|
||||||
history_cb (void *cls,
|
history_cb (void *cls,
|
||||||
enum TALER_ErrorCode ec,
|
enum TALER_ErrorCode ec,
|
||||||
enum TALER_BANK_Direction dir,
|
enum TALER_BANK_Direction dir,
|
||||||
@ -133,11 +132,12 @@ history_cb (void *cls,
|
|||||||
return GNUNET_OK;
|
return GNUNET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback that processes the outcome of a wire transfer
|
* Callback that processes the outcome of a wire transfer
|
||||||
* execution.
|
* execution.
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
confirmation_cb (void *cls,
|
confirmation_cb (void *cls,
|
||||||
int success,
|
int success,
|
||||||
const void *row_id,
|
const void *row_id,
|
||||||
@ -171,7 +171,7 @@ confirmation_cb (void *cls,
|
|||||||
* @param buf prepared wire transfer data.
|
* @param buf prepared wire transfer data.
|
||||||
* @param buf_size size of the prepared wire transfer data.
|
* @param buf_size size of the prepared wire transfer data.
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
prepare_cb (void *cls,
|
prepare_cb (void *cls,
|
||||||
const char *buf,
|
const char *buf,
|
||||||
size_t buf_size)
|
size_t buf_size)
|
||||||
@ -204,7 +204,7 @@ prepare_cb (void *cls,
|
|||||||
/**
|
/**
|
||||||
* Ask the bank to execute a wire transfer.
|
* Ask the bank to execute a wire transfer.
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
execute_wire_transfer ()
|
execute_wire_transfer ()
|
||||||
{
|
{
|
||||||
struct TALER_Amount a;
|
struct TALER_Amount a;
|
||||||
@ -250,11 +250,12 @@ execute_wire_transfer ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ask the bank the list of transactions for the bank account
|
* Ask the bank the list of transactions for the bank account
|
||||||
* mentioned in the config section given by the user.
|
* mentioned in the config section given by the user.
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
execute_history ()
|
execute_history ()
|
||||||
{
|
{
|
||||||
size_t bin_len = 0;
|
size_t bin_len = 0;
|
||||||
@ -290,9 +291,9 @@ execute_history ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets executed upon shutdown. Main duty is
|
* Gets executed upon shutdown. Main duty is wire-plugin unloading.
|
||||||
* wire-plugin unloading.
|
|
||||||
*
|
*
|
||||||
* @param cls closure.
|
* @param cls closure.
|
||||||
*/
|
*/
|
||||||
@ -302,6 +303,7 @@ do_shutdown (void *cls)
|
|||||||
TALER_WIRE_plugin_unload (plugin_handle);
|
TALER_WIRE_plugin_unload (plugin_handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main function that will be run.
|
* Main function that will be run.
|
||||||
*
|
*
|
||||||
@ -357,6 +359,7 @@ run (void *cls,
|
|||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main function of taler-wire. This tool is used to command the
|
* Main function of taler-wire. This tool is used to command the
|
||||||
* execution of wire transfers from the command line. Its main
|
* execution of wire transfers from the command line. Its main
|
||||||
@ -372,18 +375,15 @@ main (int argc,
|
|||||||
char *const *argv)
|
char *const *argv)
|
||||||
{
|
{
|
||||||
struct GNUNET_GETOPT_CommandLineOption options[] = {
|
struct GNUNET_GETOPT_CommandLineOption options[] = {
|
||||||
|
|
||||||
GNUNET_GETOPT_option_flag ('H',
|
GNUNET_GETOPT_option_flag ('H',
|
||||||
"history",
|
"history",
|
||||||
"Ask to get a list of 10"
|
"Ask to get a list of 10"
|
||||||
" transactions.",
|
" transactions.",
|
||||||
&history),
|
&history),
|
||||||
|
|
||||||
GNUNET_GETOPT_option_flag ('t',
|
GNUNET_GETOPT_option_flag ('t',
|
||||||
"transfer",
|
"transfer",
|
||||||
"Execute a wire transfer.",
|
"Execute a wire transfer.",
|
||||||
&transfer),
|
&transfer),
|
||||||
|
|
||||||
GNUNET_GETOPT_option_string ('w',
|
GNUNET_GETOPT_option_string ('w',
|
||||||
"since-when",
|
"since-when",
|
||||||
"SW",
|
"SW",
|
||||||
@ -395,7 +395,6 @@ main (int argc,
|
|||||||
" the 10 youngest transactions"
|
" the 10 youngest transactions"
|
||||||
" are returned.",
|
" are returned.",
|
||||||
&since_when),
|
&since_when),
|
||||||
|
|
||||||
GNUNET_GETOPT_option_string ('s',
|
GNUNET_GETOPT_option_string ('s',
|
||||||
"section",
|
"section",
|
||||||
"ACCOUNT-SECTION",
|
"ACCOUNT-SECTION",
|
||||||
@ -403,13 +402,11 @@ main (int argc,
|
|||||||
" credentials to access the"
|
" credentials to access the"
|
||||||
" bank. Mandatory.\n",
|
" bank. Mandatory.\n",
|
||||||
&account_section),
|
&account_section),
|
||||||
|
|
||||||
GNUNET_GETOPT_option_string ('a',
|
GNUNET_GETOPT_option_string ('a',
|
||||||
"amount",
|
"amount",
|
||||||
"AMOUNT",
|
"AMOUNT",
|
||||||
"Specify the amount to transfer.",
|
"Specify the amount to transfer.",
|
||||||
&amount),
|
&amount),
|
||||||
|
|
||||||
GNUNET_GETOPT_option_string ('d',
|
GNUNET_GETOPT_option_string ('d',
|
||||||
"destination",
|
"destination",
|
||||||
"PAYTO-URL",
|
"PAYTO-URL",
|
||||||
@ -418,12 +415,13 @@ main (int argc,
|
|||||||
&destination_account_url),
|
&destination_account_url),
|
||||||
GNUNET_GETOPT_OPTION_END
|
GNUNET_GETOPT_OPTION_END
|
||||||
};
|
};
|
||||||
|
int ret;
|
||||||
|
|
||||||
GNUNET_assert
|
GNUNET_assert
|
||||||
(GNUNET_OK == GNUNET_log_setup ("taler-wire",
|
(GNUNET_OK == GNUNET_log_setup ("taler-wire",
|
||||||
"WARNING",
|
"WARNING",
|
||||||
NULL)); /* filename */
|
NULL)); /* filename */
|
||||||
GNUNET_PROGRAM_run
|
ret = GNUNET_PROGRAM_run
|
||||||
(argc,
|
(argc,
|
||||||
argv,
|
argv,
|
||||||
"taler-wire",
|
"taler-wire",
|
||||||
@ -431,6 +429,9 @@ main (int argc,
|
|||||||
options,
|
options,
|
||||||
&run,
|
&run,
|
||||||
NULL);
|
NULL);
|
||||||
|
if (GNUNET_OK != ret)
|
||||||
|
return ret;
|
||||||
return global_ret;
|
return global_ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* end of taler-wire.c */
|
||||||
|
Loading…
Reference in New Issue
Block a user