Mercurial > ~mikael > mcabber > hg
comparison mcabber/src/settings.c @ 337:3a25be278864
Values can be enclosed by quotes in assignments
Thus, passwords with leading/trailing spaces can be typed.
Examples:
set password = " with spaces "
set password = "with "quotes""
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Mon, 18 Jul 2005 21:47:05 +0100 |
parents | eb994ee40029 |
children | dea407d53fe6 |
comparison
equal
deleted
inserted
replaced
336:eb994ee40029 | 337:3a25be278864 |
---|---|
117 for (t = val ; *t ; t++) ; | 117 for (t = val ; *t ; t++) ; |
118 for (t-- ; t >= val && isblank(*t) ; t--) ; | 118 for (t-- ; t >= val && isblank(*t) ; t--) ; |
119 | 119 |
120 if (t < val) return TRUE; // no value (variable reset for example) | 120 if (t < val) return TRUE; // no value (variable reset for example) |
121 | 121 |
122 // If the value begins and ends with quotes ("), these quotes are | |
123 // removed and whitespace is not stripped | |
124 if ((t>val) && (*val == '"' && *t == '"')) { | |
125 val++; | |
126 t--; | |
127 } | |
122 *pval = g_strndup(val, t+1-val); | 128 *pval = g_strndup(val, t+1-val); |
123 return TRUE; | 129 return TRUE; |
124 } | 130 } |
125 | 131 |
126 void settings_set(guint type, const gchar *key, const gchar *value) | 132 void settings_set(guint type, const gchar *key, const gchar *value) |