Add option -r to env import to allow import of text files with CRLF as line endings

When this option is enabled, CRLF is treated like LF when importing environments
from text files, which means CRs ('\r') in front of LFs ('\n') are just ignored.

Drawback of enabling this option is that (maybe exported) variables which have
a trailing CR in their content will get imported without that CR. But this
drawback is very unlikely and the big advantage of letting Windows user create
a *working* uEnv.txt too is likely more welcome.

Signed-off-by: Alexander Holler <holler@ahsoftware.de>
This commit is contained in:
Alexander Holler 2014-07-14 17:49:55 +02:00 committed by Tom Rini
parent 8973601c38
commit ecd1446fe1
4 changed files with 36 additions and 9 deletions

View file

@ -102,7 +102,8 @@ extern ssize_t hexport_r(struct hsearch_data *__htab,
*/
extern int himport_r(struct hsearch_data *__htab,
const char *__env, size_t __size, const char __sep,
int __flag, int nvars, char * const vars[]);
int __flag, int __crlf_is_lf, int nvars,
char * const vars[]);
/* Walk the whole table calling the callback on each element */
extern int hwalk_r(struct hsearch_data *__htab, int (*callback)(ENTRY *));