?? filefunc.c
字號:
/* $Header: /usr/cvsroot/target/src/wrn/wm/demo/lib/filefunc.c,v 1.3 2003/01/15 14:04:31 josh 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: filefunc.c,v $ * Revision 1.3 2003/01/15 14:04:31 josh * directory structure shifting * * Revision 1.2 2001/11/08 15:56:21 tneale * Updated for newest file layout * * Revision 1.1.1.1 2001/11/05 17:48:41 tneale * Tornado shuffle * * Revision 1.6 2001/01/19 22:23:41 paul * Update copyright. * * Revision 1.5 2000/03/17 00:12:38 meister * Update copyright message * * Revision 1.4 1998/09/04 04:00:09 sar * modified some #if statements to use #ifdef as they were testing * items that might not be defined - INSTALL_on_* options. * * Revision 1.3 1998/02/25 15:21:47 sra * Finish moving types.h, bug.h, and bugdef.h to common/h/. * * Revision 1.2 1998/02/25 04:57:24 sra * Update copyrights. * * Revision 1.1 1997/08/12 22:31:18 lowell * kick release numbers to avoid the "0.*" special case * * Revision 0.8 1997/07/23 07:08:01 alan * New: file_last_modified_time() * * Revision 0.7 1997/03/20 06:52:54 sra * DFARS-safe copyright text. Zap! * * Revision 0.6 1997/02/25 10:58:16 sra * Update copyright notice, dust under the bed. * * Revision 0.5 1997/02/19 08:10:29 sra * More fun merging snmptalk into snark, general snark cleanup. * * 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/29 00:50:22 sar * made filptr a pointer * * Revision 0.2 1996/10/28 21:29:24 lowell * include dconfig.h instead of decorum.h * * Revision 0.1 1996/10/27 16:59:26 lowell * initial revision * file-size for ETC_STDIO_SIZE * *//* [clearcase]modification history-------------------01a,19apr05,job update copyright notices*//* Get the standard epilogue types */#include <wrn/wm/common/types.h>/* and specific info for decorum */#include <decorum/h/dconfig.h>#include <decorum/h/date.h>/* * A function for our pseudo-stdio to find file sizes with. */#ifdef INSTALL_on_unix#include <sys/types.h>#include <sys/stat.h>bits32_t file_size_32(char * filename){ struct stat buf; int errval; errval = stat(filename, &buf); if (errval != 0) return 0; return ((bits32_t)(buf.st_size));}voidfile_last_modified_time(char *filename, struct decorum_rawtime *tv){ struct stat buf; if (stat(filename, &buf)) { tv->type = T0_NONE; } else { tv->type = T0_UNIX; tv->time = buf.st_ctime; }}#else /* not BSD *//* brute force, ugly, but will work anywhere ETC_STDIO does. */#ifndef filesize_buf_size #define filesize_buf_size 1024#endif /* ifndef filesize_buf_size */bits32_t file_size_32(char * filename){ etc_stdio_t *filptr; char buffer[filesize_buf_size]; bits32_t len=0; int thistime; filptr = ETC_STDIO_OPEN(filename, ETC_STDIO_MODE_READ); if (!filptr) return 0; do { thistime = ETC_STDIO_READ(filptr, filesize_buf_size, buffer); len += (bits32_t)thistime; } while (filesize_buf_size == thistime); ETC_STDIO_CLOSE(filptr); return len;}#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -