summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2019-02-10 14:26:06 +0100
committerDave Davenport <qball@gmpclient.org>2019-02-10 14:26:06 +0100
commitf49866bd8bda2be2d02907dbf090928ff89fe930 (patch)
tree66bddbe08a235467bed90b28e2eacd89f4ab832a
parentfbd34c963565b1cec92c10e169582b8f2dab8180 (diff)
[Doc] Update documentation to match changed functions.
-rw-r--r--source/dialogs/ssh.c4
-rw-r--r--source/helper.c15
2 files changed, 16 insertions, 3 deletions
diff --git a/source/dialogs/ssh.c b/source/dialogs/ssh.c
index c719f393..23a9d163 100644
--- a/source/dialogs/ssh.c
+++ b/source/dialogs/ssh.c
@@ -74,7 +74,7 @@ typedef struct _SshEntry {
} SshEntry;
/**
- * @param host The host to connect too
+ * @param entry The host to connect too
*
* SSH into the selected host.
*
@@ -108,7 +108,7 @@ static int execshssh ( const SshEntry *entry)
}
/**
- * @param host The host to connect too
+ * @param entry The host to connect too
*
* SSH into the selected host, if successful update history.
*/
diff --git a/source/helper.c b/source/helper.c
index cb546588..41d5f14f 100644
--- a/source/helper.c
+++ b/source/helper.c
@@ -1273,6 +1273,19 @@ char *helper_string_replace_if_exists ( char * string, ... )
g_hash_table_destroy ( h );
return retv;
}
+/**
+ * @param string The string with elements to be replaced
+ * @param h Hash table with set of {key}, value that will be replaced, terminated by a NULL
+ *
+ * Items {key} are replaced by the value if '{key}' is passed as key/value pair, otherwise removed from string.
+ * If the {key} is in between [] all the text between [] are removed if {key}
+ * is not found. Otherwise key is replaced and [ & ] removed.
+ *
+ * This allows for optional replacement, f.e. '{ssh-client} [-t {title}] -e
+ * "{cmd}"' the '-t {title}' is only there if {title} is set.
+ *
+ * @returns a new string with the keys replaced.
+ */
char *helper_string_replace_if_exists_v ( char * string, GHashTable *h )
{
GError *error = NULL;
@@ -1283,7 +1296,7 @@ char *helper_string_replace_if_exists_v ( char * string, GHashTable *h )
// Free regex.
g_regex_unref ( reg );
// Throw error if shell parsing fails.
- if ( error ) {
+ if ( error != NULL ) {
char *msg = g_strdup_printf ( "Failed to parse: '%s'\nError: '%s'", string, error->message );
rofi_view_error_dialog ( msg, FALSE );
g_free ( msg );