|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T s
Length: 1091 (0x443)
Types: TextFile
Names: »skipnumber.c«
└─⟦a0efdde77⟧ Bits:30001252 EUUGD11 Tape, 1987 Spring Conference Helsinki
└─⟦this⟧ »EUUGD11/stat-5.3/eu/stat/src/skipnumber.c«
/* Copyright 1986 Gary Perlman */
#include <ctype.h>
#ifndef lint
static char sccs2fid[] = "@(#) skipnumber.c 5.0 (|stat) 9/15/86";
#endif
/*LINTLIBRARY*/
int
skipnumber (string, isreal)
char *string; /* input string, probably in number format */
int isreal; /* if true, then skip over real part too */
{
register char *ptr;
ptr = string;
while (isspace (*ptr))
ptr++;
if (*ptr == '-' || *ptr == '+')
ptr++;
while (isdigit (*ptr))
ptr++;
if (isreal)
{
if (*ptr == '.')
ptr++;
while (isdigit (*ptr))
ptr++;
if (*ptr == 'E' || *ptr == 'e')
{
ptr++;
if (*ptr == '+' || *ptr == '-')
ptr++;
while (isdigit (*ptr))
ptr++;
}
}
return (ptr - string);
}
#ifdef SKIPNUMBER
/* $Compile: cc -DSKIPNUMBER -o skipnumber skipnumber.c */
/* $Test: skipnumber -1.2345e-678abc +123.456E+789+987 */
#include <stdio.h>
main (argc, argv) char **argv;
{
int arg;
char *s;
for (arg = 1; arg < argc; arg++)
{
s = argv[arg];
printf ("%20s %20s %20s\n",
s, s + skipnumber (s, 1), s + skipnumber (s, 0));
}
}
#endif SKIPNUMBER