Browse Source

Fix for getline (currently unused) on Windows (to be implemented).

Marco Bambini 8 years ago
parent
commit
46834d0227
1 changed files with 13 additions and 0 deletions
  1. 13 0
      src/utils/gravity_utils.c

+ 13 - 0
src/utils/gravity_utils.c

@@ -88,6 +88,19 @@ double millitime (nanotime_t tstart, nanotime_t tend) {
 
 
 // MARK: - Console Functions -
 // MARK: - Console Functions -
 
 
+#ifdef WIN32
+// getline is a POSIX function not available in C on Windows (only C++)
+static ssize_t getline (char **lineptr, size_t *n, FILE *stream) {
+	// to be implemented on Windows
+	// Never use gets: it offers no protections against a buffer overflow vulnerability.
+	// see http://stackoverflow.com/questions/3302255/c-scanf-vs-gets-vs-fgets
+	// we should implement something like ggets here
+	// http://web.archive.org/web/20080525133110/http://cbfalconer.home.att.net/download/
+	
+	return -1;
+}
+#endif
+
 char *readline (char *prompt, int *length) {
 char *readline (char *prompt, int *length) {
 	char	*line = NULL;
 	char	*line = NULL;
 	size_t	size = 0;
 	size_t	size = 0;