diff gui/util/string.c @ 37024:0790f864cea2

Add a file for miscellaneous auxiliary functions. Move fgetstr() from string.c there.
author ib
date Thu, 03 Apr 2014 09:47:41 +0000
parents fa8b6892b0bf
children b28b632efeef
line wrap: on
line diff
--- a/gui/util/string.c	Thu Apr 03 07:55:12 2014 +0000
+++ b/gui/util/string.c	Thu Apr 03 09:47:41 2014 +0000
@@ -21,6 +21,7 @@
  * @brief String utilities
  */
 
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
@@ -317,26 +318,3 @@
     if (*old)
         sprintf(*old, "%s/%s", dir, name);
 }
-
-/**
- * @brief Read characters from @a file.
- *
- * @param str pointer to a buffer to receive the read characters
- * @param size number of characters read at the most (including a terminating null-character)
- * @param file file to read from
- *
- * @return str (success) or NULL (error)
- *
- * @note Reading stops with an end-of-line character or at end of file.
- */
-char *fgetstr(char *str, int size, FILE *file)
-{
-    char *s;
-
-    s = fgets(str, size, file);
-
-    if (s)
-        s[strcspn(s, "\n\r")] = 0;
-
-    return s;
-}