summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFrederic Culot <calcurse@culot.org>2010-10-23 10:25:53 +0000
committerFrederic Culot <calcurse@culot.org>2010-10-23 10:25:53 +0000
commit1a6cdeab55d16125be3536beb8c7b1927e940b1f (patch)
treeb6dc62b63b8f9f1a3bf0194edb46e1db4472ff4a /src
parent3cad806d3e118eea6d60348e705dd28ac5bb962e (diff)
downloadcalcurse-1a6cdeab55d16125be3536beb8c7b1927e940b1f.zip
is_all_digit() rewritten.
Patch submitted by Lukas Fleischer, thanks.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/utils.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/utils.c b/src/utils.c
index 0015c60..d18b8bc 100755
--- a/src/utils.c
+++ b/src/utils.c
@@ -1,4 +1,4 @@
-/* $calcurse: utils.c,v 1.84 2010/03/21 10:17:04 culot Exp $ */
+/* $calcurse: utils.c,v 1.85 2010/10/23 10:25:53 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -442,18 +442,11 @@ updatestring (WINDOW *win, char **str, int x, int y)
int
is_all_digit (char *string)
{
- int digit, i;
- int all_digit;
-
- digit = 0;
- all_digit = 0;
+ for (; *string; string++)
+ if (!isdigit ((int)*string))
+ return 0;
- for (i = 0; i <= strlen (string); i++)
- if (isdigit (string[i]) != 0)
- digit++;
- if (digit == strlen (string))
- all_digit = 1;
- return all_digit;
+ return 1;
}
/* Given an item date expressed in seconds, return its start time in seconds. */