+
+/**
+ * Parse the client configuration and open a connection to para_server.
+ *
+ * \param argc See \ref client_parse_config.
+ * \param argv See \ref client_parse_config.
+ * \param ct_ptr See \ref client_parse_config.
+ * \param loglevel See \ref client_parse_config.
+ * \param parent See \ref client_connect().
+ * \param child See \ref client_connect().
+ * \param sched See \ref client_connect().
+ *
+ * This function combines client_parse_config() and client_connect(). It is
+ * considered a syntax error if no command was given, i.e. if the number
+ * of non-option arguments is zero.
+ *
+ * \return Standard.
+ */
+int client_open(int argc, char *argv[], struct client_task **ct_ptr,
+ int *loglevel, struct btr_node *parent, struct btr_node *child,
+ struct sched *sched)
+{
+ int ret = client_parse_config(argc, argv, ct_ptr, loglevel);
+
+ if (ret < 0)
+ return ret;
+ if (ret == 0) {
+ ret = -E_CLIENT_SYNTAX;
+ goto fail;
+ }
+ ret = client_connect(*ct_ptr, sched, parent, child);
+ if (ret < 0)
+ goto fail;
+ return 1;
+fail:
+ client_close(*ct_ptr);
+ *ct_ptr = NULL;
+ return ret;
+}