$NetBSD: patch-aa,v 1.16 2010/06/18 01:53:47 obache Exp $

portability fix (no advantage to use getline(3) here)
  http://git.gnome.org/browse/gcalctool/commit/?id=436147a1f63fbf980d117f880d253fa0abbd11f8

--- src/gcalccmd.c.orig	2010-04-26 01:14:22.000000000 +0000
+++ src/gcalccmd.c
@@ -72,8 +72,7 @@ str_adjust(char *str)
 int
 main(int argc, char **argv)
 {
-    char *equation;
-    int bytes_read;
+    char *equation, *line;
     size_t nbytes = MAXLINE;
 
     /* Seed random number generator. */
@@ -82,12 +81,12 @@ main(int argc, char **argv)
     equation = (char *) malloc(MAXLINE * sizeof(char));
     while (1) {
         printf("> ");
-        bytes_read = getline(&equation, &nbytes, stdin);
-      
-        if (bytes_read >= 0)
+        line = fgets(equation, nbytes, stdin);
+
+        if (line != NULL)
             str_adjust(equation);
 
-        if (bytes_read < 0 || strcmp(equation, "exit") == 0 || strcmp(equation, "quit") == 0 || strlen(equation) == 0)
+        if (line == NULL || strcmp(equation, "exit") == 0 || strcmp(equation, "quit") == 0 || strlen(equation) == 0)
             break;
 
         solve(equation);
