From 8b4f772af22c5eb7873ee629482c57dbd10e5867 Mon Sep 17 00:00:00 2001 From: obache Date: Thu, 17 Jun 2010 08:56:46 +0000 Subject: Fixes build failure on NetBSD-5.0.2. Use fgets(3) instead of getline(3). --- math/gcalctool/distinfo | 3 ++- math/gcalctool/patches/patch-aa | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 math/gcalctool/patches/patch-aa (limited to 'math') diff --git a/math/gcalctool/distinfo b/math/gcalctool/distinfo index 986cc89e675..e1d476ee654 100644 --- a/math/gcalctool/distinfo +++ b/math/gcalctool/distinfo @@ -1,5 +1,6 @@ -$NetBSD: distinfo,v 1.43 2010/06/15 21:09:31 drochner Exp $ +$NetBSD: distinfo,v 1.44 2010/06/17 08:56:46 obache Exp $ SHA1 (gcalctool-5.30.1.tar.bz2) = 9a7f561705e931416ba028f712ef3f16c9b58fee RMD160 (gcalctool-5.30.1.tar.bz2) = 27122e63ceb2880ca27cf550ab8c55bfd865d169 Size (gcalctool-5.30.1.tar.bz2) = 1125957 bytes +SHA1 (patch-aa) = dd8311ca98bf93748a904e623af2043e5da6e402 diff --git a/math/gcalctool/patches/patch-aa b/math/gcalctool/patches/patch-aa new file mode 100644 index 00000000000..3f7471d6501 --- /dev/null +++ b/math/gcalctool/patches/patch-aa @@ -0,0 +1,32 @@ +$NetBSD: patch-aa,v 1.15 2010/06/17 08:56:46 obache Exp $ + +portability fix (no advantage to use getline(3) here) + https://bugzilla.gnome.org/show_bug.cgi?id=621863 + +--- src/gcalccmd.c.orig 2010-04-26 01:14:22.000000000 +0000 ++++ src/gcalccmd.c +@@ -73,7 +73,7 @@ int + main(int argc, char **argv) + { + char *equation; +- int bytes_read; ++ char *line_read; + size_t nbytes = MAXLINE; + + /* Seed random number generator. */ +@@ -82,12 +82,12 @@ main(int argc, char **argv) + equation = (char *) malloc(MAXLINE * sizeof(char)); + while (1) { + printf("> "); +- bytes_read = getline(&equation, &nbytes, stdin); ++ line_read = fgets(equation, nbytes, stdin); + +- if (bytes_read >= 0) ++ if (line_read != NULL) + str_adjust(equation); + +- if (bytes_read < 0 || strcmp(equation, "exit") == 0 || strcmp(equation, "quit") == 0 || strlen(equation) == 0) ++ if (line_read == NULL || strcmp(equation, "exit") == 0 || strcmp(equation, "quit") == 0 || strlen(equation) == 0) + break; + + solve(equation); -- cgit v1.2.3