Home | History | Annotate | Download | only in liblcl
      1 /*
      2  * CDDL HEADER START
      3  *
      4  * The contents of this file are subject to the terms of the
      5  * Common Development and Distribution License (the "License").
      6  * You may not use this file except in compliance with the License.
      7  *
      8  * You can obtain a copy of the license at src/OPENSOLARIS.LICENSE
      9  * or http://www.opensolaris.org/os/licensing.
     10  * See the License for the specific language governing permissions
     11  * and limitations under the License.
     12  *
     13  * When distributing Covered Code, include this CDDL HEADER in each
     14  * file and include the License file at src/OPENSOLARIS.LICENSE.
     15  * If applicable, add the following below this CDDL HEADER, with the
     16  * fields enclosed by brackets "[]" replaced with your own identifying
     17  * information: Portions Copyright [yyyy] [name of copyright owner]
     18  *
     19  * CDDL HEADER END
     20  */
     21 /* Copyright (c) 2000, Sun Microsystems, Inc. All rights reserved. */
     22 
     23 #pragma ident	"@(#)lcl_str_stdio.h	1.3	00/01/07 SMI"
     24 
     25 /*
     26 Copyright (c) 1992 Electrotechnical Laboratry (ETL)
     27 
     28 Permission to use, copy, modify, and distribute this material
     29 for any purpose and without fee is hereby granted, provided
     30 that the above copyright notice and this permission notice
     31 appear in all copies, and that the name of ETL not be
     32 used in advertising or publicity pertaining to this
     33 material without the specific, prior written permission
     34 of an authorized representative of ETL.
     35 ETL MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY
     36 OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS",
     37 WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
     38 
     39 Author:       Yutaka Sato <ysato (at) etl.go.jp>
     40 
     41      This program redirects the file I/O from/to strings on memory.
     42      Include "str_stdio.h" instead of <stdio.h>
     43 
     44 ///////////////////////////////////////////////////////////////////////*/
     45 
     46 #include <stdio.h>
     47 #undef getc
     48 #undef putc
     49 
     50 #define getc(file)		str_getc(file)
     51 #define fgetc(file)		str_getc(file)
     52 #define ungetc(ch,file)		str_ungetc(ch,file)
     53 #define fgets(buf,size,file)	str_fgets(buf,size,file)
     54 #define putc(ch,file)		str_putc(ch,file)
     55 #define fputc(ch,file)		str_putc(ch,file)
     56 #define fputs(buf,file)		str_fputs(buf,file)
     57 #define fflush(file)		str_fflush(file)
     58 #define fseek(file,off,where)	str_fseek(file,off,where)
     59 #define ftell(file)		str_ftell(file)
     60 #define fclose(file)		str_fclose(file)
     61 
     62 #define fprintf			str_fprintf
     63