The Pedigree Project  0.1
compat.cc
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #include <stdarg.h>
21 #include "pedigree/kernel/compiler.h"
22 #include "pedigree/kernel/Log.h"
23 #include "pedigree/kernel/processor/types.h"
24 #include "pedigree/kernel/utilities/utility.h"
25 
26 extern "C" int printf(const char* fmt, ...)
27 {
28  static char print_temp[1024];
29  va_list argptr;
30  va_start(argptr, fmt);
31  int ret = VStringFormat(print_temp, fmt, argptr);
32  if(print_temp[ret - 1] == '\n')
33  print_temp[--ret] = 0;
34  NOTICE(print_temp);
35  va_end(argptr);
36  return ret;
37 }
38 
39 extern "C" int snprintf(char *s, size_t n, const char *fmt, ...)
40 {
41  va_list argptr;
42  va_start(argptr, fmt);
43  int ret = VStringFormat(s, fmt, argptr);
44  va_end(argptr);
45  return ret;
46 }
47 
48 extern "C" int puts(const char *s)
49 {
50  NOTICE(s);
51  return StringLength(s);
52 }
#define NOTICE(text)
Definition: Log.h:74