-/* $NetBSD: getpar.c,v 1.4 1995/04/24 12:25:57 cgd Exp $ */
+/* $NetBSD: getpar.c,v 1.6 1997/10/13 22:12:01 cjs Exp $ */
/*
* Copyright (c) 1980, 1993
* SUCH DAMAGE.
*/
+#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)getpar.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$NetBSD: getpar.c,v 1.4 1995/04/24 12:25:57 cgd Exp $";
+__RCSID("$NetBSD: getpar.c,v 1.6 1997/10/13 22:12:01 cjs Exp $");
#endif
#endif /* not lint */
-# include <stdio.h>
-# include "getpar.h"
+#include <stdio.h>
+#include <string.h>
+#include "getpar.h"
+#include "trek.h"
+
+static int testterm __P((void));
/**
** get integer parameter
**/
+int
getintpar(s)
char *s;
{
- register int i;
+ int i;
int n;
while (1)
double getfltpar(s)
char *s;
{
- register int i;
+ int i;
double d;
while (1)
struct cvntab Yntab[] =
{
- "y", "es", (int (*)())1, 0,
- "n", "o", (int (*)())0, 0,
- 0
+ { "y", "es", (cmdfun)1, 1 },
+ { "n", "o", (cmdfun)0, 0 },
+ { NULL, NULL, NULL, 0 }
};
+int
getynpar(s)
char *s;
{
struct cvntab *r;
r = getcodpar(s, Yntab);
- return ((long) r->value);
+ return r->value2;
}
struct cvntab tab[];
{
char input[100];
- register struct cvntab *r;
+ struct cvntab *r;
int flag;
- register char *p, *q;
+ char *p, *q;
int c;
int f;
c = 4;
for (r = tab; r->abrev; r++)
{
- concat(r->abrev, r->full, input);
+ strcpy(input, r->abrev);
+ strcat(input, r->full);
printf("%14.14s", input);
if (--c > 0)
continue;
** get string parameter
**/
+void
getstrpar(s, r, l, t)
char *s;
char *r;
int l;
char *t;
{
- register int i;
+ int i;
char format[20];
- register int f;
+ int f;
if (t == 0)
t = " \t\n;";
** test if newline is next valid character
**/
+int
testnl()
{
- register char c;
+ char c;
while ((c = cgetc(0)) != '\n')
if ((c >= '0' && c <= '9') || c == '.' || c == '!' ||
** scan for newline
**/
+void
skiptonl(c)
-char c;
+int c;
{
while (c != '\n')
if (!(c = cgetc(0)))
** test for valid terminator
**/
+static int
testterm()
{
- register char c;
+ char c;
if (!(c = cgetc(0)))
return (1);
** zero is returned.
*/
+int
readdelim(d)
char d;
{
- register char c;
+ char c;
- while (c = cgetc(0))
+ while ((c = cgetc(0)) != '\0')
{
if (c == d)
return (1);