summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pkg_install/lib/str.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/pkg_install/lib/str.c')
-rw-r--r--usr.sbin/pkg_install/lib/str.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/usr.sbin/pkg_install/lib/str.c b/usr.sbin/pkg_install/lib/str.c
index 67a5e64..c5f11a2 100644
--- a/usr.sbin/pkg_install/lib/str.c
+++ b/usr.sbin/pkg_install/lib/str.c
@@ -109,3 +109,22 @@ str_lowercase(char *str)
++str;
}
}
+
+char *
+get_string(char *str, int max, FILE *fp)
+{
+ int len;
+
+ if (!str)
+ return NULL;
+ str[0] = '\0';
+ while (fgets(str, max, fp)) {
+ len = strlen(str);
+ while (len && isspace(str[len - 1]))
+ str[--len] = '\0';
+ if (len)
+ return str;
+ }
+ return NULL;
+}
+
OpenPOWER on IntegriCloud