fix compilation error (common)

This commit is contained in:
Yatis 2020-10-14 12:07:29 +02:00
parent aeedfcdb02
commit 3764de9a27
10 changed files with 32 additions and 13 deletions

View file

@ -73,7 +73,7 @@ extern ssize_t pwrite (int __fd, const void *__buf, size_t __n, off_t __offset);
** or the end of the file (if WHENCE is SEEK_END). ** or the end of the file (if WHENCE is SEEK_END).
** Return the new file position. ** Return the new file position.
*/ */
extern __off_t lseek (int __fd, off_t __offset, int __whence); extern off_t lseek (int __fd, off_t __offset, int __whence);
/* Close the file descriptor FD */ /* Close the file descriptor FD */
extern int close(int __fd); extern int close(int __fd);

View file

@ -34,7 +34,7 @@
#--- #---
MAJOR := 0 MAJOR := 0
MINOR := 2 MINOR := 2
PATCH := 0 PATCH := 1
EXTRAVERSION := -alpha EXTRAVERSION := -alpha

View file

@ -1,4 +1,4 @@
#include __SUPPORT_VHEX_KERNEL #ifdef __SUPPORT_VHEX_KERNEL
#include <asm/unistd_32.h> #include <asm/unistd_32.h>
.text .text
.global _kill .global _kill

View file

@ -1,5 +1,5 @@
#ifndef _SRC_STDIO_PRINTF_H__ #ifndef _SRC_STDIO_INTERNAL_PRINTF_H__
# define _SRC_STDIO_PRINTF_H__ # define _SRC_STDIO_INTERNAL_PRINTF_H__
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
@ -55,4 +55,4 @@ struct printf_opt
// Internal symbols used to define all actions possibility // Internal symbols used to define all actions possibility
extern void (*action[26])(struct printf_opt *opt, char n); extern void (*action[26])(struct printf_opt *opt, char n);
#endif /*_SRC_STDIO_PRINTF_H__*/ #endif /*_SRC_STDIO_INTERNAL_PRINTF_H__*/

View file

@ -1,5 +1,9 @@
#include <stdio.h> #include <stdio.h>
// internal depency
// TODO: update path detection
#include "../src/stdio/internal/printf.h"
// Define all actions // Define all actions
static void action_str(struct printf_opt *op, char n); static void action_str(struct printf_opt *op, char n);
static void action_ptr(struct printf_opt *op, char n); static void action_ptr(struct printf_opt *op, char n);
@ -25,7 +29,7 @@ void (*action[26])(struct printf_opt *opt, char n) = {
static void base_to_str(struct printf_opt *opt, uint32_t num, int base, int digits) static void base_to_str(struct printf_opt *opt, uint32_t num, int base, int digits)
{ {
char *hexa = (opt->uppercase == 1) ? "0123456789ABCDEF" : "0123456789abcdef"; char *hexa = (opt->uppercase == 1) ? "0123456789ABCDEF" : "0123456789abcdef";
opt->digits = 0; opt->digits = 0;
while (num != 0 || opt->digits < digits) while (num != 0 || opt->digits < digits)
{ {
@ -131,7 +135,7 @@ static void action_ptr(struct printf_opt *opt, char n)
opt->sign = '@'; opt->sign = '@';
opt->base[0] = '0'; opt->base[0] = '0';
opt->base[1] = 'x'; opt->base[1] = 'x';
base_to_str(opt, (uint32_t)va_arg(opt->ap, void*), 16, 8); base_to_str(opt, (uintptr_t)va_arg(opt->ap, void*), 16, 8);
disp_format(opt); disp_format(opt);
} }
@ -150,7 +154,7 @@ static void action_int(struct printf_opt *opt, char n)
opt->sign = (opt->flags.plus == 1) ? '+' : ' '; opt->sign = (opt->flags.plus == 1) ? '+' : ' ';
} }
// Generate / display number // Generate / display number
base_to_str(opt, num, 10, 1); base_to_str(opt, num, 10, 1);
disp_format(opt); disp_format(opt);
} }
@ -169,8 +173,7 @@ static void action_uint(struct printf_opt *opt, char n)
} }
// Display extra symbols if needed // Display extra symbols if needed
if (opt->flags.diez == 1) if (opt->flags.diez == 1) {
{
if (n == 'o') { if (n == 'o') {
opt->base[0] = '0'; opt->base[0] = '0';
} else if (n == 'x') { } else if (n == 'x') {

View file

@ -1,5 +1,9 @@
#include <stdio.h> #include <stdio.h>
// internal depency
// TODO: update path detection
#include "../src/stdio/internal/printf.h"
//TODO: precision handling //TODO: precision handling
int printf_common(struct printf_opt *opt, const char *restrict format) int printf_common(struct printf_opt *opt, const char *restrict format)
{ {

View file

@ -1,5 +1,9 @@
#include <stdio.h> #include <stdio.h>
// internal depency
// TODO: update path detection
#include "../src/stdio/internal/printf.h"
static int get_flags(struct printf_opt *opt, const char *restrict format) static int get_flags(struct printf_opt *opt, const char *restrict format)
{ {
int i; int i;

View file

@ -1,6 +1,10 @@
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
// internal depency
// TODO: update path detection
#include "../src/stdio/internal/printf.h"
// FIXME: // FIXME:
// if the writte syscall do not return the same // if the writte syscall do not return the same
// number of bytes that requested, stop the function ! // number of bytes that requested, stop the function !
@ -31,5 +35,5 @@ int vdprintf(int fd, const char *restrict format, va_list ap)
opt.disp_char = &disp_char; opt.disp_char = &disp_char;
opt.disp_fflush = &disp_fflush; opt.disp_fflush = &disp_fflush;
va_copy(opt.ap, ap); va_copy(opt.ap, ap);
return (printf_common(&opt, format)); return (printf_common(&opt, format));
} }

View file

@ -1,5 +1,9 @@
#include <stdio.h> #include <stdio.h>
// internal depency
// TODO: update path detection
#include "../src/stdio/internal/printf.h"
static void disp_char(struct printf_opt *opt, char n) static void disp_char(struct printf_opt *opt, char n)
{ {
// Check write possibility // Check write possibility

View file

@ -1,4 +1,4 @@
#include __SUPPORT_VHEX_KERNEL #ifdef __SUPPORT_VHEX_KERNEL
#include <asm/unistd_32.h> #include <asm/unistd_32.h>
.text .text
.global _fork_execve .global _fork_execve