diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2021-05-18 14:46:29 +0200 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2021-05-18 14:56:52 +0200 |
commit | 645aec823750a27ad7c672f02dfd52bc6bc4eecf (patch) | |
tree | 51fe0873598b148565bea44df1388491fe20a581 /src/vty | |
parent | ebb6c1fc4df89fac6bbd4c36c1a286b6b96fd49e (diff) |
vty: Introduce API vty_read_config_filep
This new API doesn't use host_config_set(), and allows passing a FILE*
from any source, not only a filesystem path.
Related: SYS#5369
Change-Id: I720ac04386261628c0798a1bfcaa91e2490a86c3
Diffstat (limited to 'src/vty')
-rw-r--r-- | src/vty/vty.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/vty/vty.c b/src/vty/vty.c index f4e8e80f..76c6ef55 100644 --- a/src/vty/vty.c +++ b/src/vty/vty.c @@ -1462,9 +1462,13 @@ int vty_read(struct vty *vty) return 0; } -/* Read up configuration file */ -static int -vty_read_file(FILE *confp, void *priv) +/* Read up configuration from a file stream */ +/*! Read up VTY configuration from a file stream + * \param[in] confp file pointer of the stream for the configuration file + * \param[in] priv private data to be passed to \ref vty_read_file + * \returns Zero on success, non-zero on error + */ +int vty_read_config_filep(FILE *confp, void *priv) { int ret; struct vty *vty; @@ -1870,7 +1874,7 @@ int vty_read_config_file(const char *file_name, void *priv) if (!cfile) return -ENOENT; - rc = vty_read_file(cfile, priv); + rc = vty_read_config_filep(cfile, priv); fclose(cfile); host_config_set(file_name); |