Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 3398 → Rev 3343

/branches/sparc/uspace/lib/libc/generic/getopt.c
File deleted
/branches/sparc/uspace/lib/libc/generic/ipc.c
682,7 → 682,7
{
int res;
sysarg_t tmp_flags;
res = async_req_3_2(phoneid, IPC_M_SHARE_IN, (ipcarg_t) dst,
res = ipc_call_sync_3_2(phoneid, IPC_M_SHARE_IN, (ipcarg_t) dst,
(ipcarg_t) size, arg, NULL, &tmp_flags);
if (flags)
*flags = tmp_flags;
742,7 → 742,7
*/
int ipc_share_out_start(int phoneid, void *src, int flags)
{
return async_req_3_0(phoneid, IPC_M_SHARE_OUT, (ipcarg_t) src, 0,
return ipc_call_sync_3_0(phoneid, IPC_M_SHARE_OUT, (ipcarg_t) src, 0,
(ipcarg_t) flags);
}
 
/branches/sparc/uspace/lib/libc/generic/io/asprintf.c
File deleted
/branches/sparc/uspace/lib/libc/generic/io/printf_core.c
94,9 → 94,12
if (str == NULL)
return printf_putnchars("(NULL)", 6, ps);
 
count = strlen(str);
for (count = 0; str[count] != 0; count++);
 
return ps->write((void *) str, count, ps->data);
if (ps->write((void *) str, count, ps->data) == count)
return 0;
return EOF;
}
 
/** Print one character to output
/branches/sparc/uspace/lib/libc/generic/io/vsnprintf.c
38,27 → 38,22
#include <io/printf_core.h>
 
struct vsnprintf_data {
size_t size; /* total space for string */
size_t len; /* count of currently used characters */
char *string; /* destination string */
size_t size; /* total space for string */
size_t len; /* count of currently used characters */
char *string; /* destination string */
};
 
/** Write string to given buffer.
* Write at most data->size characters including trailing zero. According to C99
* has snprintf to return number of characters that would have been written if
* enough space had been available. Hence the return value is not number of
* really printed characters but size of input string. Number of really used
* characters is stored in data->len.
*
* @param str Source string to print.
* @param count Size of the source string.
* @param data Structure with destination string, counter of used space
* and total string size.
* @return Number of characters to print (not characters really
* printed!)
* Write at most data->size characters including trailing zero. According to C99 has snprintf to return number
* of characters that would have been written if enough space had been available. Hence the return value is not
* number of really printed characters but size of input string. Number of really used characters
* is stored in data->len.
* @param str source string to print
* @param count size of source string
* @param data structure with destination string, counter of used space and total string size.
* @return number of characters to print (not characters really printed!)
*/
static int
vsnprintf_write(const char *str, size_t count, struct vsnprintf_data *data)
static int vsnprintf_write(const char *str, size_t count, struct vsnprintf_data *data)
{
size_t i;
i = data->size - data->len;
68,10 → 63,7
}
if (i == 1) {
/*
* We have only one free byte left in buffer => write there
* trailing zero.
*/
/* We have only one free byte left in buffer => write there trailing zero */
data->string[data->size - 1] = 0;
data->len = data->size;
return count;
78,23 → 70,17
}
if (i <= count) {
/*
* We have not enought space for whole string with the trailing
* zero => print only a part of string.
*/
memcpy((void *)(data->string + data->len), (void *)str, i - 1);
data->string[data->size - 1] = 0;
data->len = data->size;
return count;
/* We have not enought space for whole string with the trailing zero => print only a part of string */
memcpy((void *)(data->string + data->len), (void *)str, i - 1);
data->string[data->size - 1] = 0;
data->len = data->size;
return count;
}
/* Buffer is big enought to print whole string */
memcpy((void *)(data->string + data->len), (void *)str, count);
data->len += count;
/*
* Put trailing zero at end, but not count it into data->len so it could
* be rewritten next time.
*/
/* Put trailing zero at end, but not count it into data->len so it could be rewritten next time */
data->string[data->len] = 0;
 
return count;
101,22 → 87,17
}
 
/** Print formatted to the given buffer with limited size.
* @param str Buffer.
* @param size Bffer size.
* @param fmt Format string.
* @param str buffer
* @param size buffer size
* @param fmt format string
* \see For more details about format string see printf_core.
*/
int vsnprintf(char *str, size_t size, const char *fmt, va_list ap)
{
struct vsnprintf_data data = {size, 0, str};
struct printf_spec ps = {
(int(*)(void *, size_t, void *)) vsnprintf_write,
&data
};
struct printf_spec ps = {(int(*)(void *, size_t, void *)) vsnprintf_write, &data};
 
/*
* Print 0 at end of string - fix the case that nothing will be printed.
*/
/* Print 0 at end of string - fix the case that nothing will be printed */
if (size > 0)
str[0] = 0;
/branches/sparc/uspace/lib/libc/generic/io/sprintf.c
48,6 → 48,7
va_start(args, fmt);
ret = vsprintf(str, fmt, args);
 
va_end(args);
 
return ret;
/branches/sparc/uspace/lib/libc/include/getopt.h
File deleted
/branches/sparc/uspace/lib/libc/include/stdio.h
54,17 → 54,16
 
extern int getchar(void);
 
extern int puts(const char *);
extern int putchar(int);
extern int puts(const char * str);
extern int putchar(int c);
 
extern int printf(const char *, ...);
extern int asprintf(char **, const char *, ...);
extern int sprintf(char *, const char *fmt, ...);
extern int snprintf(char *, size_t , const char *, ...);
extern int printf(const char *fmt, ...);
extern int sprintf(char *str, const char *fmt, ...);
extern int snprintf(char *str, size_t size, const char *fmt, ...);
 
extern int vprintf(const char *, va_list);
extern int vsprintf(char *, const char *, va_list);
extern int vsnprintf(char *, size_t, const char *, va_list);
extern int vprintf(const char *fmt, va_list ap);
extern int vsprintf(char *str, const char *fmt, va_list ap);
extern int vsnprintf(char *str, size_t size, const char *fmt, va_list ap);
 
#define fprintf(f, fmt, ...) printf(fmt, ##__VA_ARGS__)
 
/branches/sparc/uspace/lib/libc/arch/sparc64/Makefile.inc
29,12 → 29,8
## Toolchain configuration
#
 
ifndef CROSS_PREFIX
CROSS_PREFIX = /usr/local
endif
 
TARGET = sparc64-linux-gnu
TOOLCHAIN_DIR = $(CROSS_PREFIX)/sparc64/bin
TOOLCHAIN_DIR = /usr/local/sparc64/bin
 
ARCH_SOURCES += arch/$(ARCH)/src/fibril.S \
arch/$(ARCH)/src/tls.c
/branches/sparc/uspace/lib/libc/arch/ia64/Makefile.inc
29,12 → 29,8
## Toolchain configuration
#
 
ifndef CROSS_PREFIX
CROSS_PREFIX = /usr/local
endif
 
TARGET = ia64-pc-linux-gnu
TOOLCHAIN_DIR = $(CROSS_PREFIX)/ia64/bin
TOOLCHAIN_DIR = /usr/local/ia64/bin
CFLAGS += -fno-unwind-tables -DMALLOC_ALIGNMENT_16
LFLAGS += -N $(SOFTINT_PREFIX)/libsoftint.a
AFLAGS +=
/branches/sparc/uspace/lib/libc/arch/arm32/Makefile.inc
30,12 → 30,8
## Toolchain configuration
#
 
ifndef CROSS_PREFIX
CROSS_PREFIX = /usr/local
endif
 
TARGET = arm-linux-gnu
TOOLCHAIN_DIR = $(CROSS_PREFIX)/arm/bin
TOOLCHAIN_DIR = /usr/local/arm/bin
CFLAGS += -ffixed-r9 -mtp=soft
LFLAGS += -N $(SOFTINT_PREFIX)/libsoftint.a
AFLAGS +=
/branches/sparc/uspace/lib/libc/arch/ppc32/Makefile.inc
29,12 → 29,8
## Toolchain configuration
#
 
ifndef CROSS_PREFIX
CROSS_PREFIX = /usr/local
endif
 
TARGET = ppc-linux-gnu
TOOLCHAIN_DIR = $(CROSS_PREFIX)/ppc/bin
TOOLCHAIN_DIR = /usr/local/ppc/bin
 
ARCH_SOURCES += arch/$(ARCH)/src/syscall.c \
arch/$(ARCH)/src/fibril.S \
/branches/sparc/uspace/lib/libc/arch/amd64/Makefile.inc
29,12 → 29,8
## Toolchain configuration
#
 
ifndef CROSS_PREFIX
CROSS_PREFIX = /usr/local
endif
 
TARGET = amd64-linux-gnu
TOOLCHAIN_DIR = $(CROSS_PREFIX)/amd64/bin
TOOLCHAIN_DIR = /usr/local/amd64/bin
 
ARCH_SOURCES += arch/$(ARCH)/src/syscall.S \
arch/$(ARCH)/src/fibril.S \
/branches/sparc/uspace/lib/libc/arch/ppc64/Makefile.inc
29,12 → 29,8
## Toolchain configuration
#
 
ifndef CROSS_PREFIX
CROSS_PREFIX = /usr/local
endif
 
TARGET = ppc64-linux-gnu
TOOLCHAIN_DIR = $(CROSS_PREFIX)/ppc64/bin
TOOLCHAIN_DIR = /usr/local/ppc64/bin
 
ARCH_SOURCES += arch/$(ARCH)/src/syscall.c \
arch/$(ARCH)/src/fibril.S \
/branches/sparc/uspace/lib/libc/arch/mips32/Makefile.inc
29,12 → 29,8
## Toolchain configuration
#
 
ifndef CROSS_PREFIX
CROSS_PREFIX = /usr/local
endif
 
TARGET = mipsel-linux-gnu
TOOLCHAIN_DIR = $(CROSS_PREFIX)/mipsel/bin
TOOLCHAIN_DIR = /usr/local/mipsel/bin
CFLAGS += -mips3
 
-include ../../Makefile.config
/branches/sparc/uspace/lib/libc/arch/ia32/Makefile.inc
29,12 → 29,8
## Toolchain configuration
#
 
ifndef CROSS_PREFIX
CROSS_PREFIX = /usr/local
endif
 
TARGET = i686-pc-linux-gnu
TOOLCHAIN_DIR = $(CROSS_PREFIX)/i686/bin
TOOLCHAIN_DIR = /usr/local/i686/bin
 
ARCH_SOURCES += arch/$(ARCH)/src/syscall.S \
arch/$(ARCH)/src/fibril.S \
/branches/sparc/uspace/lib/libc/arch/mips32eb/Makefile.inc
29,12 → 29,8
## Toolchain configuration
#
 
ifndef CROSS_PREFIX
CROSS_PREFIX = /usr/local
endif
 
TARGET = mips-sgi-irix5
TOOLCHAIN_DIR = $(CROSS_PREFIX)/mips/bin
TOOLCHAIN_DIR = /usr/local/mips/bin
CFLAGS += -mips3
 
ARCH_SOURCES += arch/$(ARCH)/src/syscall.c \
/branches/sparc/uspace/lib/libc/Makefile
57,7 → 57,6
generic/tls.c \
generic/task.c \
generic/futex.c \
generic/io/asprintf.c \
generic/io/io.c \
generic/io/printf.c \
generic/io/stream.c \
71,7 → 70,6
generic/sysinfo.c \
generic/ipc.c \
generic/async.c \
generic/getopt.c \
generic/libadt/list.o \
generic/libadt/hash_table.o \
generic/time.c \