home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
misc
/
volume10
/
parseargs
/
fp_argtype.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-02-16
|
1KB
|
62 lines
#include <useful.h>
#include <parseargs.h>
VERSIONID("$Header: fp_args.c,v 2.0 89/12/24 00:56:21 eric Exp $");
/*
** PARSEARGV argument type functions for floating point operands.
**
** These are broken out to avoid loading the floating precision
** conversion routines when they aren't actually needed.
**
** Author:
** Eric Allman
** University of California, Berkeley
*/
/*ARGSUSED*/
BOOL
argDouble(ad, vp, copyf)
register ARGDESC *ad;
register char *vp;
BOOL copyf;
{
auto char *vpp;
extern double strtod ARGS((char *, char **));
*(double *) ad->ad_valp = strtod(vp, &vpp);
if (*vpp != '\0')
{
usrerr("invalid floating point argument '%s' for %s",
vp, ad->ad_prompt);
return (FALSE);
}
else
{
return (TRUE);
}
}
/*ARGSUSED*/
BOOL
argFloat(ad, vp, copyf)
register ARGDESC *ad;
register char *vp;
BOOL copyf;
{
auto char *vpp;
extern double strtod ARGS((char *, char **));
*(float *) ad->ad_valp = (float) strtod(vp, &vpp);
if (*vpp != '\0')
{
usrerr("invalid floating point argument '%s' for %s",
vp, ad->ad_prompt);
return (FALSE);
}
else
{
return (TRUE);
}
}