aboutsummaryrefslogtreecommitdiffstats
path: root/agent/command.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2001-12-14 13:43:42 +0000
committerWerner Koch <[email protected]>2001-12-14 13:43:42 +0000
commit7606e3b33a57016b39b02857a7094e378a245ec3 (patch)
treeefbf689db541926ab5a8683e2c39a4e4793e93d4 /agent/command.c
parent* util.h (digitp, hexdigitp): New ctype like macros. (diff)
downloadgnupg-7606e3b33a57016b39b02857a7094e378a245ec3.tar.gz
gnupg-7606e3b33a57016b39b02857a7094e378a245ec3.zip
* util.h (digitp, hexdigitp): New ctype like macros.
(atoi_1,atoi_2,atoi_4,xtoi_1,xtoi_2): New. * command.c: Removed the conversion macros as they are now in ../common/util.h.
Diffstat (limited to 'agent/command.c')
-rw-r--r--agent/command.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/agent/command.c b/agent/command.c
index 33e61f69c..bbee7b412 100644
--- a/agent/command.c
+++ b/agent/command.c
@@ -37,16 +37,7 @@
#define set_error(e,t) assuan_set_error (ctx, ASSUAN_ ## e, (t))
-#define digitp(a) ((a) >= '0' && (a) <= '9')
-#define hexdigitp(a) (digitp (a) \
- || ((a) >= 'A' && (a) <= 'F') \
- || ((a) >= 'a' && (a) <= 'f'))
-#define atoi_1(p) (*(p) - '0' )
-#define atoi_2(p) ((atoi_1(p) * 10) + atoi_1((p)+1))
-/* assumes ASCII and pre-checked values */
-#define xtoi_1(p) (*(p) <= '9'? (*(p)- '0'): \
- *(p) <= 'F'? (*(p)-'A'+10):(*(p)-'a'+10))
-#define xtoi_2(p) ((xtoi_1(p) * 16) + xtoi_1((p)+1))
+
#if MAX_DIGEST_LEN < 20
#error MAX_DIGEST_LEN shorter than keygrip
@@ -129,7 +120,7 @@ cmd_sigkey (ASSUAN_CONTEXT ctx, char *line)
unsigned char *buf;
/* parse the hash value */
- for (p=line,n=0; hexdigitp (*p); p++, n++)
+ for (p=line,n=0; hexdigitp (p); p++, n++)
;
if (*p)
return set_error (Parameter_Error, "invalid hexstring");
@@ -169,7 +160,7 @@ cmd_sethash (ASSUAN_CONTEXT ctx, char *line)
ctrl->digest.algo = algo;
/* parse the hash value */
- for (p=line,n=0; hexdigitp (*p); p++, n++)
+ for (p=line,n=0; hexdigitp (p); p++, n++)
;
if (*p)
return set_error (Parameter_Error, "invalid hexstring");