1 $NetBSD: patch-aa,v 1.15 2010/06/17 08:56:46 obache Exp $
3 portability fix (no advantage to use getline(3) here)
4 https://bugzilla.gnome.org/show_bug.cgi?id=621863
6 --- src/gcalccmd.c.orig 2010-04-26 01:14:22.000000000 +0000
9 main(int argc, char **argv)
14 size_t nbytes = MAXLINE;
16 /* Seed random number generator. */
17 @@ -82,12 +82,12 @@ main(int argc, char **argv)
18 equation = (char *) malloc(MAXLINE * sizeof(char));
21 - bytes_read = getline(&equation, &nbytes, stdin);
22 + line_read = fgets(equation, nbytes, stdin);
24 - if (bytes_read >= 0)
25 + if (line_read != NULL)
28 - if (bytes_read < 0 || strcmp(equation, "exit") == 0 || strcmp(equation, "quit") == 0 || strlen(equation) == 0)
29 + if (line_read == NULL || strcmp(equation, "exit") == 0 || strcmp(equation, "quit") == 0 || strlen(equation) == 0)