mdb_strio.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1997-2001 by Sun Microsystems, Inc.
* All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* String I/O Backend
*
* Simple backend to provide the ability to perform i/o reads from an in-memory
* string. This allows us to mdb_eval() a string -- by creating an i/o object
* out of it, we can then pass it to the parser as stdin.
*/
#include <mdb/mdb_modapi.h>
#include <mdb/mdb_io_impl.h>
#include <mdb/mdb_string.h>
typedef struct str_data {
char *str_base; /* Pointer to private copy of string */
char *str_ptr; /* Current seek pointer */
} str_data_t;
static ssize_t
{
if (left != 0) {
return (obytes);
}
return (0); /* At end of string: return EOF */
}
static off64_t
{
char *nptr;
switch (whence) {
case SEEK_SET:
break;
case SEEK_CUR:
break;
case SEEK_END:
break;
default:
}
}
static void
{
}
static const char *
{
return ("(string)");
}
static const mdb_io_ops_t strio_ops = {
};
mdb_io_t *
mdb_strio_create(const char *s)
{
/*
* Our parser expects each command to end with '\n' or ';'. To
* simplify things for the caller, we append a trailing newline
* so the argvec string can be passed directly sans modifications.
*/
return (io);
}
int
{
return (1);
}
return (0);
}