Exemple #1
0
	int vsnprintf (

/*  SYNOPSIS */
	char	   * str,
	size_t	     n,
	const char * format,
	va_list      args)

/*  FUNCTION
	Format a list of arguments and put them into the string str.
	The function makes sure that no more than n characters (including
	the terminal 0 byte) are written into str.

    INPUTS
	str - The formatted result is stored here
	n - The size of str
	format - A printf() format string.
	args - A list of arguments for the format string.

    RESULT
	The number of characters written into the string. The 0 byte at the
	end is not included. If this is greater than or equal to n then
	there was not enough room to write all characters. In this case the
	output string is not null-terminated, and the return value is the
	number of characters which would have been written if enough space had
	been available.

    NOTES

    EXAMPLE

    BUGS

    SEE ALSO
	printf(), sprintf(), fprintf(), vprintf(), vfprintf(), snprintf(),
	vsnprintf()

    INTERNALS

******************************************************************************/
{
    int rc;
    struct data data;

    data.n = n;
    data.str = str;

    rc = __vcformat (&data, (void *)_vsnprintf_uc, format, args);

    if (data.n)
    {
	*(data.str) = 0;
    }

    return rc;
} /* vsnprintf */
Exemple #2
0
	int vfprintf (

/*  SYNOPSIS */
	FILE	   * stream,
	const char * format,
	va_list      args)

/*  FUNCTION
	Format a list of arguments and print them on the specified stream.

    INPUTS
	stream - A stream on which one can write
	format - A printf() format string.
	args - A list of arguments for the format string.

    RESULT
	The number of characters written.

    NOTES

    EXAMPLE

    BUGS

    SEE ALSO

    INTERNALS

******************************************************************************/
{
    fdesc *fdesc = __getfdesc(stream->fd);

    if (!fdesc)
    {
	errno = EBADF;
	return 0;
    }

    return __vcformat (fdesc->fcb->fh, __putc, format, args);
} /* vfprintf */
Exemple #3
0
/*
 * This is internal version of KrnBug(), to be called directly by bug() macro.
 * If you want to reimplement it, override this file.
 * However, generally you won't want to do this, because __vcformat() supports
 * AROS-specific extensions, like %b, which are unlikely supported by your host OS.
 */
int krnBug(const char *format, va_list args, APTR kernelBase)
{
    int retval = 0;

#if defined(__AROSEXEC_SMP__)
    if (safedebug & 1)
    {
        while (bit_test_and_set_long((ULONG*)&safedebug, 1)) { asm volatile("pause"); };
    }
#endif

    retval = __vcformat(kernelBase, (int (*)(int, void *))UniPutC, format, args);

#if defined(__AROSEXEC_SMP__)
    if (safedebug & 1)
    {
        __AROS_ATOMIC_AND_L(safedebug, ~(1 << 1));
    }
#endif

    return retval;
}
Exemple #4
0
	outb(chr, 0xf0002080);
	while (!(inw(0xf0002004) & 0x400));
}


AROS_LH2(int, KrnBug,
         AROS_LHA(const char *, format, A0),
         AROS_LHA(va_list, args, A1),
         struct KernelBase *, KernelBase, 11, Kernel)
{
    AROS_LIBFUNC_INIT

#if 1
    int result;

    result = __vcformat(NULL, __putc, format, args);

    return result;
#endif

    AROS_LIBFUNC_EXIT
}







#define SHT_PROGBITS    1
#define SHT_SYMTAB      2