* | mutt_str_atos() | Convert ASCII string to a short
* | mutt_str_dequote_comment() | Un-escape characters in an email address comment
* | mutt_str_find_word() | Find the next word (non-space)
+ * | mutt_str_getenv() | Get an environment variable
* | mutt_str_is_ascii() | Is a string ASCII (7-bit)?
* | mutt_str_is_email_wsp() | Is this a whitespace character (for an email header)
* | mutt_str_lws_len() | Measure the linear-white-space at the beginning of a string
snprintf(buf, buflen, "%zuM", (num + 52428) / 1048576);
}
}
+
+/**
+ * mutt_str_getenv - Get an environment variable
+ * @param name Environment variable to get
+ * @retval ptr Value of variable
+ * @retval NULL Variable isn't set, or is empty
+ *
+ * @warning The caller must not free the returned pointer.
+ */
+const char *mutt_str_getenv(const char *name)
+{
+ if (!name)
+ return NULL;
+
+ const char *val = getenv(name);
+ if (val && (val[0] != '\0'))
+ return val;
+
+ return NULL;
+}
int mutt_str_atos(const char *str, short *dst);
void mutt_str_dequote_comment(char *s);
const char *mutt_str_find_word(const char *src);
+const char *mutt_str_getenv(const char *name);
bool mutt_str_is_ascii(const char *p, size_t len);
int mutt_str_is_email_wsp(char c);
size_t mutt_str_lws_len(const char *s, size_t n);