/*
 * 5799-WZQ (C) COPYRIGHT = NONE
 * LICENSED MATERIALS - PROPERTY OF IBM
 */
/* $Header:cscanf.c 12.0$ */
/* $ACIS:cscanf.c 12.0$ */
/* $Source: /ibm/acis/usr/src/ibm/rvd/lib/RCS/cscanf.c,v $ */

#ifndef lint
static char *rcsid = "$Header:cscanf.c 12.0$";
#endif


#ifndef lint
static char rcsid_cscanf_c[] = "$Header:cscanf.c 12.0$";
#endif lint

/* Copyright 1984 by the Massachusetts Institute of Technology */
/* See permission and disclaimer notice in the file "notice.h" */
#include "notice.h"

#include	<stdio.h>

cscanf(fmt, args)
char *fmt;
{
	return(_docscan(stdin, fmt, &args));
}

cfscanf(iop, fmt, args)
FILE *iop;
char *fmt;
{
	return(_docscan(iop, fmt, &args));
}

csscanf(str, fmt, args)
register char *str;
char *fmt;
{
	FILE _strbuf;
	int	n;

	_strbuf._flag = _IOREAD|_IOSTRG;
	_strbuf._ptr = _strbuf._base = str;
	_strbuf._cnt = 0;
	while (*str++)
		_strbuf._cnt++;
	_strbuf._bufsiz = _strbuf._cnt;
	n = _docscan(&_strbuf, fmt, &args);
	return(n);
}

cpscanf(str, fmt, args)
register char **str;
char *fmt;
{
	FILE _strbuf;
	int n;

	_strbuf._flag = _IOREAD|_IOSTRG;
	_strbuf._ptr = _strbuf._base = *str;
	_strbuf._cnt = 0;
	while (*(*str)++)
		_strbuf._cnt++;
	_strbuf._bufsiz = _strbuf._cnt;
	n = _docscan(&_strbuf, fmt, &args);
	*str = _strbuf._ptr;
	return(n);
}

/* shouldn't be in here, but... */

pscanf(str, fmt, args)
register char **str;
char *fmt;
{
	FILE _strbuf;
	int n;

	_strbuf._flag = _IOREAD|_IOSTRG;
	_strbuf._ptr = _strbuf._base = *str;
	_strbuf._cnt = 0;
	while (*(*str)++)
		_strbuf._cnt++;
	_strbuf._bufsiz = _strbuf._cnt;
	n = _doscan(&_strbuf, fmt, &args);
	*str = _strbuf._ptr;
	return(n);
}
