Make use of FAR consistent in stdio.h
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@1182 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
parent
46b4c0cec1
commit
a8a3b454ce
|
@ -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;
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -99,7 +99,7 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
int fflush(FILE *stream)
|
||||
int fflush(FAR FILE *stream)
|
||||
{
|
||||
/* Is the stream argument NULL? */
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -100,7 +100,7 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
int fgetpos(FILE *stream, fpos_t *pos)
|
||||
int fgetpos(FAR FILE *stream, FAR fpos_t *pos)
|
||||
{
|
||||
long position;
|
||||
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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, ...)
|
||||
{
|
||||
|
|
|
@ -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
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
void lib_lowstream(struct lib_stream_s *stream)
|
||||
/****************************************************************************
|
||||
* Name: lib_lowstream
|
||||
****************************************************************************/
|
||||
|
||||
void lib_lowstream(FAR struct lib_stream_s *stream)
|
||||
{
|
||||
stream->put = lowstream_putc;
|
||||
stream->nput = 0;
|
||||
|
|
|
@ -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
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
void lib_memstream(struct lib_memstream_s *memstream,
|
||||
char *bufstart, int buflen)
|
||||
/****************************************************************************
|
||||
* Name: lib_memstream
|
||||
****************************************************************************/
|
||||
|
||||
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 */
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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, ...)
|
||||
{
|
||||
|
|
|
@ -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
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
void lib_rawstream(struct lib_rawstream_s *rawstream, int fd)
|
||||
/****************************************************************************
|
||||
* Name: lib_rawstream
|
||||
****************************************************************************/
|
||||
|
||||
void lib_rawstream(FAR struct lib_rawstream_s *rawstream, int fd)
|
||||
{
|
||||
rawstream->public.put = rawstream_putc;
|
||||
rawstream->public.nput = 0;
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
****************************************************************************/
|
||||
|
||||
#if CONFIG_STDIO_BUFFER_SIZE > 0
|
||||
int lib_rdflush(FILE *stream)
|
||||
int lib_rdflush(FAR FILE *stream)
|
||||
{
|
||||
if (!stream)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
Loading…
Reference in New Issue