diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2008-11-10 14:40:03 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2008-11-10 14:40:03 +0000 |
commit | 54f8156cb21909034c6e82a5055cf7a906fb5848 (patch) | |
tree | 569f986b9b393a00e4cf6e9157059ebc08b3eba8 /nuttx | |
parent | 10e66822588992414a400a3ebc70a263df7df666 (diff) | |
download | px4-nuttx-54f8156cb21909034c6e82a5055cf7a906fb5848.tar.gz px4-nuttx-54f8156cb21909034c6e82a5055cf7a906fb5848.tar.bz2 px4-nuttx-54f8156cb21909034c6e82a5055cf7a906fb5848.zip |
Make use of FAR consistent in stdio.h
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1182 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx')
42 files changed, 626 insertions, 577 deletions
diff --git a/nuttx/fs/fs_rename.c b/nuttx/fs/fs_rename.c index f8c117922..52c8e64f9 100644 --- a/nuttx/fs/fs_rename.c +++ b/nuttx/fs/fs_rename.c @@ -72,7 +72,7 @@ * ****************************************************************************/ -int rename(const char *oldpath, const char *newpath) +int rename(FAR const char *oldpath, FAR const char *newpath) { FAR struct inode *oldinode; FAR struct inode *newinode; diff --git a/nuttx/fs/fs_statfs.c b/nuttx/fs/fs_statfs.c index 878568443..4a3a39cdc 100644 --- a/nuttx/fs/fs_statfs.c +++ b/nuttx/fs/fs_statfs.c @@ -63,7 +63,7 @@ static inline int statpsuedofs(FAR struct inode *inode, FAR struct statfs *buf) } /**************************************************************************** - * Global Functions + * Public Functions ****************************************************************************/ /**************************************************************************** @@ -82,10 +82,10 @@ static inline int statpsuedofs(FAR struct inode *inode, FAR struct statfs *buf) * ****************************************************************************/ -int statfs(const char *path, struct statfs *buf) +int statfs(FAR const char *path, FAR struct statfs *buf) { FAR struct inode *inode; - const char *relpath = NULL; + FAR const char *relpath = NULL; int ret = OK; /* Sanity checks */ diff --git a/nuttx/include/stdio.h b/nuttx/include/stdio.h index 23a9bf35b..6b83ee1f6 100644 --- a/nuttx/include/stdio.h +++ b/nuttx/include/stdio.h @@ -102,40 +102,40 @@ extern "C" { /* ANSI-like File System Interfaces */ -EXTERN int fclose(FILE *stream); -EXTERN int fflush(FILE *stream); -EXTERN int feof(FILE *stream); -EXTERN int ferror(FILE *stream); -EXTERN int fgetc(FILE *stream); -EXTERN int fgetpos(FILE *stream, fpos_t *pos); -EXTERN char *fgets(char *s, int n, FILE *stream); -EXTERN FILE *fopen(const char *path, const char *type); -EXTERN int fprintf(FILE *stream, const char *format, ...); -EXTERN int fputc(int c, FILE *stream); -EXTERN int fputs(const char *s, FILE *stream); -EXTERN size_t fread(void *ptr, size_t size, size_t n_items, FILE *stream); +EXTERN int fclose(FAR FILE *stream); +EXTERN int fflush(FAR FILE *stream); +EXTERN int feof(FAR FILE *stream); +EXTERN int ferror(FAR FILE *stream); +EXTERN int fgetc(FAR FILE *stream); +EXTERN int fgetpos(FAR FILE *stream, FAR fpos_t *pos); +EXTERN char *fgets(FAR char *s, int n, FAR FILE *stream); +EXTERN FAR FILE *fopen(FAR const char *path, FAR const char *type); +EXTERN int fprintf(FAR FILE *stream, FAR const char *format, ...); +EXTERN int fputc(int c, FAR FILE *stream); +EXTERN int fputs(FAR const char *s, FAR FILE *stream); +EXTERN size_t fread(FAR void *ptr, size_t size, size_t n_items, FAR FILE *stream); EXTERN int fseek(FAR FILE *stream, long int offset, int whence); -EXTERN int fsetpos(FILE *stream, fpos_t *pos); +EXTERN int fsetpos(FAR FILE *stream, FAR fpos_t *pos); EXTERN long ftell(FAR FILE *stream); -EXTERN size_t fwrite(const void *ptr, size_t size, size_t n_items, FILE *stream); -EXTERN char *gets(char *s); +EXTERN size_t fwrite(FAR const void *ptr, size_t size, size_t n_items, FAR FILE *stream); +EXTERN FAR char *gets(FAR char *s); EXTERN int printf(const char *format, ...); -EXTERN int puts(const char *s); -EXTERN int rename(const char *oldpath, const char *newpath); -EXTERN int sprintf(char *buf, const char *format, ...); -EXTERN int snprintf(char *buf, size_t size, const char *format, ...); +EXTERN int puts(FAR const char *s); +EXTERN int rename(FAR const char *oldpath, FAR const char *newpath); +EXTERN int sprintf(FAR char *buf, const char *format, ...); +EXTERN int snprintf(FAR char *buf, size_t size, const char *format, ...); -EXTERN int ungetc(int c, FILE *stream); -EXTERN int vprintf(const char *format, va_list ap); -EXTERN int vfprintf(FILE *stream, const char *format, va_list ap); -EXTERN int vsprintf(char *buf, const char *format, va_list ap); -EXTERN int vsnprintf(char *buf, size_t size, const char *format, va_list ap); +EXTERN int ungetc(int c, FAR FILE *stream); +EXTERN int vprintf(FAR const char *format, va_list ap); +EXTERN int vfprintf(FAR FILE *stream, const char *format, va_list ap); +EXTERN int vsprintf(FAR char *buf, const char *format, va_list ap); +EXTERN int vsnprintf(FAR char *buf, size_t size, const char *format, va_list ap); /* POSIX-like File System Interfaces */ -EXTERN FILE *fdopen(int fd, const char *type); -EXTERN int statfs(const char *path, FAR struct statfs *buf); +EXTERN FAR FILE *fdopen(int fd, FAR const char *type); +EXTERN int statfs(FAR const char *path, FAR struct statfs *buf); #undef EXTERN #if defined(__cplusplus) diff --git a/nuttx/lib/lib_etherntoa.c b/nuttx/lib/lib_etherntoa.c index 8be9d4f65..eed9cb544 100644 --- a/nuttx/lib/lib_etherntoa.c +++ b/nuttx/lib/lib_etherntoa.c @@ -1,7 +1,7 @@ /**************************************************************************** * lib/lib_etherntoa.c * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -14,7 +14,7 @@ * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. - * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * 3. Neither the name NuttX nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * diff --git a/nuttx/lib/lib_fclose.c b/nuttx/lib/lib_fclose.c index 57b5b5618..b45a2a8f1 100644 --- a/nuttx/lib/lib_fclose.c +++ b/nuttx/lib/lib_fclose.c @@ -1,7 +1,7 @@ -/************************************************************ - * lib_fclose.c +/**************************************************************************** + * lib/lib_fclose.c * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -14,7 +14,7 @@ * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. - * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * 3. Neither the name NuttX nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * @@ -31,15 +31,15 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Compilation Switches - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Included Files - ************************************************************/ + ****************************************************************************/ #include <nuttx/config.h> #include <sys/types.h> @@ -49,11 +49,11 @@ #include <string.h> #include <errno.h> -/************************************************************ +/**************************************************************************** * Global Functions - ************************************************************/ + ****************************************************************************/ -int fclose(FILE *stream) +int fclose(FAR FILE *stream) { int ret = OK; if (stream) diff --git a/nuttx/lib/lib_fflush.c b/nuttx/lib/lib_fflush.c index d73217437..f62d487b2 100644 --- a/nuttx/lib/lib_fflush.c +++ b/nuttx/lib/lib_fflush.c @@ -99,7 +99,7 @@ * ****************************************************************************/ -int fflush(FILE *stream) +int fflush(FAR FILE *stream) { /* Is the stream argument NULL? */ diff --git a/nuttx/lib/lib_fgetc.c b/nuttx/lib/lib_fgetc.c index 7360563ec..01801b850 100644 --- a/nuttx/lib/lib_fgetc.c +++ b/nuttx/lib/lib_fgetc.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib_fgetc.c + * lib/lib_fgetc.c * * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> @@ -84,7 +84,7 @@ * fgetc **************************************************************************/ -int fgetc(FILE *stream) +int fgetc(FAR FILE *stream) { unsigned char c; if (lib_fread(&c, 1, stream) > 0) diff --git a/nuttx/lib/lib_fgetpos.c b/nuttx/lib/lib_fgetpos.c index c8c5bce4b..9bb1af2a3 100644 --- a/nuttx/lib/lib_fgetpos.c +++ b/nuttx/lib/lib_fgetpos.c @@ -100,7 +100,7 @@ * ****************************************************************************/ -int fgetpos(FILE *stream, fpos_t *pos) +int fgetpos(FAR FILE *stream, FAR fpos_t *pos) { long position; diff --git a/nuttx/lib/lib_fgets.c b/nuttx/lib/lib_fgets.c index 1ac1e96f7..bf638a38f 100644 --- a/nuttx/lib/lib_fgets.c +++ b/nuttx/lib/lib_fgets.c @@ -121,7 +121,7 @@ static inline void _lib_consoleputc(int ch) ****************************************************************************/ #ifdef CONFIG_FGETS_ECHO -static inline void _lib_consoleputs(const char *str) +static inline void _lib_consoleputs(FAR const char *str) { (void)write(1, str, strlen(str)); } diff --git a/nuttx/lib/lib_fopen.c b/nuttx/lib/lib_fopen.c index 68c3ccdb6..92009cd27 100644 --- a/nuttx/lib/lib_fopen.c +++ b/nuttx/lib/lib_fopen.c @@ -55,7 +55,11 @@ * Private Functions ****************************************************************************/ -static int lib_mode2oflags(const char *mode) +/**************************************************************************** + * Name: lib_mode2oflags + ****************************************************************************/ + +static int lib_mode2oflags(FAR const char *mode) { int oflags = 0; if (mode) @@ -128,12 +132,16 @@ static int lib_mode2oflags(const char *mode) * Public Functions ****************************************************************************/ -FAR struct file_struct *lib_fdopen(int fd, const char *mode, +/**************************************************************************** + * Name: lib_fdopen + ****************************************************************************/ + +FAR struct file_struct *lib_fdopen(int fd, FAR const char *mode, FAR struct filelist *flist, FAR struct streamlist *slist) { FAR struct inode *inode = flist->fl_files[fd].f_inode; - FILE *stream; + FAR FILE *stream; int oflags = lib_mode2oflags(mode); int err = OK; int i; @@ -212,21 +220,29 @@ errout: return NULL; } -FILE *fdopen(int fd, const char *mode) +/**************************************************************************** + * Name: fdopen + ****************************************************************************/ + +FAR FILE *fdopen(int fd, FAR const char *mode) { FAR struct filelist *flist = sched_getfiles(); FAR struct streamlist *slist = sched_getstreams(); return lib_fdopen(fd, mode, flist, slist); } -FILE *fopen(const char *path, const char *mode) +/**************************************************************************** + * Name: fopen + ****************************************************************************/ + +FAR FILE *fopen(FAR const char *path, FAR const char *mode) { FAR struct filelist *flist = sched_getfiles(); FAR struct streamlist *slist = sched_getstreams(); int oflags = lib_mode2oflags(mode); int fd = open(path, oflags, 0666); - FILE *ret = lib_fdopen(fd, mode, flist, slist); + FAR FILE *ret = lib_fdopen(fd, mode, flist, slist); if (!ret) { (void)close(fd); diff --git a/nuttx/lib/lib_fprintf.c b/nuttx/lib/lib_fprintf.c index a0e3d5330..6d8ac91da 100644 --- a/nuttx/lib/lib_fprintf.c +++ b/nuttx/lib/lib_fprintf.c @@ -1,5 +1,5 @@ -/************************************************************ - * lib_fprintf.c +/**************************************************************************** + * lib/lib_fprintf.c * * Copyright (C) 2007 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> @@ -31,54 +31,55 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Compilation Switches - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Included Files - ************************************************************/ + ****************************************************************************/ #include <stdio.h> -/************************************************************ +/**************************************************************************** * Definitions - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Type Declarations - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Function Prototypes - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Global Constant Data - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Global Variables - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Constant Data - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Variables - ************************************************************/ -/************************************************************ - * Global Functions - ************************************************************/ + ****************************************************************************/ -/************************************************************ - * fprintf - ************************************************************/ +/**************************************************************************** + * Public Functions + ****************************************************************************/ -int fprintf(FILE *stream, const char *fmt, ...) +/**************************************************************************** + * Name: fprintf + ****************************************************************************/ + +int fprintf(FAR FILE *stream, FAR const char *fmt, ...) { va_list ap; int n; diff --git a/nuttx/lib/lib_fputc.c b/nuttx/lib/lib_fputc.c index e8033a54e..56ac536c2 100644 --- a/nuttx/lib/lib_fputc.c +++ b/nuttx/lib/lib_fputc.c @@ -1,7 +1,7 @@ -/************************************************************ - * lib_fputc.c +/**************************************************************************** + * lib/lib_fputc.c * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -14,7 +14,7 @@ * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. - * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * 3. Neither the name NuttX nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * @@ -31,60 +31,60 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Compilation Switches - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Included Files - ************************************************************/ + ****************************************************************************/ #include <stdio.h> #include "lib_internal.h" -/************************************************************ +/**************************************************************************** * Definitions - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Type Declarations - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Function Prototypes - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Global Function Prototypes - ************************************************************/ + ****************************************************************************/ -/********************************************************** +/**************************************************************************** * Global Constant Data - **********************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Global Variables - ************************************************************/ + ****************************************************************************/ -/********************************************************** +/**************************************************************************** * Private Constant Data - **********************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Variables - **********************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Global Functions - **********************************************************/ + ****************************************************************************/ -/************************************************************ - * fputc - **********************************************************/ +/**************************************************************************** + * Name: fputc + ****************************************************************************/ -int fputc(int c, FILE *stream) +int fputc(int c, FAR FILE *stream) { unsigned char buf = (unsigned char)c; if (lib_fwrite(&buf, 1, stream) > 0) diff --git a/nuttx/lib/lib_fputs.c b/nuttx/lib/lib_fputs.c index 61e5a03c4..8c4e6d772 100644 --- a/nuttx/lib/lib_fputs.c +++ b/nuttx/lib/lib_fputs.c @@ -1,7 +1,7 @@ -/************************************************************ - * lib_fputs.c +/**************************************************************************** + * lib/lib_fputs.c * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -14,7 +14,7 @@ * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. - * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * 3. Neither the name NuttX nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * @@ -31,66 +31,66 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Compilation Switches - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Included Files - ************************************************************/ + ****************************************************************************/ #include <stdio.h> #include <string.h> #include <errno.h> #include "lib_internal.h" -/************************************************************ +/**************************************************************************** * Definitions - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Type Declarations - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Function Prototypes - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Global Function Prototypes - ************************************************************/ + ****************************************************************************/ -/********************************************************** +/**************************************************************************** * Global Constant Data - **********************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Global Variables - ************************************************************/ + ****************************************************************************/ -/********************************************************** +/**************************************************************************** * Private Constant Data - **********************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Variables - **********************************************************/ + ****************************************************************************/ -/************************************************************ - * Global Functions - **********************************************************/ +/**************************************************************************** + * Public Functions + ****************************************************************************/ -/************************************************************ - * fputs - **********************************************************/ +/**************************************************************************** + * Name: fputs + ****************************************************************************/ /* fputs() writes the string s to stream, without its * trailing '\0'. */ -int fputs(const char *s, FILE *stream) +int fputs(FAR const char *s, FAR FILE *stream) { int ntowrite; int nwritten; diff --git a/nuttx/lib/lib_fread.c b/nuttx/lib/lib_fread.c index 361385bba..d25c7b1e4 100644 --- a/nuttx/lib/lib_fread.c +++ b/nuttx/lib/lib_fread.c @@ -73,14 +73,14 @@ ****************************************************************************/ /**************************************************************************** - * Global Functions + * Public Functions ****************************************************************************/ /**************************************************************************** - * Name: fwrite + * Name: fread ****************************************************************************/ -size_t fread(void *ptr, size_t size, size_t n_items, FILE *stream) +size_t fread(FAR void *ptr, size_t size, size_t n_items, FAR FILE *stream) { size_t full_size = n_items * (size_t)size; ssize_t bytes_read; diff --git a/nuttx/lib/lib_fsetpos.c b/nuttx/lib/lib_fsetpos.c index 6a5fc7e9f..eca0c2d67 100644 --- a/nuttx/lib/lib_fsetpos.c +++ b/nuttx/lib/lib_fsetpos.c @@ -102,7 +102,7 @@ * ****************************************************************************/ -int fsetpos(FILE *stream, fpos_t *pos) +int fsetpos(FAR FILE *stream, FAR fpos_t *pos) { #if CONFIG_DEBUG if (!stream || !pos) @@ -112,5 +112,5 @@ int fsetpos(FILE *stream, fpos_t *pos) } #endif - return fseek(stream, (off_t)*pos, SEEK_SET); + return fseek(stream, (FAR off_t)*pos, SEEK_SET); } diff --git a/nuttx/lib/lib_fwrite.c b/nuttx/lib/lib_fwrite.c index 11d9c1eae..0072ff09f 100644 --- a/nuttx/lib/lib_fwrite.c +++ b/nuttx/lib/lib_fwrite.c @@ -71,15 +71,16 @@ /**************************************************************************** * Private Variables ****************************************************************************/ + /**************************************************************************** - * Global Functions + * Public Functions ****************************************************************************/ /**************************************************************************** - * fwrite + * Name: fwrite ****************************************************************************/ -size_t fwrite(const void *ptr, size_t size, size_t n_items, FILE *stream) +size_t fwrite(FAR const void *ptr, size_t size, size_t n_items, FAR FILE *stream) { size_t full_size = n_items * (size_t)size; ssize_t bytes_written; diff --git a/nuttx/lib/lib_gets.c b/nuttx/lib/lib_gets.c index 944e5266d..e8b7f717e 100644 --- a/nuttx/lib/lib_gets.c +++ b/nuttx/lib/lib_gets.c @@ -1,7 +1,7 @@ -/************************************************************ - * lib_gets.c +/**************************************************************************** + * lib/lib_gets.c * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -14,7 +14,7 @@ * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. - * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * 3. Neither the name NuttX nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * @@ -31,57 +31,57 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Included Files - ************************************************************/ + ****************************************************************************/ #include <stdio.h> #include <limits.h> #include <string.h> -/************************************************************ +/**************************************************************************** * Definitions - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Type Declarations - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Function Prototypes - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Global Function Prototypes - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Global Constant Data - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Global Variables - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Constant Data - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Variables - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Functions - ************************************************************/ + ****************************************************************************/ -/************************************************************ - * Global Functions - ************************************************************/ +/**************************************************************************** + * Public Functions + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Name: gets * * Description: @@ -94,16 +94,16 @@ * unsafe. Consider using fgets which is safer and * slightly more efficient. * - **********************************************************/ + **************************************************************************/ -char *gets(char *s) +FAR char *gets(FAR char *s) { /* gets is ALMOST the same as fgets using stdin and no * lenght limit (hence, the unsafeness of gets). So let * fgets do most of the work. */ - char *ret = fgets(s, INT_MAX, stdin); + FAR char *ret = fgets(s, INT_MAX, stdin); if (ret) { /* Another subtle difference from fgets is that gets diff --git a/nuttx/lib/lib_inetntoa.c b/nuttx/lib/lib_inetntoa.c index c94f25a52..c19670aff 100644 --- a/nuttx/lib/lib_inetntoa.c +++ b/nuttx/lib/lib_inetntoa.c @@ -1,7 +1,7 @@ /**************************************************************************** * lib/lib_inetntoa.c * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -14,7 +14,7 @@ * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. - * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * 3. Neither the name NuttX nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * @@ -60,7 +60,7 @@ FAR char *inet_ntoa(struct in_addr in) { static char buffer[18]; - char *ptr = (char*)&in.s_addr; + FAR char *ptr = (FAR char*)&in.s_addr; sprintf(buffer, "%d.%d.%d.%d", ptr[0], ptr[1], ptr[2], ptr[3]); return buffer; } diff --git a/nuttx/lib/lib_internal.h b/nuttx/lib/lib_internal.h index 2f776321a..4c828fb38 100644 --- a/nuttx/lib/lib_internal.h +++ b/nuttx/lib/lib_internal.h @@ -70,7 +70,7 @@ struct lib_stream_s; -typedef void (*lib_putc_t)(struct lib_stream_s *this, int ch); +typedef void (*lib_putc_t)(FAR struct lib_stream_s *this, int ch); struct lib_stream_s { @@ -82,14 +82,14 @@ struct lib_stream_s struct lib_memstream_s { struct lib_stream_s public; - char *buffer; /* Address of first byte in the buffer */ + FAR char *buffer; /* Address of first byte in the buffer */ int buflen; /* Size of the buffer in bytes */ }; struct lib_stdstream_s { struct lib_stream_s public; - FILE *stream; + FAR FILE *stream; }; struct lib_rawstream_s @@ -115,37 +115,37 @@ extern void stream_semgive(FAR struct streamlist *list); /* Defined in lib_memstream.c */ -extern void lib_memstream(struct lib_memstream_s *memstream, - char *bufstart, int buflen); +extern void lib_memstream(FAR struct lib_memstream_s *memstream, + FAR char *bufstart, int buflen); /* Defined in lib_stdstream.c */ -extern void lib_stdstream(struct lib_stdstream_s *stdstream, - FILE *stream); +extern void lib_stdstream(FAR struct lib_stdstream_s *stdstream, + FAR FILE *stream); /* Defined in lib_rawstream.c */ -extern void lib_rawstream(struct lib_rawstream_s *rawstream, +extern void lib_rawstream(FAR struct lib_rawstream_s *rawstream, int fd); /* Defined in lib_lowstream.c */ #ifdef CONFIG_ARCH_LOWPUTC -extern void lib_lowstream(struct lib_stream_s *rawstream); +extern void lib_lowstream(FAR struct lib_stream_s *rawstream); #endif /* Defined in lib_nullstream.c */ -extern void lib_nullstream(struct lib_stream_s *nullstream); +extern void lib_nullstream(FAR struct lib_stream_s *nullstream); /* Defined in lib_libsprintf.c */ -extern int lib_sprintf (struct lib_stream_s *obj, +extern int lib_sprintf (FAR struct lib_stream_s *obj, const char *fmt, ...); /* Defined lib_libvsprintf.c */ -extern int lib_vsprintf(struct lib_stream_s *obj, +extern int lib_vsprintf(FAR struct lib_stream_s *obj, const char *src, va_list ap); /* Defined lib_rawprintf.c */ @@ -158,23 +158,23 @@ extern int lib_lowvprintf(const char *src, va_list ap); /* Defined in lib_libwrite.c */ -extern ssize_t lib_fwrite(const void *ptr, size_t count, FILE *stream); +extern ssize_t lib_fwrite(const void *ptr, size_t count, FAR FILE *stream); /* Defined in lib_libfread.c */ -extern ssize_t lib_fread(void *ptr, size_t count, FILE *stream); +extern ssize_t lib_fread(FAR void *ptr, size_t count, FAR FILE *stream); /* Defined in lib_libfflush.c */ -extern ssize_t lib_fflush(FILE *stream, boolean bforce); +extern ssize_t lib_fflush(FAR FILE *stream, boolean bforce); /* Defined in lib_rdflush.c */ -extern int lib_rdflush(FILE *stream); +extern int lib_rdflush(FAR FILE *stream); /* Defined in lib_wrflush.c */ -int lib_wrflush(FILE *stream); +int lib_wrflush(FAR FILE *stream); /* Defined in lib_sem.c */ diff --git a/nuttx/lib/lib_libfflush.c b/nuttx/lib/lib_libfflush.c index 23be9c83a..a54a09386 100644 --- a/nuttx/lib/lib_libfflush.c +++ b/nuttx/lib/lib_libfflush.c @@ -81,7 +81,7 @@ ****************************************************************************/ /**************************************************************************** - * Global Functions + * Public Functions ****************************************************************************/ /**************************************************************************** @@ -102,10 +102,10 @@ * ****************************************************************************/ -ssize_t lib_fflush(FILE *stream, boolean bforce) +ssize_t lib_fflush(FAR FILE *stream, boolean bforce) { #if CONFIG_STDIO_BUFFER_SIZE > 0 - const unsigned char *src; + FAR const unsigned char *src; ssize_t bytes_written; size_t nbuffer; diff --git a/nuttx/lib/lib_libfread.c b/nuttx/lib/lib_libfread.c index 15d50fbe9..c0a43e0c8 100644 --- a/nuttx/lib/lib_libfread.c +++ b/nuttx/lib/lib_libfread.c @@ -78,14 +78,14 @@ ****************************************************************************/ /**************************************************************************** - * Global Functions + * Public Functions ****************************************************************************/ /**************************************************************************** - * lib_fread + * Name: lib_fread ****************************************************************************/ -ssize_t lib_fread(void *ptr, size_t count, FILE *stream) +ssize_t lib_fread(FAR void *ptr, size_t count, FAR FILE *stream) { unsigned char *dest = (unsigned char*)ptr; ssize_t bytes_read; diff --git a/nuttx/lib/lib_libfwrite.c b/nuttx/lib/lib_libfwrite.c index b7f681051..3ea9f6e60 100644 --- a/nuttx/lib/lib_libfwrite.c +++ b/nuttx/lib/lib_libfwrite.c @@ -79,18 +79,18 @@ ****************************************************************************/ /**************************************************************************** - * Global Functions + * Public Functions ****************************************************************************/ /**************************************************************************** * Name: lib_fwrite ****************************************************************************/ -ssize_t lib_fwrite(const void *ptr, size_t count, FILE *stream) +ssize_t lib_fwrite(FAR const void *ptr, size_t count, FAR FILE *stream) #if CONFIG_STDIO_BUFFER_SIZE > 0 { - const unsigned char *start = ptr; - const unsigned char *src = ptr; + FAR const unsigned char *start = ptr; + FAR const unsigned char *src = ptr; ssize_t ret = ERROR; unsigned char *dest; diff --git a/nuttx/lib/lib_libsprintf.c b/nuttx/lib/lib_libsprintf.c index 20078b7b5..418ab7fc4 100644 --- a/nuttx/lib/lib_libsprintf.c +++ b/nuttx/lib/lib_libsprintf.c @@ -1,7 +1,7 @@ -/************************************************************ - * lib_libsprintf.c +/**************************************************************************** + * lib/lib_libsprintf.c * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -14,7 +14,7 @@ * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. - * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * 3. Neither the name NuttX nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * @@ -31,52 +31,52 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Included Files - ************************************************************/ + ****************************************************************************/ #include <stdio.h> #include "lib_internal.h" -/************************************************************ +/**************************************************************************** * Definitions - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Type Declarations - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Function Prototypes - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Global Constant Data - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Global Variables - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Constant Data - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Variables - ************************************************************/ + ****************************************************************************/ -/************************************************************ - * Global Functions - ************************************************************/ +/**************************************************************************** + * Public Functions + ****************************************************************************/ -/************************************************************ - * lib_sprintf - ************************************************************/ +/**************************************************************************** + * Name: lib_sprintf + ****************************************************************************/ -int lib_sprintf (struct lib_stream_s *obj, const char *fmt, ...) +int lib_sprintf(FAR struct lib_stream_s *obj, const char *fmt, ...) { va_list ap; int n; diff --git a/nuttx/lib/lib_libvsprintf.c b/nuttx/lib/lib_libvsprintf.c index a7e1aab55..456bf181f 100644 --- a/nuttx/lib/lib_libvsprintf.c +++ b/nuttx/lib/lib_libvsprintf.c @@ -109,60 +109,60 @@ enum /* Pointer to ASCII conversion */ #ifdef CONFIG_PTR_IS_NOT_INT -static void ptohex(struct lib_stream_s *obj, ubyte flags, void *p); +static void ptohex(FAR struct lib_stream_s *obj, ubyte flags, FAR void *p); #ifndef CONFIG_NOPRINTF_FIELDWIDTH -static int getsizesize(ubyte fmt, ubyte flags, void *p) +static int getsizesize(ubyte fmt, ubyte flags, FAR void *p) #endif /* CONFIG_NOPRINTF_FIELDWIDTH */ #endif /* CONFIG_PTR_IS_NOT_INT */ /* Unsigned int to ASCII conversion */ -static void utodec(struct lib_stream_s *obj, unsigned int n); -static void utohex(struct lib_stream_s *obj, unsigned int n, ubyte a); -static void utooct(struct lib_stream_s *obj, unsigned int n); -static void utobin(struct lib_stream_s *obj, unsigned int n); -static void utoascii(struct lib_stream_s *obj, ubyte fmt, +static void utodec(FAR struct lib_stream_s *obj, unsigned int n); +static void utohex(FAR struct lib_stream_s *obj, unsigned int n, ubyte a); +static void utooct(FAR struct lib_stream_s *obj, unsigned int n); +static void utobin(FAR struct lib_stream_s *obj, unsigned int n); +static void utoascii(FAR struct lib_stream_s *obj, ubyte fmt, ubyte flags, unsigned int lln); #ifndef CONFIG_NOPRINTF_FIELDWIDTH -static void fixup(ubyte fmt, ubyte *flags, int *n); +static void fixup(ubyte fmt, FAR ubyte *flags, int *n); static int getusize(ubyte fmt, ubyte flags, unsigned int lln); #endif /* Unsigned long int to ASCII conversion */ #ifdef CONFIG_LONG_IS_NOT_INT -static void lutodec(struct lib_stream_s *obj, unsigned long ln); -static void lutohex(struct lib_stream_s *obj, unsigned long ln, ubyte a); -static void lutooct(struct lib_stream_s *obj, unsigned long ln); -static void lutobin(struct lib_stream_s *obj, unsigned long ln); -static void lutoascii(struct lib_stream_s *obj, ubyte fmt, +static void lutodec(FAR struct lib_stream_s *obj, unsigned long ln); +static void lutohex(FAR struct lib_stream_s *obj, unsigned long ln, ubyte a); +static void lutooct(FAR struct lib_stream_s *obj, unsigned long ln); +static void lutobin(FAR struct lib_stream_s *obj, unsigned long ln); +static void lutoascii(FAR struct lib_stream_s *obj, ubyte fmt, ubyte flags, unsigned long ln); #ifndef CONFIG_NOPRINTF_FIELDWIDTH -static void lfixup(ubyte fmt, ubyte *flags, long *ln); -static int getlusize(ubyte fmt, ubyte flags, unsigned long ln); +static void lfixup(ubyte fmt, FAR ubyte *flags, long *ln); +static int getlusize(ubyte fmt, FAR ubyte flags, unsigned long ln); #endif #endif /* Unsigned long long int to ASCII conversions */ #ifdef CONFIG_HAVE_LONG_LONG -static void llutodec(struct lib_stream_s *obj, unsigned long long lln); -static void llutohex(struct lib_stream_s *obj, unsigned long long lln, ubyte a); -static void llutooct(struct lib_stream_s *obj, unsigned long long lln); -static void llutobin(struct lib_stream_s *obj, unsigned long long lln); -static void llutoascii(struct lib_stream_s *obj, ubyte fmt, +static void llutodec(FAR struct lib_stream_s *obj, unsigned long long lln); +static void llutohex(FAR struct lib_stream_s *obj, unsigned long long lln, ubyte a); +static void llutooct(FAR struct lib_stream_s *obj, unsigned long long lln); +static void llutobin(FAR struct lib_stream_s *obj, unsigned long long lln); +static void llutoascii(FAR struct lib_stream_s *obj, ubyte fmt, ubyte flags, unsigned long long lln); #ifndef CONFIG_NOPRINTF_FIELDWIDTH -static void llfixup(ubyte fmt, ubyte *flags, long long *lln); -static int getllusize(ubyte fmt, ubyte flags, unsigned long long lln); +static void llfixup(ubyte fmt, FAR ubyte *flags, FAR long long *lln); +static int getllusize(ubyte fmt, FAR ubyte flags, FAR unsigned long long lln); #endif #endif #ifndef CONFIG_NOPRINTF_FIELDWIDTH -static void prejustify(struct lib_stream_s *obj, ubyte fmt, +static void prejustify(FAR struct lib_stream_s *obj, ubyte fmt, ubyte flags, int fieldwidth, int numwidth); -static void postjustify(struct lib_stream_s *obj, ubyte fmt, +static void postjustify(FAR struct lib_stream_s *obj, ubyte fmt, ubyte flags, int fieldwidth, int numwidth); #endif @@ -193,12 +193,12 @@ static const char g_nullstring[] = "(null)"; ****************************************************************************/ #ifdef CONFIG_PTR_IS_NOT_INT -static void ptohex(struct lib_stream_s *obj, ubyte flags, void *p) +static void ptohex(FAR struct lib_stream_s *obj, ubyte flags, FAR void *p) { union { - uint32 dw; - void *p; + uint32 dw; + FAR void *p; } u; ubyte bits; @@ -234,12 +234,11 @@ static void ptohex(struct lib_stream_s *obj, ubyte flags, void *p) ****************************************************************************/ #ifndef CONFIG_NOPRINTF_FIELDWIDTH -static int getpsize(ubyte flags, void *p) +static int getpsize(ubyte flags, FAR void *p) { struct lib_stream_s nullstream; lib_nullstream(&nullstream); - ptohex(&nullstream, flags, p); return nullstream.nput; } @@ -251,7 +250,7 @@ static int getpsize(ubyte flags, void *p) * Name: utodec ****************************************************************************/ -static void utodec(struct lib_stream_s *obj, unsigned int n) +static void utodec(FAR struct lib_stream_s *obj, unsigned int n) { unsigned int remainder = n % 10; unsigned int dividend = n / 10; @@ -268,7 +267,7 @@ static void utodec(struct lib_stream_s *obj, unsigned int n) * Name: utohex ****************************************************************************/ -static void utohex(struct lib_stream_s *obj, unsigned int n, ubyte a) +static void utohex(FAR struct lib_stream_s *obj, unsigned int n, ubyte a) { boolean nonzero = FALSE; ubyte bits; @@ -301,7 +300,7 @@ static void utohex(struct lib_stream_s *obj, unsigned int n, ubyte a) * Name: utooct ****************************************************************************/ -static void utooct(struct lib_stream_s *obj, unsigned int n) +static void utooct(FAR struct lib_stream_s *obj, unsigned int n) { unsigned int remainder = n & 0x7; unsigned int dividend = n >> 3; @@ -318,7 +317,7 @@ static void utooct(struct lib_stream_s *obj, unsigned int n) * Name: utobin ****************************************************************************/ -static void utobin(struct lib_stream_s *obj, unsigned int n) +static void utobin(FAR struct lib_stream_s *obj, unsigned int n) { unsigned int remainder = n & 1; unsigned int dividend = n >> 1; @@ -335,7 +334,7 @@ static void utobin(struct lib_stream_s *obj, unsigned int n) * Name: lutoascii ****************************************************************************/ -static void utoascii(struct lib_stream_s *obj, ubyte fmt, ubyte flags, unsigned int n) +static void utoascii(FAR struct lib_stream_s *obj, ubyte fmt, ubyte flags, unsigned int n) { /* Perform the integer conversion according to the format specifier */ @@ -447,7 +446,7 @@ static void utoascii(struct lib_stream_s *obj, ubyte fmt, ubyte flags, unsigned ****************************************************************************/ #ifndef CONFIG_NOPRINTF_FIELDWIDTH -static void fixup(ubyte fmt, ubyte *flags, int *n) +static void fixup(ubyte fmt, FAR ubyte *flags, FAR int *n) { /* Perform the integer conversion according to the format specifier */ @@ -504,7 +503,7 @@ static int getusize(ubyte fmt, ubyte flags, unsigned int n) * Name: lutodec ****************************************************************************/ -static void lutodec(struct lib_stream_s *obj, unsigned long n) +static void lutodec(FAR struct lib_stream_s *obj, unsigned long n) { unsigned int remainder = n % 10; unsigned long dividend = n / 10; @@ -521,7 +520,7 @@ static void lutodec(struct lib_stream_s *obj, unsigned long n) * Name: lutohex ****************************************************************************/ -static void lutohex(struct lib_stream_s *obj, unsigned long n, ubyte a) +static void lutohex(FAR struct lib_stream_s *obj, unsigned long n, ubyte a) { boolean nonzero = FALSE; ubyte bits; @@ -554,7 +553,7 @@ static void lutohex(struct lib_stream_s *obj, unsigned long n, ubyte a) * Name: lutooct ****************************************************************************/ -static void lutooct(struct lib_stream_s *obj, unsigned long n) +static void lutooct(FAR struct lib_stream_s *obj, unsigned long n) { unsigned int remainder = n & 0x7; unsigned long dividend = n >> 3; @@ -571,7 +570,7 @@ static void lutooct(struct lib_stream_s *obj, unsigned long n) * Name: lutobin ****************************************************************************/ -static void lutobin(struct lib_stream_s *obj, unsigned long n) +static void lutobin(FAR struct lib_stream_s *obj, unsigned long n) { unsigned int remainder = n & 1; unsigned long dividend = n >> 1; @@ -588,7 +587,7 @@ static void lutobin(struct lib_stream_s *obj, unsigned long n) * Name: lutoascii ****************************************************************************/ -static void lutoascii(struct lib_stream_s *obj, ubyte fmt, ubyte flags, unsigned long ln) +static void lutoascii(FAR struct lib_stream_s *obj, ubyte fmt, ubyte flags, unsigned long ln) { /* Perform the integer conversion according to the format specifier */ @@ -695,7 +694,7 @@ static void lutoascii(struct lib_stream_s *obj, ubyte fmt, ubyte flags, unsigned ****************************************************************************/ #ifndef CONFIG_NOPRINTF_FIELDWIDTH -static void lfixup(ubyte fmt, ubyte *flags, long *ln) +static void lfixup(ubyte fmt, FAR ubyte *flags, FAR long *ln) { /* Perform the integer conversion according to the format specifier */ @@ -754,7 +753,7 @@ static int getlusize(ubyte fmt, ubyte flags, unsigned long ln) * Name: llutodec ****************************************************************************/ -static void llutodec(struct lib_stream_s *obj, unsigned long long n) +static void llutodec(FAR struct lib_stream_s *obj, unsigned long long n) { unsigned int remainder = n % 10; unsigned long long dividend = n / 10; @@ -771,7 +770,7 @@ static void llutodec(struct lib_stream_s *obj, unsigned long long n) * Name: llutohex ****************************************************************************/ -static void llutohex(struct lib_stream_s *obj, unsigned long long n, ubyte a) +static void llutohex(FAR struct lib_stream_s *obj, unsigned long long n, ubyte a) { boolean nonzero = FALSE; ubyte bits; @@ -804,7 +803,7 @@ static void llutohex(struct lib_stream_s *obj, unsigned long long n, ubyte a) * Name: llutooct ****************************************************************************/ -static void llutooct(struct lib_stream_s *obj, unsigned long long n) +static void llutooct(FAR struct lib_stream_s *obj, unsigned long long n) { unsigned int remainder = n & 0x7; unsigned long long dividend = n >> 3; @@ -821,7 +820,7 @@ static void llutooct(struct lib_stream_s *obj, unsigned long long n) * Name: llutobin ****************************************************************************/ -static void llutobin(struct lib_stream_s *obj, unsigned long long n) +static void llutobin(FAR struct lib_stream_s *obj, unsigned long long n) { unsigned int remainder = n & 1; unsigned long long dividend = n >> 1; @@ -838,7 +837,7 @@ static void llutobin(struct lib_stream_s *obj, unsigned long long n) * Name: llutoascii ****************************************************************************/ -static void llutoascii(struct lib_stream_s *obj, ubyte fmt, ubyte flags, unsigned long long lln) +static void llutoascii(FAR struct lib_stream_s *obj, ubyte fmt, ubyte flags, unsigned long long lln) { /* Perform the integer conversion according to the format specifier */ @@ -945,7 +944,7 @@ static void llutoascii(struct lib_stream_s *obj, ubyte fmt, ubyte flags, unsigne ****************************************************************************/ #ifndef CONFIG_NOPRINTF_FIELDWIDTH -static void llfixup(ubyte fmt, ubyte *flags, long long *lln) +static void llfixup(ubyte fmt, FAR ubyte *flags, FAR long long *lln) { /* Perform the integer conversion according to the format specifier */ @@ -1004,7 +1003,7 @@ static int getllusize(ubyte fmt, ubyte flags, unsigned long long lln) * Name: prejustify ****************************************************************************/ -static void prejustify(struct lib_stream_s *obj, ubyte fmt, +static void prejustify(FAR struct lib_stream_s *obj, ubyte fmt, ubyte flags, int fieldwidth, int numwidth) { int i; @@ -1068,7 +1067,7 @@ static void prejustify(struct lib_stream_s *obj, ubyte fmt, * Name: postjustify ****************************************************************************/ -static void postjustify(struct lib_stream_s *obj, ubyte fmt, +static void postjustify(FAR struct lib_stream_s *obj, ubyte fmt, ubyte flags, int fieldwidth, int numwidth) { int i; @@ -1103,7 +1102,7 @@ static void postjustify(struct lib_stream_s *obj, ubyte fmt, * lib_vsprintf ****************************************************************************/ -int lib_vsprintf(struct lib_stream_s *obj, const char *src, va_list ap) +int lib_vsprintf(FAR struct lib_stream_s *obj, const char *src, va_list ap) { char *ptmp; #ifndef CONFIG_NOPRINTF_FIELDWIDTH diff --git a/nuttx/lib/lib_lowprintf.c b/nuttx/lib/lib_lowprintf.c index 6ce895e38..0059389df 100644 --- a/nuttx/lib/lib_lowprintf.c +++ b/nuttx/lib/lib_lowprintf.c @@ -1,7 +1,7 @@ -/************************************************************ - * lib_lowprintf.c +/**************************************************************************** + * lib/lib_lowprintf.c * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -14,7 +14,7 @@ * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. - * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * 3. Neither the name NuttX nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * @@ -31,56 +31,56 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Included Files - ************************************************************/ + ****************************************************************************/ #include <nuttx/config.h> #include <stdio.h> #include <debug.h> #include "lib_internal.h" -/************************************************************ +/**************************************************************************** * Definitions - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Type Declarations - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Function Prototypes - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Global Function Prototypes - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Global Constant Data - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Global Variables - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Constant Data - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Variables - ************************************************************/ + ****************************************************************************/ -/************************************************************ - * Global Functions - ************************************************************/ +/**************************************************************************** + * Public Functions + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Name: lib_lowvprintf - ************************************************************/ + ****************************************************************************/ #ifdef CONFIG_ARCH_LOWPUTC @@ -92,13 +92,13 @@ int lib_lowvprintf(const char *fmt, va_list ap) * do the work. */ - lib_lowstream(&stream); - return lib_vsprintf(&stream, fmt, ap); + lib_lowstream((FAR struct lib_stream_s *)&stream); + return lib_vsprintf((FAR struct lib_stream_s *)&stream, fmt, ap); } -/************************************************************ +/**************************************************************************** * Name: lib_lowprintf - ************************************************************/ + ****************************************************************************/ int lib_lowprintf(const char *fmt, ...) { diff --git a/nuttx/lib/lib_lowstream.c b/nuttx/lib/lib_lowstream.c index e0985d3f1..0045ed7cd 100644 --- a/nuttx/lib/lib_lowstream.c +++ b/nuttx/lib/lib_lowstream.c @@ -1,7 +1,7 @@ -/************************************************************ +/**************************************************************************** * lib_lowstream.c * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -14,7 +14,7 @@ * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. - * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * 3. Neither the name NuttX nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Included Files - ************************************************************/ + ****************************************************************************/ #include <nuttx/config.h> @@ -47,11 +47,15 @@ #include "lib_internal.h" -/************************************************************ +/**************************************************************************** * Private Functions - ************************************************************/ + ****************************************************************************/ -static void lowstream_putc(struct lib_stream_s *this, int ch) +/**************************************************************************** + * Name: lowstream_putc + ****************************************************************************/ + +static void lowstream_putc(FAR struct lib_stream_s *this, int ch) { if (this && up_putc(ch) != EOF) { @@ -59,11 +63,15 @@ static void lowstream_putc(struct lib_stream_s *this, int ch) } } -/************************************************************ +/**************************************************************************** * Public Functions - ************************************************************/ + ****************************************************************************/ + +/**************************************************************************** + * Name: lib_lowstream + ****************************************************************************/ -void lib_lowstream(struct lib_stream_s *stream) +void lib_lowstream(FAR struct lib_stream_s *stream) { stream->put = lowstream_putc; stream->nput = 0; diff --git a/nuttx/lib/lib_memstream.c b/nuttx/lib/lib_memstream.c index 713c77e16..937408be4 100644 --- a/nuttx/lib/lib_memstream.c +++ b/nuttx/lib/lib_memstream.c @@ -1,7 +1,7 @@ -/************************************************************ - * lib_memstream.c +/**************************************************************************** + * lib/lib_memstream.c * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -14,7 +14,7 @@ * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. - * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * 3. Neither the name NuttX nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * @@ -31,21 +31,25 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Included Files - ************************************************************/ + ****************************************************************************/ #include "lib_internal.h" -/************************************************************ +/**************************************************************************** * Private Functions - ************************************************************/ + ****************************************************************************/ -static void memstream_putc(struct lib_stream_s *this, int ch) +/**************************************************************************** + * Name: memstream_putc + ****************************************************************************/ + +static void memstream_putc(FAR struct lib_stream_s *this, int ch) { - struct lib_memstream_s *mthis = (struct lib_memstream_s *)this; + FAR struct lib_memstream_s *mthis = (FAR struct lib_memstream_s *)this; if (this && this->nput < mthis->buflen - 1) { mthis->buffer[this->nput] = ch; @@ -54,12 +58,16 @@ static void memstream_putc(struct lib_stream_s *this, int ch) } } -/************************************************************ +/**************************************************************************** * Public Functions - ************************************************************/ + ****************************************************************************/ + +/**************************************************************************** + * Name: lib_memstream + ****************************************************************************/ -void lib_memstream(struct lib_memstream_s *memstream, - char *bufstart, int buflen) +void lib_memstream(FAR struct lib_memstream_s *memstream, + FAR char *bufstart, int buflen) { memstream->public.put = memstream_putc; memstream->public.nput = 0; /* Will be buffer index */ diff --git a/nuttx/lib/lib_nullstream.c b/nuttx/lib/lib_nullstream.c index f4c1ceb88..52ba09f68 100644 --- a/nuttx/lib/lib_nullstream.c +++ b/nuttx/lib/lib_nullstream.c @@ -1,7 +1,7 @@ -/************************************************************ - * lib_nullstream.c +/**************************************************************************** + * lib/lib_nullstream.c * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -14,7 +14,7 @@ * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. - * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * 3. Neither the name NuttX nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * @@ -31,30 +31,30 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Included Files - ************************************************************/ + ****************************************************************************/ #include <stdio.h> #include <errno.h> #include "lib_internal.h" -/************************************************************ +/**************************************************************************** * Private Functions - ************************************************************/ + ****************************************************************************/ -static void nullstream_putc(struct lib_stream_s *this, int ch) +static void nullstream_putc(FAR struct lib_stream_s *this, int ch) { this->nput++; } -/************************************************************ +/**************************************************************************** * Public Functions - ************************************************************/ + ****************************************************************************/ -void lib_nullstream(struct lib_stream_s *nullstream) +void lib_nullstream(FAR struct lib_stream_s *nullstream) { nullstream->put = nullstream_putc; nullstream->nput = 0; diff --git a/nuttx/lib/lib_printf.c b/nuttx/lib/lib_printf.c index 613de7db9..f2e0c8f7b 100644 --- a/nuttx/lib/lib_printf.c +++ b/nuttx/lib/lib_printf.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib_printf.c + * lib/lib_printf.c * * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> diff --git a/nuttx/lib/lib_puts.c b/nuttx/lib/lib_puts.c index ad9a4061f..129c7b807 100644 --- a/nuttx/lib/lib_puts.c +++ b/nuttx/lib/lib_puts.c @@ -1,7 +1,7 @@ -/************************************************************ +/**************************************************************************** * lib_puts.c * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -14,7 +14,7 @@ * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. - * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * 3. Neither the name NuttX nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * @@ -31,64 +31,64 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Compilation Switches - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Included Files - ************************************************************/ + ****************************************************************************/ #include <stdio.h> #include "lib_internal.h" -/************************************************************ +/**************************************************************************** * Definitions - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Type Declarations - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Function Prototypes - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Global Function Prototypes - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Public Constant Data - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Public Variables - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Constant Data - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Variables - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Public Functions - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Name: puts * * Description: * puts() writes the string s and a trailing newline to * stdout. - ************************************************************/ + ****************************************************************************/ -int puts(const char *s) +int puts(FAR const char *s) { int nwritten; int nput = EOF; diff --git a/nuttx/lib/lib_rawprintf.c b/nuttx/lib/lib_rawprintf.c index 7748fb14e..7b61c299d 100644 --- a/nuttx/lib/lib_rawprintf.c +++ b/nuttx/lib/lib_rawprintf.c @@ -1,7 +1,7 @@ -/************************************************************ - * lib_rawprintf.c +/**************************************************************************** + * lib/lib_rawprintf.c * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -14,7 +14,7 @@ * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. - * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * 3. Neither the name NuttX nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * @@ -31,55 +31,55 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Included Files - ************************************************************/ + ****************************************************************************/ #include <stdio.h> #include <debug.h> #include "lib_internal.h" -/************************************************************ +/**************************************************************************** * Definitions - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Type Declarations - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Function Prototypes - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Global Function Prototypes - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Global Constant Data - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Global Variables - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Constant Data - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Variables - ************************************************************/ + ****************************************************************************/ -/************************************************************ - * Global Functions - ************************************************************/ +/**************************************************************************** + * Public Functions + ****************************************************************************/ -/************************************************************ - * Aame: lib_rawvprintf - ************************************************************/ +/**************************************************************************** + * Name: lib_rawvprintf + ****************************************************************************/ int lib_rawvprintf(const char *fmt, va_list ap) { @@ -102,17 +102,17 @@ int lib_rawvprintf(const char *fmt, va_list ap) * do the work. */ - lib_lowstream(&stream); - return lib_vsprintf(&stream, fmt, ap); + lib_lowstream((FAR struct lib_stream_s *)&stream); + return lib_vsprintf((FAR struct lib_stream_s *)&stream, fmt, ap); #else return 0; #endif } -/************************************************************ +/**************************************************************************** * Name: lib_rawprintf - ************************************************************/ + ****************************************************************************/ int lib_rawprintf(const char *fmt, ...) { diff --git a/nuttx/lib/lib_rawstream.c b/nuttx/lib/lib_rawstream.c index 899175620..068199db5 100644 --- a/nuttx/lib/lib_rawstream.c +++ b/nuttx/lib/lib_rawstream.c @@ -1,7 +1,7 @@ -/************************************************************ - * lib_rawstream.c +/**************************************************************************** + * lib/lib_rawstream.c * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -14,7 +14,7 @@ * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. - * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * 3. Neither the name NuttX nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * @@ -31,23 +31,27 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Included Files - ************************************************************/ + ****************************************************************************/ #include <unistd.h> #include <errno.h> #include "lib_internal.h" -/************************************************************ +/**************************************************************************** * Private Functions - ************************************************************/ + ****************************************************************************/ -static void rawstream_putc(struct lib_stream_s *this, int ch) +/**************************************************************************** + * Name: rawstream_putc + ****************************************************************************/ + +static void rawstream_putc(FAR struct lib_stream_s *this, int ch) { - struct lib_rawstream_s *rthis = (struct lib_rawstream_s *)this; + FAR struct lib_rawstream_s *rthis = (FAR struct lib_rawstream_s *)this; char buffer = ch; if (this && rthis->fd >= 0) { @@ -64,11 +68,15 @@ static void rawstream_putc(struct lib_stream_s *this, int ch) } } -/************************************************************ +/**************************************************************************** * Public Functions - ************************************************************/ + ****************************************************************************/ + +/**************************************************************************** + * Name: lib_rawstream + ****************************************************************************/ -void lib_rawstream(struct lib_rawstream_s *rawstream, int fd) +void lib_rawstream(FAR struct lib_rawstream_s *rawstream, int fd) { rawstream->public.put = rawstream_putc; rawstream->public.nput = 0; diff --git a/nuttx/lib/lib_rdflush.c b/nuttx/lib/lib_rdflush.c index d7d4380c5..451dccfdc 100644 --- a/nuttx/lib/lib_rdflush.c +++ b/nuttx/lib/lib_rdflush.c @@ -92,7 +92,7 @@ ****************************************************************************/ #if CONFIG_STDIO_BUFFER_SIZE > 0 -int lib_rdflush(FILE *stream) +int lib_rdflush(FAR FILE *stream) { if (!stream) { diff --git a/nuttx/lib/lib_snprintf.c b/nuttx/lib/lib_snprintf.c index 4f018ff51..e1673161f 100644 --- a/nuttx/lib/lib_snprintf.c +++ b/nuttx/lib/lib_snprintf.c @@ -1,7 +1,7 @@ -/************************************************************ - * lib_snprintf.c +/**************************************************************************** + * lib/lib_snprintf.c * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -14,7 +14,7 @@ * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. - * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * 3. Neither the name NuttX nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * @@ -31,52 +31,52 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Included Files - ************************************************************/ + ****************************************************************************/ #include <stdio.h> #include "lib_internal.h" -/************************************************************ +/**************************************************************************** * Definitions - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Type Declarations - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Function Prototypes - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Global Constant Data - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Global Variables - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Constant Data - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Variables - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Global Functions - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * sprintf - ************************************************************/ + ****************************************************************************/ -int snprintf(char *buf, size_t size, const char *format, ...) +int snprintf(FAR char *buf, size_t size, const char *format, ...) { struct lib_memstream_s memstream; va_list ap; @@ -84,12 +84,12 @@ int snprintf(char *buf, size_t size, const char *format, ...) /* Initialize a memory stream to write to the buffer */ - lib_memstream(&memstream, buf, size); + lib_memstream((FAR struct lib_memstream_s *)&memstream, buf, size); /* Then let lib_vsprintf do the real work */ va_start(ap, format); - n = lib_vsprintf(&memstream.public, format, ap); + n = lib_vsprintf((FAR struct lib_stream_s *)&memstream.public, format, ap); va_end(ap); return n; } diff --git a/nuttx/lib/lib_sprintf.c b/nuttx/lib/lib_sprintf.c index 47ec01301..0a5496b88 100644 --- a/nuttx/lib/lib_sprintf.c +++ b/nuttx/lib/lib_sprintf.c @@ -1,7 +1,7 @@ -/************************************************************ - * lib_sprintf.c +/**************************************************************************** + * lib/lib_sprintf.c * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -14,7 +14,7 @@ * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. - * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * 3. Neither the name NuttX nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * @@ -31,52 +31,52 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Included Files - ************************************************************/ + ****************************************************************************/ #include <stdio.h> #include "lib_internal.h" -/************************************************************ +/**************************************************************************** * Definitions - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Type Declarations - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Function Prototypes - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Global Constant Data - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Global Variables - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Constant Data - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Variables - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Global Functions - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * sprintf - ************************************************************/ + ****************************************************************************/ -int sprintf (char *buf, const char *fmt, ...) +int sprintf (FAR char *buf, const char *fmt, ...) { struct lib_memstream_s memstream; va_list ap; @@ -84,12 +84,12 @@ int sprintf (char *buf, const char *fmt, ...) /* Initialize a memory stream to write to the buffer */ - lib_memstream(&memstream, buf, LIB_BUFLEN_UNKNOWN); + lib_memstream((FAR struct lib_memstream_s *)&memstream, buf, LIB_BUFLEN_UNKNOWN); /* Then let lib_vsprintf do the real work */ va_start(ap, fmt); - n = lib_vsprintf(&memstream.public, fmt, ap); + n = lib_vsprintf((FAR struct lib_stream_s *)&memstream.public, fmt, ap); va_end(ap); return n; } diff --git a/nuttx/lib/lib_stdstream.c b/nuttx/lib/lib_stdstream.c index 3637af7f9..9c696a97d 100644 --- a/nuttx/lib/lib_stdstream.c +++ b/nuttx/lib/lib_stdstream.c @@ -43,9 +43,13 @@ * Private Functions ****************************************************************************/ -static void stdstream_putc(struct lib_stream_s *this, int ch) +/**************************************************************************** + * Name: stdstream_putc + ****************************************************************************/ + +static void stdstream_putc(FAR struct lib_stream_s *this, int ch) { - struct lib_stdstream_s *sthis = (struct lib_stdstream_s *)this; + FAR struct lib_stdstream_s *sthis = (FAR struct lib_stdstream_s *)this; if (this) { if (putc(ch, sthis->stream) != EOF) @@ -59,8 +63,12 @@ static void stdstream_putc(struct lib_stream_s *this, int ch) * Public Functions ****************************************************************************/ -void lib_stdstream(struct lib_stdstream_s *stdstream, - FILE *stream) +/**************************************************************************** + * Name: lib_stdstream + ****************************************************************************/ + +void lib_stdstream(FAR struct lib_stdstream_s *stdstream, + FAR FILE *stream) { stdstream->public.put = stdstream_putc; stdstream->public.nput = 0; diff --git a/nuttx/lib/lib_ungetc.c b/nuttx/lib/lib_ungetc.c index 9831244d8..b3ec910c0 100644 --- a/nuttx/lib/lib_ungetc.c +++ b/nuttx/lib/lib_ungetc.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib_ungetc.c + * lib/lib_ungetc.c * * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> @@ -81,14 +81,14 @@ **************************************************************************/ /**************************************************************************** - * Global Functions + * Public Functions **************************************************************************/ /**************************************************************************** * Name: ungetc **************************************************************************/ -int ungetc(int c, FILE *stream) +int ungetc(int c, FAR FILE *stream) { #if CONFIG_NUNGET_CHARS > 0 int nungotten; diff --git a/nuttx/lib/lib_vfprintf.c b/nuttx/lib/lib_vfprintf.c index d8c9a7fb0..197b27856 100644 --- a/nuttx/lib/lib_vfprintf.c +++ b/nuttx/lib/lib_vfprintf.c @@ -75,7 +75,7 @@ * Public Functions ****************************************************************************/ -int vfprintf(FILE *stream, const char *fmt, va_list ap) +int vfprintf(FAR FILE *stream, FAR const char *fmt, va_list ap) { struct lib_stdstream_s stdstream; int n = ERROR; diff --git a/nuttx/lib/lib_vprintf.c b/nuttx/lib/lib_vprintf.c index 2d345ec6f..65498250d 100644 --- a/nuttx/lib/lib_vprintf.c +++ b/nuttx/lib/lib_vprintf.c @@ -1,7 +1,7 @@ -/************************************************************ - * lib_vprintf.c +/**************************************************************************** + * lib/lib_vprintf.c * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -14,7 +14,7 @@ * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. - * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * 3. Neither the name NuttX nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * @@ -31,59 +31,59 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Compilation Switches - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Included Files - ************************************************************/ + ****************************************************************************/ #include <stdio.h> -/************************************************************ +/**************************************************************************** * Definitions - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Type Declarations - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Function Prototypes - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Global Function Prototypes - ************************************************************/ + ****************************************************************************/ -/********************************************************** +/************************************************************************** * Global Constant Data - **********************************************************/ + **************************************************************************/ -/************************************************************ +/**************************************************************************** * Global Variables - ************************************************************/ + ****************************************************************************/ -/********************************************************** +/************************************************************************** * Private Constant Data - **********************************************************/ + **************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Variables - **********************************************************/ + **************************************************************************/ -/************************************************************ - * Global Functions - **********************************************************/ +/**************************************************************************** + * Public Functions + **************************************************************************/ -/************************************************************ - * vprintf - **********************************************************/ +/**************************************************************************** + * Name: vprintf + **************************************************************************/ -int vprintf(const char *fmt, va_list ap) +int vprintf(FAR const char *fmt, va_list ap) { /* vfprintf into stdout */ diff --git a/nuttx/lib/lib_vsnprintf.c b/nuttx/lib/lib_vsnprintf.c index 5dba0cac2..3467cfd50 100644 --- a/nuttx/lib/lib_vsnprintf.c +++ b/nuttx/lib/lib_vsnprintf.c @@ -1,7 +1,7 @@ -/************************************************************ +/**************************************************************************** * lib/lib_vsnprintf.c * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -14,7 +14,7 @@ * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. - * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * 3. Neither the name NuttX nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * @@ -31,62 +31,62 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Included Files - ************************************************************/ + ****************************************************************************/ #include <stdio.h> #include "lib_internal.h" -/************************************************************ +/**************************************************************************** * Definitions - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Type Declarations - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Function Prototypes - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Global Constant Data - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Global Variables - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Constant Data - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Variables - ************************************************************/ + ****************************************************************************/ -/************************************************************ - * Global Functions - ************************************************************/ +/**************************************************************************** + * Public Functions + ****************************************************************************/ -/************************************************************ - * sprintf - ************************************************************/ +/**************************************************************************** + * Name: vsnprintf + ****************************************************************************/ -int vsnprintf(char *buf, size_t size, const char *format, va_list ap) +int vsnprintf(FAR char *buf, size_t size, const char *format, va_list ap) { struct lib_memstream_s memstream; int n; /* Initialize a memory stream to write to the buffer */ - lib_memstream(&memstream, buf, size); + lib_memstream((FAR struct lib_memstream_s *)&memstream, buf, size); /* Then let lib_vsprintf do the real work */ - n = lib_vsprintf(&memstream.public, format, ap); + n = lib_vsprintf((FAR struct lib_stream_s *)&memstream.public, format, ap); return n; } diff --git a/nuttx/lib/lib_vsprintf.c b/nuttx/lib/lib_vsprintf.c index 961ddf9ea..2d8da2a43 100644 --- a/nuttx/lib/lib_vsprintf.c +++ b/nuttx/lib/lib_vsprintf.c @@ -1,5 +1,5 @@ /**************************************************************************** - * lib_vsprintf.c + * lib/lib_vsprintf.c * * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> @@ -75,14 +75,14 @@ ****************************************************************************/ /**************************************************************************** - * Global Functions + * Public Functions ****************************************************************************/ /**************************************************************************** - * vsprintf + * Name: vsprintf ****************************************************************************/ -int vsprintf (char *dest, const char *src, va_list ap) +int vsprintf(FAR char *dest, const char *src, va_list ap) { struct lib_memstream_s memstream; @@ -90,6 +90,6 @@ int vsprintf (char *dest, const char *src, va_list ap) * lib_vsprintf do the work. */ - lib_memstream(&memstream, dest, LIB_BUFLEN_UNKNOWN); - return lib_vsprintf(&memstream.public, src, ap); + lib_memstream((FAR struct lib_memstream_s *)&memstream, dest, LIB_BUFLEN_UNKNOWN); + return lib_vsprintf((FAR struct lib_stream_s *)&memstream.public, src, ap); } diff --git a/nuttx/lib/lib_wrflush.c b/nuttx/lib/lib_wrflush.c index 73e24afec..a928d9dcc 100644 --- a/nuttx/lib/lib_wrflush.c +++ b/nuttx/lib/lib_wrflush.c @@ -78,7 +78,7 @@ ****************************************************************************/ /**************************************************************************** - * Global Functions + * Public Functions ****************************************************************************/ /**************************************************************************** @@ -90,7 +90,7 @@ * ****************************************************************************/ -int lib_wrflush(FILE *stream) +int lib_wrflush(FAR FILE *stream) { /* Verify that we were passed a valid (i.e., non-NULL) stream */ |