📄 put_str.c
字号:
/* $Header: /usr/cvsroot/target/src/wrn/wm/demo/lib/put_str.c,v 1.1.1.1 2001/11/05 17:48:42 tneale Exp $ *//* * Copyright (C) 1999-2005 Wind River Systems, Inc. * All rights reserved. Provided under license only. * Distribution or other use of this software is only * permitted pursuant to the terms of a license agreement * from Wind River Systems (and is otherwise prohibited). * Refer to that license agreement for terms of use. *//**************************************************************************** * Copyright 1996-1997 Epilogue Technology Corporation. * Copyright 1998 Integrated Systems, Inc. * All rights reserved. ****************************************************************************//* * $Log: put_str.c,v $ * Revision 1.1.1.1 2001/11/05 17:48:42 tneale * Tornado shuffle * * Revision 1.5 2001/01/19 22:23:50 paul * Update copyright. * * Revision 1.4 2000/03/17 00:12:44 meister * Update copyright message * * Revision 1.3 1998/02/25 04:57:36 sra * Update copyrights. * * Revision 1.2 1998/02/18 18:49:45 josh * making prototypes more consistent with new data type epilogue_char_t * * Revision 1.1 1997/08/12 22:31:19 lowell * kick release numbers to avoid the "0.*" special case * * Revision 0.8 1997/03/20 06:53:08 sra * DFARS-safe copyright text. Zap! * * Revision 0.7 1997/02/25 10:58:16 sra * Update copyright notice, dust under the bed. * * Revision 0.6 1996/11/13 17:24:01 sra * Use putc() instead of fputc(), should be identical everywhere but * faster. * * Revision 0.5 1996/11/13 17:22:44 sra * Rewrite decorum_put_string() to get rid of all the crazy OS * dependencies. * * Revision 0.4 1996/11/13 15:09:16 mrf * Changes necessary to make snoop support work on Irix 5.x include * addition of snoop driver code and port to somewhat wacky Irix * curses implementation. * * Revision 0.3 1996/10/30 20:39:43 sar * Corrected test of fputs for msdos * * Revision 0.2 1996/10/28 17:49:57 sar * use decorum/h/dconfig.h instead of decorum.h directly * * Revision 0.1 1996/10/15 17:13:40 sar * initial vesion * *//* [clearcase]modification history-------------------01a,19apr05,job update copyright notices*//* get the decorum configuration */#ifndef decorum_config_inc#include <decorum/h/dconfig.h>#endif/****************************************************************************NAME: decorum_put_string decorum_put_sbits32 decorum_put_bits32 decorum_put_hex_stringPURPOSE: output strings or numbers to the given output stream these exist to isolate all of the html routines from a particular file or memory implementation.PARAMETERS: etc_stdio_t * The stream to write the header to.put_string and put_hex_string also have sbits8_t * The string to use for the title and header decorum_size_t The number of characters to output, if -1 then the string is null terminated note that hex strings can't use the null termination.put_sbits32 sbits32_t The value (signed 32 bit) to outputput_bits32 bits32_t The value (unsigned 32 bit) to outputRETURNS: int 0 = success, otherwise failure****************************************************************************/sbits16_t decorum_put_string(etc_stdio_t *outstream, epilogue_char_t *bufp, decorum_size_t bufl){ if (bufl == -1) { for (; *bufp; bufp++) if (putc((int)(*bufp), outstream) == EOF) return(1); } else { for(; bufl; bufl--, bufp++) if (putc((int)(*bufp), outstream) == EOF) return(1); } return(0);}sbits16_t decorum_put_sbits32(etc_stdio_t *outstream, sbits32_t value){ if (fprintf(outstream, "%ld", value) == 0) return(1); return(0);}sbits16_t decorum_put_bits32(etc_stdio_t *outstream, bits32_t value){ if (fprintf(outstream, "%lu", value) == 0) return(1); return(0);}sbits16_t decorum_put_hex_string(etc_stdio_t *outstream, bits8_t *bufp, decorum_size_t bufl){ if (bufl < 0) return(1); for(; bufl; bufl--, bufp++) if (fprintf(outstream, "%02x", (*bufp) & 0xFF) == 0) return(1); return(0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -