mes: Run build-aux/indent.sh.
* src/mes.c: Re-indent. * src: Likewise. * include: Likewise. * lib: Likewise. * scaffold: Likewise.
This commit is contained in:
parent
a46c318bb8
commit
c33d6d00bc
|
@ -36,11 +36,11 @@ typedef unsigned long size_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if _ALLOCA_UNSIGNED
|
#if _ALLOCA_UNSIGNED
|
||||||
void * alloca (unsigned size);
|
void *alloca (unsigned size);
|
||||||
#elif _ALLOCA_CHAR
|
#elif _ALLOCA_CHAR
|
||||||
char * alloca (int);
|
char *alloca (int);
|
||||||
#else
|
#else
|
||||||
void * alloca (size_t size);
|
void *alloca (size_t size);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // ! WITH_GLIBC
|
#endif // ! WITH_GLIBC
|
||||||
|
|
|
@ -42,14 +42,14 @@
|
||||||
#define ARFMAG "`\n" /* String in ar_fmag at end of each header. */
|
#define ARFMAG "`\n" /* String in ar_fmag at end of each header. */
|
||||||
|
|
||||||
struct ar_hdr
|
struct ar_hdr
|
||||||
{
|
{
|
||||||
char ar_name[16]; /* Member file name, sometimes / terminated. */
|
char ar_name[16]; /* Member file name, sometimes / terminated. */
|
||||||
char ar_date[12]; /* File date, decimal seconds since Epoch. */
|
char ar_date[12]; /* File date, decimal seconds since Epoch. */
|
||||||
char ar_uid[6], ar_gid[6]; /* User and group IDs, in ASCII decimal. */
|
char ar_uid[6], ar_gid[6]; /* User and group IDs, in ASCII decimal. */
|
||||||
char ar_mode[8]; /* File mode, in ASCII octal. */
|
char ar_mode[8]; /* File mode, in ASCII octal. */
|
||||||
char ar_size[10]; /* File size, in ASCII decimal. */
|
char ar_size[10]; /* File size, in ASCII decimal. */
|
||||||
char ar_fmag[2]; /* Always contains ARFMAG. */
|
char ar_fmag[2]; /* Always contains ARFMAG. */
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ! WITH_GLIBC
|
#endif // ! WITH_GLIBC
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include_next <assert.h>
|
#include_next <assert.h>
|
||||||
#else // ! WITH_GLIBC
|
#else // ! WITH_GLIBC
|
||||||
#define assert(x) ((x) ? (void)0 : assert_fail (#x))
|
#define assert(x) ((x) ? (void)0 : assert_fail (#x))
|
||||||
void assert_fail (char* s);
|
void assert_fail (char *s);
|
||||||
#endif // ! WITH_GLIBC
|
#endif // ! WITH_GLIBC
|
||||||
|
|
||||||
#endif // __MES_ASSERT_H
|
#endif // __MES_ASSERT_H
|
||||||
|
|
|
@ -41,10 +41,10 @@
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
int __getdirentries (int filedes, char *buffer, size_t nbytes, off_t *basep);
|
int __getdirentries (int filedes, char *buffer, size_t nbytes, off_t * basep);
|
||||||
|
|
||||||
struct dirent
|
struct dirent
|
||||||
{
|
{
|
||||||
ino_t d_ino;
|
ino_t d_ino;
|
||||||
off_t d_off;
|
off_t d_off;
|
||||||
unsigned short int d_reclen;
|
unsigned short int d_reclen;
|
||||||
|
@ -52,7 +52,7 @@ struct dirent
|
||||||
unsigned char d_type;
|
unsigned char d_type;
|
||||||
#endif
|
#endif
|
||||||
char d_name[256]; /* We must not include limits.h! */
|
char d_name[256]; /* We must not include limits.h! */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Open a directory stream on NAME.
|
/* Open a directory stream on NAME.
|
||||||
Return a DIR stream on the directory, or NULL if it could not be opened. */
|
Return a DIR stream on the directory, or NULL if it could not be opened. */
|
||||||
|
@ -60,16 +60,16 @@ DIR *opendir (char const *name);
|
||||||
|
|
||||||
/* Close the directory stream DIRP.
|
/* Close the directory stream DIRP.
|
||||||
Return 0 if successful, -1 if not. */
|
Return 0 if successful, -1 if not. */
|
||||||
int closedir (DIR *dirp);
|
int closedir (DIR * dirp);
|
||||||
|
|
||||||
/* Read a directory entry from DIRP.
|
/* Read a directory entry from DIRP.
|
||||||
Return a pointer to a `struct dirent' describing the entry,
|
Return a pointer to a `struct dirent' describing the entry,
|
||||||
or NULL for EOF or error. The storage returned may be overwritten
|
or NULL for EOF or error. The storage returned may be overwritten
|
||||||
by a later readdir call on the same DIR stream. */
|
by a later readdir call on the same DIR stream. */
|
||||||
struct dirent *readdir (DIR *dirp);
|
struct dirent *readdir (DIR * dirp);
|
||||||
|
|
||||||
/* Rewind DIRP to the beginning of the directory. */
|
/* Rewind DIRP to the beginning of the directory. */
|
||||||
extern void rewinddir (DIR *dirp);
|
extern void rewinddir (DIR * dirp);
|
||||||
|
|
||||||
#endif // ! WITH_GLIBC
|
#endif // ! WITH_GLIBC
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
/* Directory stream type. */
|
/* Directory stream type. */
|
||||||
struct __dirstream
|
struct __dirstream
|
||||||
{
|
{
|
||||||
int fd; /* File descriptor. */
|
int fd; /* File descriptor. */
|
||||||
|
|
||||||
char *data; /* Directory block. */
|
char *data; /* Directory block. */
|
||||||
|
@ -46,7 +46,7 @@ struct __dirstream
|
||||||
size_t offset; /* Current offset into the block. */
|
size_t offset; /* Current offset into the block. */
|
||||||
|
|
||||||
off_t filepos; /* Position of next entry to read. */
|
off_t filepos; /* Position of next entry to read. */
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct __dirstream DIR;
|
typedef struct __dirstream DIR;
|
||||||
|
|
||||||
|
|
|
@ -26,4 +26,3 @@
|
||||||
#endif // (WITH_GLIBC)
|
#endif // (WITH_GLIBC)
|
||||||
|
|
||||||
#endif // __MES_FEATURES_H
|
#endif // __MES_FEATURES_H
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include_next <libgen.h>
|
#include_next <libgen.h>
|
||||||
|
|
||||||
#else // ! WITH_GLIBC
|
#else // ! WITH_GLIBC
|
||||||
char* dirname (char*);
|
char *dirname (char *);
|
||||||
#endif // ! WITH_GLIBC
|
#endif // ! WITH_GLIBC
|
||||||
|
|
||||||
#endif // __MES_LIBGEN_H
|
#endif // __MES_LIBGEN_H
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
#endif
|
#endif
|
||||||
// *INDENT-ON*
|
// *INDENT-ON*
|
||||||
|
|
||||||
char * setlocale (int category, char const *locale);
|
char *setlocale (int category, char const *locale);
|
||||||
|
|
||||||
#endif // ! WITH_GLIBC
|
#endif // ! WITH_GLIBC
|
||||||
|
|
||||||
|
|
|
@ -79,12 +79,12 @@ int __stdin;
|
||||||
int __stdout;
|
int __stdout;
|
||||||
int __stderr;
|
int __stderr;
|
||||||
|
|
||||||
int eputs (char const* s);
|
int eputs (char const *s);
|
||||||
int puts (char const* s);
|
int puts (char const *s);
|
||||||
int oputs (char const* s);
|
int oputs (char const *s);
|
||||||
|
|
||||||
#if !WITH_GLIBC
|
#if !WITH_GLIBC
|
||||||
size_t strlen (char const* s);
|
size_t strlen (char const *s);
|
||||||
ssize_t _write ();
|
ssize_t _write ();
|
||||||
ssize_t write (int filedes, void const *buffer, size_t size);
|
ssize_t write (int filedes, void const *buffer, size_t size);
|
||||||
#endif // !WITH_GLIBC
|
#endif // !WITH_GLIBC
|
||||||
|
|
|
@ -39,7 +39,7 @@ int atoi (char const *s);
|
||||||
int eputc (int c);
|
int eputc (int c);
|
||||||
int fdgetc (int fd);
|
int fdgetc (int fd);
|
||||||
int fdputc (int c, int fd);
|
int fdputc (int c, int fd);
|
||||||
int fdputs (char const* s, int fd);
|
int fdputs (char const *s, int fd);
|
||||||
int fdungetc (int c, int fd);
|
int fdungetc (int c, int fd);
|
||||||
int _fdungetc_p (int fd);
|
int _fdungetc_p (int fd);
|
||||||
int isdigit (int c);
|
int isdigit (int c);
|
||||||
|
@ -49,7 +49,7 @@ int mes_open (char const *file_name, int flags, int mask);
|
||||||
int _open2 (char const *file_name, int flags);
|
int _open2 (char const *file_name, int flags);
|
||||||
int _open3 (char const *file_name, int flags, int mask);
|
int _open3 (char const *file_name, int flags, int mask);
|
||||||
int oputc (int c);
|
int oputc (int c);
|
||||||
int oputs (char const* s);
|
int oputs (char const *s);
|
||||||
char *search_path (char const *file_name);
|
char *search_path (char const *file_name);
|
||||||
|
|
||||||
#endif //__MES_LIB_H
|
#endif //__MES_LIB_H
|
||||||
|
|
|
@ -36,7 +36,7 @@ struct passwd
|
||||||
char *pw_shell;
|
char *pw_shell;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct passwd * getpwuid ();
|
struct passwd *getpwuid ();
|
||||||
|
|
||||||
|
|
||||||
#endif // ! WITH_GLIBC
|
#endif // ! WITH_GLIBC
|
||||||
|
|
|
@ -118,7 +118,7 @@ typedef struct siginfo_t
|
||||||
#if __MESC__
|
#if __MESC__
|
||||||
typedef long sighandler_t;
|
typedef long sighandler_t;
|
||||||
#else
|
#else
|
||||||
typedef void (*sighandler_t)(int);
|
typedef void (*sighandler_t) (int);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct sigaction
|
struct sigaction
|
||||||
|
@ -199,14 +199,14 @@ struct _libc_fpstate
|
||||||
typedef struct _libc_fpstate *fpregset_t;
|
typedef struct _libc_fpstate *fpregset_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
gregset_t gregs;
|
gregset_t gregs;
|
||||||
/* Due to Linux's history we have to use a pointer here. The SysV/i386
|
/* Due to Linux's history we have to use a pointer here. The SysV/i386
|
||||||
ABI requires a struct with the values. */
|
ABI requires a struct with the values. */
|
||||||
fpregset_t fpregs;
|
fpregset_t fpregs;
|
||||||
unsigned long int oldmask;
|
unsigned long int oldmask;
|
||||||
unsigned long int cr2;
|
unsigned long int cr2;
|
||||||
} mcontext_t;
|
} mcontext_t;
|
||||||
|
|
||||||
/* Userlevel context. */
|
/* Userlevel context. */
|
||||||
typedef struct ucontext
|
typedef struct ucontext
|
||||||
|
@ -222,19 +222,19 @@ typedef struct ucontext
|
||||||
|
|
||||||
int kill (pid_t pid, int signum);
|
int kill (pid_t pid, int signum);
|
||||||
int sigaction (int signum, struct sigaction const *act, struct sigaction *oldact);
|
int sigaction (int signum, struct sigaction const *act, struct sigaction *oldact);
|
||||||
int sigaddset (sigset_t *set, int signum);
|
int sigaddset (sigset_t * set, int signum);
|
||||||
#if __MESC__
|
#if __MESC__
|
||||||
void* signal (int signum, void * action);
|
void *signal (int signum, void *action);
|
||||||
#else
|
#else
|
||||||
sighandler_t signal (int signum, sighandler_t action);
|
sighandler_t signal (int signum, sighandler_t action);
|
||||||
#endif
|
#endif
|
||||||
int sigemptyset (sigset_t *set);
|
int sigemptyset (sigset_t * set);
|
||||||
#ifndef SIG_BLOCK
|
#ifndef SIG_BLOCK
|
||||||
#define SIG_BLOCK 0
|
#define SIG_BLOCK 0
|
||||||
#define SIG_UNBLOCK 1
|
#define SIG_UNBLOCK 1
|
||||||
#define SIG_SETMASK 2
|
#define SIG_SETMASK 2
|
||||||
#endif
|
#endif
|
||||||
int sigprocmask (int how, sigset_t const *set, sigset_t *oldset);
|
int sigprocmask (int how, sigset_t const *set, sigset_t * oldset);
|
||||||
|
|
||||||
#endif //! WITH_GLIBC
|
#endif //! WITH_GLIBC
|
||||||
|
|
||||||
|
|
|
@ -37,8 +37,8 @@ typedef char *va_list;
|
||||||
#define va_end(ap) (void)((ap) = 0)
|
#define va_end(ap) (void)((ap) = 0)
|
||||||
#define va_copy(dest, src) dest = src
|
#define va_copy(dest, src) dest = src
|
||||||
|
|
||||||
int vfprintf (FILE *stream, char const *template, va_list ap);
|
int vfprintf (FILE * stream, char const *template, va_list ap);
|
||||||
int vprintf (char const* format, va_list ap);
|
int vprintf (char const *format, va_list ap);
|
||||||
int vsprintf (char *str, char const *format, va_list ap);
|
int vsprintf (char *str, char const *format, va_list ap);
|
||||||
int vsnprintf (char *str, size_t size, char const *format, va_list ap);
|
int vsnprintf (char *str, size_t size, char const *format, va_list ap);
|
||||||
int vsscanf (char const *s, char const *template, va_list ap);
|
int vsscanf (char const *s, char const *template, va_list ap);
|
||||||
|
|
|
@ -58,35 +58,35 @@
|
||||||
FILE *fdopen (int fd, char const *mode);
|
FILE *fdopen (int fd, char const *mode);
|
||||||
FILE *fopen (char const *file_name, char const *mode);
|
FILE *fopen (char const *file_name, char const *mode);
|
||||||
int eputc (int c);
|
int eputc (int c);
|
||||||
int eputs (char const* s);
|
int eputs (char const *s);
|
||||||
int fclose (FILE *stream);
|
int fclose (FILE * stream);
|
||||||
int feof (FILE *stream);
|
int feof (FILE * stream);
|
||||||
int ferror (FILE *stream);
|
int ferror (FILE * stream);
|
||||||
int fflush (FILE *stream);
|
int fflush (FILE * stream);
|
||||||
int fgetc (FILE* stream);
|
int fgetc (FILE * stream);
|
||||||
char *fgets (char *s, int size, FILE *stream);
|
char *fgets (char *s, int size, FILE * stream);
|
||||||
int fprintf (FILE *stream, char const *format, ...);
|
int fprintf (FILE * stream, char const *format, ...);
|
||||||
int fpurge (FILE *stream);
|
int fpurge (FILE * stream);
|
||||||
int fputc (int c, FILE *stream);
|
int fputc (int c, FILE * stream);
|
||||||
int fputs (char const* s, FILE *stream);
|
int fputs (char const *s, FILE * stream);
|
||||||
int fseek (FILE *stream, long offset, int whence);
|
int fseek (FILE * stream, long offset, int whence);
|
||||||
int getc (FILE *stream);
|
int getc (FILE * stream);
|
||||||
int getchar (void);
|
int getchar (void);
|
||||||
char *getlogin (void);
|
char *getlogin (void);
|
||||||
int printf (char const* format, ...);
|
int printf (char const *format, ...);
|
||||||
int putc (int c, FILE* stream);
|
int putc (int c, FILE * stream);
|
||||||
int putchar (int c);
|
int putchar (int c);
|
||||||
int puts (char const* s);
|
int puts (char const *s);
|
||||||
int remove (char const *file_name);
|
int remove (char const *file_name);
|
||||||
int setvbuf (FILE *stream, char *buf, int mode, size_t size);
|
int setvbuf (FILE * stream, char *buf, int mode, size_t size);
|
||||||
int snprintf(char *str, size_t size, char const *format, ...);
|
int snprintf (char *str, size_t size, char const *format, ...);
|
||||||
int sprintf (char *str, char const* format, ...);
|
int sprintf (char *str, char const *format, ...);
|
||||||
int sscanf (char const *str, const char *format, ...);
|
int sscanf (char const *str, const char *format, ...);
|
||||||
int ungetc (int c, FILE* stream);
|
int ungetc (int c, FILE * stream);
|
||||||
long ftell (FILE *stream);
|
long ftell (FILE * stream);
|
||||||
size_t fread (void *ptr, size_t size, size_t count, FILE *stream);
|
size_t fread (void *ptr, size_t size, size_t count, FILE * stream);
|
||||||
size_t freadahead (FILE *fp);
|
size_t freadahead (FILE * fp);
|
||||||
size_t fwrite (void const *ptr, size_t size, size_t count, FILE *stream);
|
size_t fwrite (void const *ptr, size_t size, size_t count, FILE * stream);
|
||||||
|
|
||||||
#endif // ! WITH_GLIBC
|
#endif // ! WITH_GLIBC
|
||||||
|
|
||||||
|
|
|
@ -34,15 +34,15 @@
|
||||||
double atof (char const *s);
|
double atof (char const *s);
|
||||||
int atoi (char const *s);
|
int atoi (char const *s);
|
||||||
int atexit (void (*function) (void));
|
int atexit (void (*function) (void));
|
||||||
void * calloc (size_t nmemb, size_t size);
|
void *calloc (size_t nmemb, size_t size);
|
||||||
void _exit (int status);
|
void _exit (int status);
|
||||||
void exit (int status);
|
void exit (int status);
|
||||||
void free (void *ptr);
|
void free (void *ptr);
|
||||||
char* getenv (char const* s);
|
char *getenv (char const *s);
|
||||||
int setenv (char const* s, char const* v, int overwrite_p);
|
int setenv (char const *s, char const *v, int overwrite_p);
|
||||||
void unsetenv (char const *name);
|
void unsetenv (char const *name);
|
||||||
void *malloc (size_t);
|
void *malloc (size_t);
|
||||||
void qsort (void *base, size_t nmemb, size_t size, int (*compar)(void const *, void const *));
|
void qsort (void *base, size_t nmemb, size_t size, int (*compar) (void const *, void const *));
|
||||||
int rand (void);
|
int rand (void);
|
||||||
void *realloc (void *p, size_t size);
|
void *realloc (void *p, size_t size);
|
||||||
double strtod (char const *string, char **tailptr);
|
double strtod (char const *string, char **tailptr);
|
||||||
|
@ -61,7 +61,7 @@ unsigned long long strtoull (char const *string, char **tailptr, int base);
|
||||||
typedef int (*comparison_fn_t) (void const *, void const *);
|
typedef int (*comparison_fn_t) (void const *, void const *);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void * bsearch (void const *key, void const *array, size_t count, size_t size, comparison_fn_t compare);
|
void *bsearch (void const *key, void const *array, size_t count, size_t size, comparison_fn_t compare);
|
||||||
|
|
||||||
#endif // ! WITH_GLIBC
|
#endif // ! WITH_GLIBC
|
||||||
|
|
||||||
|
|
|
@ -45,25 +45,25 @@ typedef unsigned long size_t;
|
||||||
typedef long ssize_t;
|
typedef long ssize_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void * memchr (void const *block, int c, size_t size);
|
void *memchr (void const *block, int c, size_t size);
|
||||||
void *memcpy (void *dest, void const *src, size_t n);
|
void *memcpy (void *dest, void const *src, size_t n);
|
||||||
void *memmove (void *dest, void const *src, size_t n);
|
void *memmove (void *dest, void const *src, size_t n);
|
||||||
void *memset (void *s, int c, size_t n);
|
void *memset (void *s, int c, size_t n);
|
||||||
void * memchr (void const *block, int c, size_t size);
|
void *memchr (void const *block, int c, size_t size);
|
||||||
int memcmp (void const *s1, void const *s2, size_t n);
|
int memcmp (void const *s1, void const *s2, size_t n);
|
||||||
|
|
||||||
char *strcat (char *dest, char const *src);
|
char *strcat (char *dest, char const *src);
|
||||||
char *strchr (char const *s, int c);
|
char *strchr (char const *s, int c);
|
||||||
int strcasecmp (char const *s1, char const *s2);
|
int strcasecmp (char const *s1, char const *s2);
|
||||||
int strcmp (char const*, char const*);
|
int strcmp (char const *, char const *);
|
||||||
char *strcpy (char *dest, char const *src);
|
char *strcpy (char *dest, char const *src);
|
||||||
size_t strlen (char const*);
|
size_t strlen (char const *);
|
||||||
char *strncpy (char *to, char const *from, size_t size);
|
char *strncpy (char *to, char const *from, size_t size);
|
||||||
int strncmp (char const*, char const*, size_t);
|
int strncmp (char const *, char const *, size_t);
|
||||||
char *strrchr (char const *s, int c);
|
char *strrchr (char const *s, int c);
|
||||||
char *strstr (char const *haystack, char const *needle);
|
char *strstr (char const *haystack, char const *needle);
|
||||||
char * strlwr (char *string);
|
char *strlwr (char *string);
|
||||||
char * strupr (char *string);
|
char *strupr (char *string);
|
||||||
|
|
||||||
|
|
||||||
char *strerror (int errnum);
|
char *strerror (int errnum);
|
||||||
|
|
|
@ -26,4 +26,3 @@
|
||||||
#endif // (WITH_GLIBC)
|
#endif // (WITH_GLIBC)
|
||||||
|
|
||||||
#endif // __MES_STRINGS_H
|
#endif // __MES_STRINGS_H
|
||||||
|
|
||||||
|
|
|
@ -26,4 +26,3 @@
|
||||||
#endif // (WITH_GLIBC)
|
#endif // (WITH_GLIBC)
|
||||||
|
|
||||||
#endif // __MES_SYS_CDEFS_H
|
#endif // __MES_SYS_CDEFS_H
|
||||||
|
|
||||||
|
|
|
@ -33,4 +33,3 @@ int ioctl (int fd, unsigned long request, ...);
|
||||||
#endif // ! WITH_GLIBC
|
#endif // ! WITH_GLIBC
|
||||||
|
|
||||||
#endif // __MES_SYS_IOCTL_H
|
#endif // __MES_SYS_IOCTL_H
|
||||||
|
|
||||||
|
|
|
@ -28,4 +28,3 @@ typedef int fd_set;
|
||||||
#endif //! WITH_GLIBC
|
#endif //! WITH_GLIBC
|
||||||
|
|
||||||
#endif // __MES_SYS_SELECT_H
|
#endif // __MES_SYS_SELECT_H
|
||||||
|
|
||||||
|
|
|
@ -26,4 +26,3 @@
|
||||||
#endif // (WITH_GLIBC)
|
#endif // (WITH_GLIBC)
|
||||||
|
|
||||||
#endif // __MES_SYS_TIMEB_H
|
#endif // __MES_SYS_TIMEB_H
|
||||||
|
|
||||||
|
|
|
@ -26,4 +26,3 @@
|
||||||
#endif // (WITH_GLIBC)
|
#endif // (WITH_GLIBC)
|
||||||
|
|
||||||
#endif // __MES_SYS_UCONTEXT_H
|
#endif // __MES_SYS_UCONTEXT_H
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ struct user_fpregs_struct
|
||||||
long int fcs;
|
long int fcs;
|
||||||
long int foo;
|
long int foo;
|
||||||
long int fos;
|
long int fos;
|
||||||
long int st_space [20];
|
long int st_space[20];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct user_fpxregs_struct
|
struct user_fpxregs_struct
|
||||||
|
|
|
@ -31,7 +31,8 @@ typedef long int clockid_t;
|
||||||
typedef long int time_t;
|
typedef long int time_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct tm {
|
struct tm
|
||||||
|
{
|
||||||
int tm_sec;
|
int tm_sec;
|
||||||
int tm_min;
|
int tm_min;
|
||||||
int tm_hour;
|
int tm_hour;
|
||||||
|
@ -59,7 +60,7 @@ int clock_gettime (clockid_t clk_id, struct timespec *tp);
|
||||||
struct tm *localtime (time_t const *timep);
|
struct tm *localtime (time_t const *timep);
|
||||||
struct tm *gmtime (time_t const *time);
|
struct tm *gmtime (time_t const *time);
|
||||||
|
|
||||||
time_t time (time_t *tloc);
|
time_t time (time_t * tloc);
|
||||||
|
|
||||||
#endif // ! WITH_GLIBC
|
#endif // ! WITH_GLIBC
|
||||||
|
|
||||||
|
|
|
@ -78,9 +78,9 @@ off_t lseek (int fd, off_t offset, int whence);
|
||||||
ssize_t read (int fd, void *buffer, size_t size);
|
ssize_t read (int fd, void *buffer, size_t size);
|
||||||
#if __SBRK_CHAR_PTRDIFF
|
#if __SBRK_CHAR_PTRDIFF
|
||||||
/* xmalloc in binutils <= 2.10.1 uses this old prototype */
|
/* xmalloc in binutils <= 2.10.1 uses this old prototype */
|
||||||
char * sbrk (ptrdiff_t delta);
|
char *sbrk (ptrdiff_t delta);
|
||||||
#else
|
#else
|
||||||
void * sbrk (intptr_t delta);
|
void *sbrk (intptr_t delta);
|
||||||
#endif
|
#endif
|
||||||
int unlink (char const *file_name);
|
int unlink (char const *file_name);
|
||||||
ssize_t write (int filedes, void const *buffer, size_t size);
|
ssize_t write (int filedes, void const *buffer, size_t size);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
void
|
void
|
||||||
assert_fail (char* s)
|
assert_fail (char *s)
|
||||||
{
|
{
|
||||||
eputs ("assert fail: ");
|
eputs ("assert fail: ");
|
||||||
eputs (s);
|
eputs (s);
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
__getdirentries (int filedes, char *buffer, size_t nbytes, off_t *basep)
|
__getdirentries (int filedes, char *buffer, size_t nbytes, off_t * basep)
|
||||||
{
|
{
|
||||||
if (basep)
|
if (basep)
|
||||||
*basep = lseek (filedes, (off_t) 0, SEEK_CUR);
|
*basep = lseek (filedes, (off_t) 0, SEEK_CUR);
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
/* Close the directory stream DIRP.
|
/* Close the directory stream DIRP.
|
||||||
Return 0 if successful, -1 if not. */
|
Return 0 if successful, -1 if not. */
|
||||||
int
|
int
|
||||||
closedir (DIR *dirp)
|
closedir (DIR * dirp)
|
||||||
{
|
{
|
||||||
int filedes;
|
int filedes;
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ opendir (char const *name)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
fd = open (name, O_RDONLY|O_DIRECTORY);
|
fd = open (name, O_RDONLY | O_DIRECTORY);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
|
|
||||||
/* Read a directory entry from DIRP. */
|
/* Read a directory entry from DIRP. */
|
||||||
struct dirent *
|
struct dirent *
|
||||||
readdir (DIR *dirp)
|
readdir (DIR * dirp)
|
||||||
{
|
{
|
||||||
struct dirent *dp;
|
struct dirent *dp;
|
||||||
int saved_errno = errno;
|
int saved_errno = errno;
|
||||||
|
@ -79,7 +79,8 @@ readdir (DIR *dirp)
|
||||||
dirp->filepos = dp->d_off;
|
dirp->filepos = dp->d_off;
|
||||||
|
|
||||||
/* Skip deleted files. */
|
/* Skip deleted files. */
|
||||||
} while (dp->d_ino == 0);
|
}
|
||||||
|
while (dp->d_ino == 0);
|
||||||
|
|
||||||
return dp;
|
return dp;
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ mes_open (char const *file_name, int flags, int mask)
|
||||||
if (r > 2)
|
if (r > 2)
|
||||||
__ungetc_buf[r] = -1;
|
__ungetc_buf[r] = -1;
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <mes/eputs.c>
|
#include <mes/eputs.c>
|
||||||
#include <mes/oputs.c>
|
#include <mes/oputs.c>
|
||||||
|
|
|
@ -27,7 +27,7 @@ __divdi3 (double a, double b)
|
||||||
if (__mes_debug () && !stub)
|
if (__mes_debug () && !stub)
|
||||||
eputs ("__divdi3 stub\n");
|
eputs ("__divdi3 stub\n");
|
||||||
stub = 1;
|
stub = 1;
|
||||||
return ((int)a / (int)b);
|
return ((int) a / (int) b);
|
||||||
}
|
}
|
||||||
|
|
||||||
double
|
double
|
||||||
|
@ -37,7 +37,7 @@ __moddi3 (double a, double b)
|
||||||
if (__mes_debug () && !stub)
|
if (__mes_debug () && !stub)
|
||||||
eputs ("__moddi3 stub\n");
|
eputs ("__moddi3 stub\n");
|
||||||
stub = 1;
|
stub = 1;
|
||||||
return ((int) a %(int)b);
|
return ((int) a % (int) b);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long long
|
unsigned long long
|
||||||
|
|
|
@ -21,5 +21,5 @@
|
||||||
int
|
int
|
||||||
access (char const *file_name, int how)
|
access (char const *file_name, int how)
|
||||||
{
|
{
|
||||||
return _sys_call2 (SYS_access, (long)file_name, (int)how);
|
return _sys_call2 (SYS_access, (long) file_name, (int) how);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,5 +21,5 @@
|
||||||
long
|
long
|
||||||
brk (void *addr)
|
brk (void *addr)
|
||||||
{
|
{
|
||||||
return _sys_call1 (SYS_brk, (long)addr);
|
return _sys_call1 (SYS_brk, (long) addr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,5 +21,5 @@
|
||||||
int
|
int
|
||||||
chdir (char const *file_name)
|
chdir (char const *file_name)
|
||||||
{
|
{
|
||||||
return _sys_call1 (SYS_chdir, (long)file_name);
|
return _sys_call1 (SYS_chdir, (long) file_name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,5 +21,5 @@
|
||||||
int
|
int
|
||||||
chmod (char const *file_name, mode_t mask)
|
chmod (char const *file_name, mode_t mask)
|
||||||
{
|
{
|
||||||
return _sys_call2 (SYS_chmod, (long)file_name, (long)mask);
|
return _sys_call2 (SYS_chmod, (long) file_name, (long) mask);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,5 +23,5 @@
|
||||||
int
|
int
|
||||||
clock_gettime (clockid_t clk_id, struct timespec *tp)
|
clock_gettime (clockid_t clk_id, struct timespec *tp)
|
||||||
{
|
{
|
||||||
return _sys_call2 (SYS_clock_gettime, (long)clk_id, (long)tp);
|
return _sys_call2 (SYS_clock_gettime, (long) clk_id, (long) tp);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,5 +23,5 @@ close (int filedes)
|
||||||
{
|
{
|
||||||
if (filedes > 2)
|
if (filedes > 2)
|
||||||
__ungetc_buf[filedes] = -1;
|
__ungetc_buf[filedes] = -1;
|
||||||
return _sys_call1 (SYS_close, (int)filedes);
|
return _sys_call1 (SYS_close, (int) filedes);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,5 +21,5 @@
|
||||||
int
|
int
|
||||||
dup (int old)
|
dup (int old)
|
||||||
{
|
{
|
||||||
return _sys_call1 (SYS_dup, (int)old);
|
return _sys_call1 (SYS_dup, (int) old);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,5 +21,5 @@
|
||||||
int
|
int
|
||||||
dup2 (int old, int new)
|
dup2 (int old, int new)
|
||||||
{
|
{
|
||||||
return _sys_call2 (SYS_dup2, (int)old, (int)new);
|
return _sys_call2 (SYS_dup2, (int) old, (int) new);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
execve (char const* file_name, char *const argv[], char *const env[])
|
execve (char const *file_name, char *const argv[], char *const env[])
|
||||||
{
|
{
|
||||||
return _sys_call3 (SYS_execve, (long)file_name, (long)argv, (long)env);
|
return _sys_call3 (SYS_execve, (long) file_name, (long) argv, (long) env);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ fcntl (int filedes, int command, ...)
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start (ap, command);
|
va_start (ap, command);
|
||||||
int data = va_arg (ap, int);
|
int data = va_arg (ap, int);
|
||||||
int r = _sys_call3 (SYS_fcntl, (int)filedes, (int)command, (int)data);
|
int r = _sys_call3 (SYS_fcntl, (int) filedes, (int) command, (int) data);
|
||||||
va_end (ap);
|
va_end (ap);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,5 +21,5 @@
|
||||||
int
|
int
|
||||||
fstat (int filedes, struct stat *statbuf)
|
fstat (int filedes, struct stat *statbuf)
|
||||||
{
|
{
|
||||||
return _sys_call2 (SYS_fstat, (int)filedes, (long)statbuf);
|
return _sys_call2 (SYS_fstat, (int) filedes, (long) statbuf);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,5 +21,5 @@
|
||||||
int
|
int
|
||||||
fsync (int filedes)
|
fsync (int filedes)
|
||||||
{
|
{
|
||||||
return _sys_call1 (SYS_fsync, (int)filedes);
|
return _sys_call1 (SYS_fsync, (int) filedes);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
char *
|
char *
|
||||||
_getcwd (char *buffer, size_t size)
|
_getcwd (char *buffer, size_t size)
|
||||||
{
|
{
|
||||||
int r = _sys_call2 (SYS_getcwd, (long)buffer, (long)size);
|
int r = _sys_call2 (SYS_getcwd, (long) buffer, (long) size);
|
||||||
if (r >= 0)
|
if (r >= 0)
|
||||||
return buffer;
|
return buffer;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -21,5 +21,5 @@
|
||||||
int
|
int
|
||||||
getdents (int filedes, char *buffer, size_t nbytes)
|
getdents (int filedes, char *buffer, size_t nbytes)
|
||||||
{
|
{
|
||||||
return _sys_call3 (SYS_getdents, (int)filedes, (long)buffer, (long)nbytes);
|
return _sys_call3 (SYS_getdents, (int) filedes, (long) buffer, (long) nbytes);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,5 +21,5 @@
|
||||||
int
|
int
|
||||||
getrusage (int processes, struct rusage *rusage)
|
getrusage (int processes, struct rusage *rusage)
|
||||||
{
|
{
|
||||||
return _sys_call2 (SYS_getrusage, (int)processes, (long)rusage);
|
return _sys_call2 (SYS_getrusage, (int) processes, (long) rusage);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,5 +23,5 @@
|
||||||
int
|
int
|
||||||
gettimeofday (struct timeval *tv, struct timezone *tz)
|
gettimeofday (struct timeval *tv, struct timezone *tz)
|
||||||
{
|
{
|
||||||
return _sys_call2 (SYS_gettimeofday, (long)tv, (long)tz);
|
return _sys_call2 (SYS_gettimeofday, (long) tv, (long) tz);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ ioctl (int filedes, unsigned long command, ...)
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start (ap, command);
|
va_start (ap, command);
|
||||||
int data = va_arg (ap, int);
|
int data = va_arg (ap, int);
|
||||||
int r = _sys_call3 (SYS_ioctl, (int)filedes, (long)command, (int)data);
|
int r = _sys_call3 (SYS_ioctl, (int) filedes, (long) command, (int) data);
|
||||||
va_end (ap);
|
va_end (ap);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,5 +21,5 @@
|
||||||
int
|
int
|
||||||
kill (pid_t pid, int signum)
|
kill (pid_t pid, int signum)
|
||||||
{
|
{
|
||||||
return _sys_call2 (SYS_kill, (long)pid, (long)signum);
|
return _sys_call2 (SYS_kill, (long) pid, (long) signum);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,5 +21,5 @@
|
||||||
int
|
int
|
||||||
link (char const *old_name, char const *new_name)
|
link (char const *old_name, char const *new_name)
|
||||||
{
|
{
|
||||||
return _sys_call2 (SYS_link, (long)old_name, (long)new_name);
|
return _sys_call2 (SYS_link, (long) old_name, (long) new_name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,5 +21,5 @@
|
||||||
off_t
|
off_t
|
||||||
lseek (int filedes, off_t offset, int whence)
|
lseek (int filedes, off_t offset, int whence)
|
||||||
{
|
{
|
||||||
return _sys_call3 (SYS_lseek, (int)filedes, (long)offset, (int)whence);
|
return _sys_call3 (SYS_lseek, (int) filedes, (long) offset, (int) whence);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,5 +21,5 @@
|
||||||
int
|
int
|
||||||
lstat (char const *file_name, struct stat *statbuf)
|
lstat (char const *file_name, struct stat *statbuf)
|
||||||
{
|
{
|
||||||
return _sys_call2 (SYS_lstat, (long)file_name, (long)statbuf);
|
return _sys_call2 (SYS_lstat, (long) file_name, (long) statbuf);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,5 +21,5 @@
|
||||||
int
|
int
|
||||||
mkdir (char const *file_name, mode_t mode)
|
mkdir (char const *file_name, mode_t mode)
|
||||||
{
|
{
|
||||||
return _sys_call2 (SYS_mkdir, (long)file_name, (long)mode);
|
return _sys_call2 (SYS_mkdir, (long) file_name, (long) mode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,8 +19,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
nanosleep (const struct timespec *requested_time,
|
nanosleep (const struct timespec *requested_time, struct timespec *remaining)
|
||||||
struct timespec *remaining)
|
|
||||||
{
|
{
|
||||||
return _sys_call2 (SYS_nanosleep, (long)requested_time, (long)remaining);
|
return _sys_call2 (SYS_nanosleep, (long) requested_time, (long) remaining);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
int
|
int
|
||||||
_open3 (char const *file_name, int flags, int mask)
|
_open3 (char const *file_name, int flags, int mask)
|
||||||
{
|
{
|
||||||
int r = _sys_call3 (SYS_open, (long)file_name, (int)flags, (int)mask);
|
int r = _sys_call3 (SYS_open, (long) file_name, (int) flags, (int) mask);
|
||||||
__ungetc_init ();
|
__ungetc_init ();
|
||||||
if (r > 2)
|
if (r > 2)
|
||||||
__ungetc_buf[r] = -1;
|
__ungetc_buf[r] = -1;
|
||||||
|
|
|
@ -21,5 +21,5 @@
|
||||||
int
|
int
|
||||||
pipe (int filedes[2])
|
pipe (int filedes[2])
|
||||||
{
|
{
|
||||||
return _sys_call1 (SYS_pipe, (long)filedes);
|
return _sys_call1 (SYS_pipe, (long) filedes);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,17 +21,24 @@
|
||||||
ssize_t
|
ssize_t
|
||||||
read (int filedes, void *buffer, size_t size)
|
read (int filedes, void *buffer, size_t size)
|
||||||
{
|
{
|
||||||
ssize_t bytes = _sys_call3 (SYS_read, (int)filedes, (long)buffer, (long)size);
|
ssize_t bytes = _sys_call3 (SYS_read, (int) filedes, (long) buffer, (long) size);
|
||||||
if (__mes_debug () > 3)
|
if (__mes_debug () > 3)
|
||||||
{
|
{
|
||||||
if (bytes == 1)
|
if (bytes == 1)
|
||||||
{
|
{
|
||||||
eputs ("read fd="); eputs (itoa ((int)filedes)); eputs (" c="); eputc (*(char*)buffer); eputs ("\n");
|
eputs ("read fd=");
|
||||||
|
eputs (itoa ((int) filedes));
|
||||||
|
eputs (" c=");
|
||||||
|
eputc (*(char *) buffer);
|
||||||
|
eputs ("\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
eputs ("read fd="); eputs (itoa ((int)filedes));
|
eputs ("read fd=");
|
||||||
eputs (" bytes="); eputs (itoa (bytes)); eputs ("\n");
|
eputs (itoa ((int) filedes));
|
||||||
|
eputs (" bytes=");
|
||||||
|
eputs (itoa (bytes));
|
||||||
|
eputs ("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return bytes;
|
return bytes;
|
||||||
|
|
|
@ -21,5 +21,5 @@
|
||||||
int
|
int
|
||||||
rename (char const *old_name, char const *new_name)
|
rename (char const *old_name, char const *new_name)
|
||||||
{
|
{
|
||||||
return _sys_call2 (SYS_rename, (long)old_name, (long)new_name);
|
return _sys_call2 (SYS_rename, (long) old_name, (long) new_name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,5 +21,5 @@
|
||||||
int
|
int
|
||||||
rmdir (char const *file_name)
|
rmdir (char const *file_name)
|
||||||
{
|
{
|
||||||
return _sys_call1 (SYS_rmdir, (long)file_name);
|
return _sys_call1 (SYS_rmdir, (long) file_name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,5 +21,5 @@
|
||||||
int
|
int
|
||||||
setgid (gid_t newgid)
|
setgid (gid_t newgid)
|
||||||
{
|
{
|
||||||
return _sys_call1 (SYS_setgid, (long)newgid);
|
return _sys_call1 (SYS_setgid, (long) newgid);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,8 +19,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
setitimer (int which, struct itimerval const *new,
|
setitimer (int which, struct itimerval const *new, struct itimerval *old)
|
||||||
struct itimerval *old)
|
|
||||||
{
|
{
|
||||||
return _sys_call3 (SYS_setitimer, (long)which, (long)new, (long)old);
|
return _sys_call3 (SYS_setitimer, (long) which, (long) new, (long) old);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,5 +21,5 @@
|
||||||
int
|
int
|
||||||
setuid (uid_t newuid)
|
setuid (uid_t newuid)
|
||||||
{
|
{
|
||||||
return _sys_call1 (SYS_setuid, (long)newuid);
|
return _sys_call1 (SYS_setuid, (long) newuid);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,8 +35,8 @@ signal (int signum, sighandler_t action)
|
||||||
#if __i386__
|
#if __i386__
|
||||||
return _sys_call2 (SYS_signal, signum, action);
|
return _sys_call2 (SYS_signal, signum, action);
|
||||||
#else
|
#else
|
||||||
static struct sigaction setup_action = {-1};
|
static struct sigaction setup_action = { -1 };
|
||||||
static struct sigaction old = {0};
|
static struct sigaction old = { 0 };
|
||||||
|
|
||||||
setup_action.sa_handler = action;
|
setup_action.sa_handler = action;
|
||||||
setup_action.sa_restorer = _restorer;
|
setup_action.sa_restorer = _restorer;
|
||||||
|
|
|
@ -19,11 +19,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
sigprocmask (int how, sigset_t const *set, sigset_t *oldset)
|
sigprocmask (int how, sigset_t const *set, sigset_t * oldset)
|
||||||
{
|
{
|
||||||
#if __i386__
|
#if __i386__
|
||||||
return _sys_call3 (SYS_sigprocmask, (long)how, (long)set, (long)oldset);
|
return _sys_call3 (SYS_sigprocmask, (long) how, (long) set, (long) oldset);
|
||||||
#else
|
#else
|
||||||
return _sys_call3 (SYS_rt_sigprocmask, (long)how, (long)set, (long)oldset);
|
return _sys_call3 (SYS_rt_sigprocmask, (long) how, (long) set, (long) oldset);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,5 +21,5 @@
|
||||||
int
|
int
|
||||||
stat (char const *file_name, struct stat *statbuf)
|
stat (char const *file_name, struct stat *statbuf)
|
||||||
{
|
{
|
||||||
return _sys_call2 (SYS_stat, (long)file_name, (long)statbuf);
|
return _sys_call2 (SYS_stat, (long) file_name, (long) statbuf);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
time_t
|
time_t
|
||||||
time (time_t *result)
|
time (time_t * result)
|
||||||
{
|
{
|
||||||
return _sys_call1 (SYS_time, (long)result);
|
return _sys_call1 (SYS_time, (long) result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,5 +21,5 @@
|
||||||
int
|
int
|
||||||
unlink (char const *file_name)
|
unlink (char const *file_name)
|
||||||
{
|
{
|
||||||
return _sys_call1 (SYS_unlink, (long)file_name);
|
return _sys_call1 (SYS_unlink, (long) file_name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,9 +22,9 @@ pid_t
|
||||||
waitpid (pid_t pid, int *status_ptr, int options)
|
waitpid (pid_t pid, int *status_ptr, int options)
|
||||||
{
|
{
|
||||||
#if __i386__
|
#if __i386__
|
||||||
return _sys_call3 (SYS_waitpid, (long)pid, (long)status_ptr, (int)options);
|
return _sys_call3 (SYS_waitpid, (long) pid, (long) status_ptr, (int) options);
|
||||||
#elif __x86_64__
|
#elif __x86_64__
|
||||||
return _sys_call4 (SYS_wait4, (long)pid, (long)status_ptr, (int)options, 0);
|
return _sys_call4 (SYS_wait4, (long) pid, (long) status_ptr, (int) options, 0);
|
||||||
#else
|
#else
|
||||||
#error arch not supported
|
#error arch not supported
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include <mes/lib.h>
|
#include <mes/lib.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
eputs (char const* s)
|
eputs (char const *s)
|
||||||
{
|
{
|
||||||
int i = strlen (s);
|
int i = strlen (s);
|
||||||
write (__stderr, s, i);
|
write (__stderr, s, i);
|
||||||
|
|
|
@ -22,13 +22,13 @@
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
|
|
||||||
int __ungetc_buf[RLIMIT_NOFILE+1] = {0};
|
int __ungetc_buf[RLIMIT_NOFILE + 1] = { 0 };
|
||||||
|
|
||||||
void
|
void
|
||||||
__ungetc_init ()
|
__ungetc_init ()
|
||||||
{
|
{
|
||||||
if (__ungetc_buf[RLIMIT_NOFILE] == 0)
|
if (__ungetc_buf[RLIMIT_NOFILE] == 0)
|
||||||
memset (__ungetc_buf, -1, (RLIMIT_NOFILE+1)*sizeof (int));
|
memset (__ungetc_buf, -1, (RLIMIT_NOFILE + 1) * sizeof (int));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
@ -23,6 +23,6 @@
|
||||||
int
|
int
|
||||||
fdputc (int c, int fd)
|
fdputc (int c, int fd)
|
||||||
{
|
{
|
||||||
write (fd, (char*)&c, 1);
|
write (fd, (char *) &c, 1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include <mes/lib.h>
|
#include <mes/lib.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
fdputs (char const* s, int fd)
|
fdputs (char const *s, int fd)
|
||||||
{
|
{
|
||||||
int i = strlen (s);
|
int i = strlen (s);
|
||||||
write (fd, s, i);
|
write (fd, s, i);
|
||||||
|
|
|
@ -40,10 +40,11 @@ ntoab (long x, int base, int signed_p)
|
||||||
long i = u % base;
|
long i = u % base;
|
||||||
*p-- = i > 9 ? 'a' + i - 10 : '0' + i;
|
*p-- = i > 9 ? 'a' + i - 10 : '0' + i;
|
||||||
u = u / base;
|
u = u / base;
|
||||||
} while (u);
|
}
|
||||||
|
while (u);
|
||||||
|
|
||||||
if (sign && *(p + 1) != '0')
|
if (sign && *(p + 1) != '0')
|
||||||
*p-- = '-';
|
*p-- = '-';
|
||||||
|
|
||||||
return p+1;
|
return p + 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include <mes/lib.h>
|
#include <mes/lib.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
oputs (char const* s)
|
oputs (char const *s)
|
||||||
{
|
{
|
||||||
int i = strlen (s);
|
int i = strlen (s);
|
||||||
write (__stdout, s, i);
|
write (__stdout, s, i);
|
||||||
|
|
|
@ -27,7 +27,9 @@ search_path (char const *file_name)
|
||||||
char *path = getenv ("PATH");
|
char *path = getenv ("PATH");
|
||||||
if (__mes_debug ())
|
if (__mes_debug ())
|
||||||
{
|
{
|
||||||
eputs ("\n search-path: "); eputs (file_name); eputs ("\n");
|
eputs ("\n search-path: ");
|
||||||
|
eputs (file_name);
|
||||||
|
eputs ("\n");
|
||||||
}
|
}
|
||||||
while (*path)
|
while (*path)
|
||||||
{
|
{
|
||||||
|
@ -38,7 +40,9 @@ search_path (char const *file_name)
|
||||||
buf[end - path] = 0;
|
buf[end - path] = 0;
|
||||||
if (__mes_debug ())
|
if (__mes_debug ())
|
||||||
{
|
{
|
||||||
eputs (" dir: "); eputs (buf); eputs ("\n");
|
eputs (" dir: ");
|
||||||
|
eputs (buf);
|
||||||
|
eputs ("\n");
|
||||||
}
|
}
|
||||||
if (buf[end - path] != '/')
|
if (buf[end - path] != '/')
|
||||||
strcat (buf, "/");
|
strcat (buf, "/");
|
||||||
|
@ -47,7 +51,9 @@ search_path (char const *file_name)
|
||||||
{
|
{
|
||||||
if (__mes_debug ())
|
if (__mes_debug ())
|
||||||
{
|
{
|
||||||
eputs (" found: "); eputs (buf); eputs ("\n");
|
eputs (" found: ");
|
||||||
|
eputs (buf);
|
||||||
|
eputs ("\n");
|
||||||
}
|
}
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,9 @@ execl (char const *file_name, char const *arg, ...)
|
||||||
{
|
{
|
||||||
if (__mes_debug () > 2)
|
if (__mes_debug () > 2)
|
||||||
{
|
{
|
||||||
eputs ("execl "); eputs (file_name); eputs ("\n");
|
eputs ("execl ");
|
||||||
|
eputs (file_name);
|
||||||
|
eputs ("\n");
|
||||||
}
|
}
|
||||||
char *argv[1000]; // POSIX minimum 4096
|
char *argv[1000]; // POSIX minimum 4096
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -42,7 +44,11 @@ execl (char const *file_name, char const *arg, ...)
|
||||||
arg = va_arg (ap, char const *);
|
arg = va_arg (ap, char const *);
|
||||||
if (__mes_debug () > 2)
|
if (__mes_debug () > 2)
|
||||||
{
|
{
|
||||||
eputs ("arg["); eputs (itoa (i)); eputs ("]: "); eputs (argv[i-1]); eputs ("\n");
|
eputs ("arg[");
|
||||||
|
eputs (itoa (i));
|
||||||
|
eputs ("]: ");
|
||||||
|
eputs (argv[i - 1]);
|
||||||
|
eputs ("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
argv[i] = 0;
|
argv[i] = 0;
|
||||||
|
|
|
@ -33,11 +33,17 @@ execvp (char const *file_name, char *const argv[])
|
||||||
}
|
}
|
||||||
if (__mes_debug ())
|
if (__mes_debug ())
|
||||||
{
|
{
|
||||||
eputs (" EXEC: "); eputs (file_name); eputs ("\n");
|
eputs (" EXEC: ");
|
||||||
|
eputs (file_name);
|
||||||
|
eputs ("\n");
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (argv[i])
|
while (argv[i])
|
||||||
{
|
{
|
||||||
eputs (" arg["); eputs (itoa (i)); eputs ("]: "); eputs (argv[i]); eputs ("\n");
|
eputs (" arg[");
|
||||||
|
eputs (itoa (i));
|
||||||
|
eputs ("]: ");
|
||||||
|
eputs (argv[i]);
|
||||||
|
eputs ("\n");
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
char *
|
char *
|
||||||
getenv (char const* s)
|
getenv (char const *s)
|
||||||
{
|
{
|
||||||
char **p = environ;
|
char **p = environ;
|
||||||
int length = strlen (s);
|
int length = strlen (s);
|
||||||
|
|
|
@ -58,8 +58,8 @@ static char *nextchar;
|
||||||
for unrecognized options. */
|
for unrecognized options. */
|
||||||
|
|
||||||
int opterr = 1;
|
int opterr = 1;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Handle permutation of arguments. */
|
/* Handle permutation of arguments. */
|
||||||
|
|
||||||
/* Describe the part of ARGV that contains non-options that have
|
/* Describe the part of ARGV that contains non-options that have
|
||||||
|
@ -68,8 +68,8 @@ int opterr = 1;
|
||||||
|
|
||||||
static int first_nonopt;
|
static int first_nonopt;
|
||||||
static int last_nonopt;
|
static int last_nonopt;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Scan elements of ARGV (whose length is ARGC) for option characters
|
/* Scan elements of ARGV (whose length is ARGC) for option characters
|
||||||
given in OPTSTRING.
|
given in OPTSTRING.
|
||||||
|
|
||||||
|
@ -168,13 +168,10 @@ _getopt_internal (int argc, char *const
|
||||||
/* We have found another option-ARGV-element.
|
/* We have found another option-ARGV-element.
|
||||||
Start decoding its characters. */
|
Start decoding its characters. */
|
||||||
|
|
||||||
nextchar = (argv[optind] + 1
|
nextchar = (argv[optind] + 1 + (longopts != NULL && argv[optind][1] == '-'));
|
||||||
+ (longopts != NULL && argv[optind][1] == '-'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (longopts != NULL
|
if (longopts != NULL && ((argv[optind][0] == '-' && (argv[optind][1] == '-' || long_only))))
|
||||||
&& ((argv[optind][0] == '-'
|
|
||||||
&& (argv[optind][1] == '-' || long_only))))
|
|
||||||
{
|
{
|
||||||
const struct option *p;
|
const struct option *p;
|
||||||
char *s = nextchar;
|
char *s = nextchar;
|
||||||
|
@ -187,8 +184,7 @@ _getopt_internal (int argc, char *const
|
||||||
s++;
|
s++;
|
||||||
|
|
||||||
/* Test all options for either exact match or abbreviated matches. */
|
/* Test all options for either exact match or abbreviated matches. */
|
||||||
for (p = longopts, option_index = 0; p->name;
|
for (p = longopts, option_index = 0; p->name; p++, option_index++)
|
||||||
p++, option_index++)
|
|
||||||
if (!strncmp (p->name, nextchar, s - nextchar))
|
if (!strncmp (p->name, nextchar, s - nextchar))
|
||||||
{
|
{
|
||||||
if (s - nextchar == strlen (p->name))
|
if (s - nextchar == strlen (p->name))
|
||||||
|
@ -213,8 +209,7 @@ _getopt_internal (int argc, char *const
|
||||||
if (ambig && !exact)
|
if (ambig && !exact)
|
||||||
{
|
{
|
||||||
if (opterr)
|
if (opterr)
|
||||||
fprintf (stderr, "%s: option `%s' is ambiguous\n",
|
fprintf (stderr, "%s: option `%s' is ambiguous\n", argv[0], argv[optind]);
|
||||||
argv[0], argv[optind]);
|
|
||||||
nextchar += strlen (nextchar);
|
nextchar += strlen (nextchar);
|
||||||
optind++;
|
optind++;
|
||||||
return '?';
|
return '?';
|
||||||
|
@ -237,8 +232,7 @@ _getopt_internal (int argc, char *const
|
||||||
if (argv[optind - 1][1] == '-')
|
if (argv[optind - 1][1] == '-')
|
||||||
/* --option */
|
/* --option */
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
"%s: option `--%s' doesn't allow an argument\n",
|
"%s: option `--%s' doesn't allow an argument\n", argv[0], pfound->name);
|
||||||
argv[0], pfound->name);
|
|
||||||
else
|
else
|
||||||
/* +option or -option */
|
/* +option or -option */
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
|
@ -256,8 +250,7 @@ _getopt_internal (int argc, char *const
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (opterr)
|
if (opterr)
|
||||||
fprintf (stderr, "%s: option `%s' requires an argument\n",
|
fprintf (stderr, "%s: option `%s' requires an argument\n", argv[0], argv[optind - 1]);
|
||||||
argv[0], argv[optind - 1]);
|
|
||||||
nextchar += strlen (nextchar);
|
nextchar += strlen (nextchar);
|
||||||
return '?';
|
return '?';
|
||||||
}
|
}
|
||||||
|
@ -276,19 +269,16 @@ _getopt_internal (int argc, char *const
|
||||||
or the option starts with '--' or is not a valid short
|
or the option starts with '--' or is not a valid short
|
||||||
option, then it's an error.
|
option, then it's an error.
|
||||||
Otherwise interpret it as a short option. */
|
Otherwise interpret it as a short option. */
|
||||||
if (!long_only || argv[optind][1] == '-'
|
if (!long_only || argv[optind][1] == '-' || strchr (optstring, *nextchar) == NULL)
|
||||||
|| strchr (optstring, *nextchar) == NULL)
|
|
||||||
{
|
{
|
||||||
if (opterr)
|
if (opterr)
|
||||||
{
|
{
|
||||||
if (argv[optind][1] == '-')
|
if (argv[optind][1] == '-')
|
||||||
/* --option */
|
/* --option */
|
||||||
fprintf (stderr, "%s: unrecognized option `--%s'\n",
|
fprintf (stderr, "%s: unrecognized option `--%s'\n", argv[0], nextchar);
|
||||||
argv[0], nextchar);
|
|
||||||
else
|
else
|
||||||
/* +option or -option */
|
/* +option or -option */
|
||||||
fprintf (stderr, "%s: unrecognized option `%c%s'\n",
|
fprintf (stderr, "%s: unrecognized option `%c%s'\n", argv[0], argv[optind][0], nextchar);
|
||||||
argv[0], argv[optind][0], nextchar);
|
|
||||||
}
|
}
|
||||||
nextchar += strlen (nextchar);
|
nextchar += strlen (nextchar);
|
||||||
optind++;
|
optind++;
|
||||||
|
@ -311,8 +301,7 @@ _getopt_internal (int argc, char *const
|
||||||
if (opterr)
|
if (opterr)
|
||||||
{
|
{
|
||||||
if (c < 040 || c >= 0177)
|
if (c < 040 || c >= 0177)
|
||||||
fprintf (stderr, "%s: unrecognized option, character code 0%o\n",
|
fprintf (stderr, "%s: unrecognized option, character code 0%o\n", argv[0], c);
|
||||||
argv[0], c);
|
|
||||||
else
|
else
|
||||||
fprintf (stderr, "%s: unrecognized option `-%c'\n", argv[0], c);
|
fprintf (stderr, "%s: unrecognized option `-%c'\n", argv[0], c);
|
||||||
}
|
}
|
||||||
|
@ -345,8 +334,7 @@ _getopt_internal (int argc, char *const
|
||||||
else if (optind == argc)
|
else if (optind == argc)
|
||||||
{
|
{
|
||||||
if (opterr)
|
if (opterr)
|
||||||
fprintf (stderr, "%s: option `-%c' requires an argument\n",
|
fprintf (stderr, "%s: option `-%c' requires an argument\n", argv[0], c);
|
||||||
argv[0], c);
|
|
||||||
c = '?';
|
c = '?';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -363,8 +351,7 @@ _getopt_internal (int argc, char *const
|
||||||
int
|
int
|
||||||
getopt (int argc, char *const *argv, char const *options)
|
getopt (int argc, char *const *argv, char const *options)
|
||||||
{
|
{
|
||||||
return _getopt_internal (argc, argv, options,
|
return _getopt_internal (argc, argv, options, (const struct option *) 0, (int *) 0, 0);
|
||||||
(const struct option *) 0, (int *) 0, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
@ -24,12 +24,12 @@ char *
|
||||||
mktemp (char *template)
|
mktemp (char *template)
|
||||||
{
|
{
|
||||||
char *p = strchr (template, '\0');
|
char *p = strchr (template, '\0');
|
||||||
int q = (long)template;
|
int q = (long) template;
|
||||||
*--p = ((unsigned char)(q >> 4)) % 26 + 'a';
|
*--p = ((unsigned char) (q >> 4)) % 26 + 'a';
|
||||||
*--p = ((unsigned char)(q >> 8)) % 26 + 'a';
|
*--p = ((unsigned char) (q >> 8)) % 26 + 'a';
|
||||||
*--p = ((unsigned char)(q >> 12)) % 26 + 'a';
|
*--p = ((unsigned char) (q >> 12)) % 26 + 'a';
|
||||||
*--p = ((unsigned char)(q >> 16)) % 26 + 'a';
|
*--p = ((unsigned char) (q >> 16)) % 26 + 'a';
|
||||||
*--p = ((unsigned char)(q >> 20)) % 26 + 'a';
|
*--p = ((unsigned char) (q >> 20)) % 26 + 'a';
|
||||||
*--p = ((unsigned char)(q >> 24)) % 26 + 'a';
|
*--p = ((unsigned char) (q >> 24)) % 26 + 'a';
|
||||||
return template;
|
return template;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
setenv (char const* s, char const* v, int overwrite_p)
|
setenv (char const *s, char const *v, int overwrite_p)
|
||||||
{
|
{
|
||||||
char **p = environ;
|
char **p = environ;
|
||||||
int length = strlen (s);
|
int length = strlen (s);
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
void
|
void
|
||||||
clearerr (FILE *stream)
|
clearerr (FILE * stream)
|
||||||
{
|
{
|
||||||
errno = 0;
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,8 +21,8 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
fclose (FILE *stream)
|
fclose (FILE * stream)
|
||||||
{
|
{
|
||||||
int fd = (int)stream;
|
int fd = (int) stream;
|
||||||
return close (fd);
|
return close (fd);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,5 +23,5 @@
|
||||||
FILE *
|
FILE *
|
||||||
fdopen (int fd, char const *mode)
|
fdopen (int fd, char const *mode)
|
||||||
{
|
{
|
||||||
return (FILE*)fd;
|
return (FILE *) fd;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
feof (FILE *stream)
|
feof (FILE * stream)
|
||||||
{
|
{
|
||||||
char c = fgetc (stream);
|
char c = fgetc (stream);
|
||||||
if (c != EOF)
|
if (c != EOF)
|
||||||
|
|
|
@ -21,9 +21,9 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
ferror (FILE *stream)
|
ferror (FILE * stream)
|
||||||
{
|
{
|
||||||
int fd = (int)stream;
|
int fd = (int) stream;
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
return -1;
|
return -1;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
fflush (FILE *stream)
|
fflush (FILE * stream)
|
||||||
{
|
{
|
||||||
fsync ((int)stream);
|
fsync ((int) stream);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
fgetc (FILE *stream)
|
fgetc (FILE * stream)
|
||||||
{
|
{
|
||||||
return fdgetc ((long)stream);
|
return fdgetc ((long) stream);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
char *
|
char *
|
||||||
fgets (char *s, int count, FILE *stream)
|
fgets (char *s, int count, FILE * stream)
|
||||||
{
|
{
|
||||||
return fdgets (s, count, (int)stream);
|
return fdgets (s, count, (int) stream);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
fileno (FILE *stream)
|
fileno (FILE * stream)
|
||||||
{
|
{
|
||||||
return (int)stream;
|
return (int) stream;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,19 +28,21 @@
|
||||||
#define open _open3
|
#define open _open3
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FILE*
|
FILE *
|
||||||
fopen (char const *file_name, char const *opentype)
|
fopen (char const *file_name, char const *opentype)
|
||||||
{
|
{
|
||||||
if (__mes_debug ())
|
if (__mes_debug ())
|
||||||
{
|
{
|
||||||
eputs ("fopen "); eputs (file_name);
|
eputs ("fopen ");
|
||||||
eputs (" "); eputs (opentype); eputs ("\n");
|
eputs (file_name);
|
||||||
|
eputs (" ");
|
||||||
|
eputs (opentype);
|
||||||
|
eputs ("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
int fd;
|
int fd;
|
||||||
int mode = 0600;
|
int mode = 0600;
|
||||||
if ((opentype[0] == 'a' || !strcmp (opentype, "r+"))
|
if ((opentype[0] == 'a' || !strcmp (opentype, "r+")) && !access (file_name, O_RDONLY))
|
||||||
&& !access (file_name, O_RDONLY))
|
|
||||||
{
|
{
|
||||||
int flags = O_RDWR;
|
int flags = O_RDWR;
|
||||||
if (opentype[0] == 'a')
|
if (opentype[0] == 'a')
|
||||||
|
@ -58,7 +60,9 @@ fopen (char const *file_name, char const *opentype)
|
||||||
|
|
||||||
if (__mes_debug ())
|
if (__mes_debug ())
|
||||||
{
|
{
|
||||||
eputs (" => fd="); eputs (itoa (fd)); eputs ("\n");
|
eputs (" => fd=");
|
||||||
|
eputs (itoa (fd));
|
||||||
|
eputs ("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fd)
|
if (!fd)
|
||||||
|
@ -68,7 +72,7 @@ fopen (char const *file_name, char const *opentype)
|
||||||
}
|
}
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
fd = 0;
|
fd = 0;
|
||||||
return (FILE*)fd;
|
return (FILE *) fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef open
|
#undef open
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
fprintf (FILE *stream, char const *format, ...)
|
fprintf (FILE * stream, char const *format, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start (ap, format);
|
va_start (ap, format);
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
fputc (int c, FILE* stream)
|
fputc (int c, FILE * stream)
|
||||||
{
|
{
|
||||||
return fdputc (c, (int)stream);
|
return fdputc (c, (int) stream);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
fputs (char const* s, FILE* stream)
|
fputs (char const *s, FILE * stream)
|
||||||
{
|
{
|
||||||
return fdputs (s, (long)stream);
|
return fdputs (s, (long) stream);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,26 +22,26 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
_fungetc_p (FILE *stream)
|
_fungetc_p (FILE * stream)
|
||||||
{
|
{
|
||||||
return _fdungetc_p ((int)stream);
|
return _fdungetc_p ((int) stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
fread (void *data, size_t size, size_t count, FILE *stream)
|
fread (void *data, size_t size, size_t count, FILE * stream)
|
||||||
{
|
{
|
||||||
if (! size || !count)
|
if (!size || !count)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
size_t todo = size * count;
|
size_t todo = size * count;
|
||||||
char *buf = (char*)data;
|
char *buf = (char *) data;
|
||||||
|
|
||||||
int bytes = 0;
|
int bytes = 0;
|
||||||
while (_fungetc_p (stream) && todo-- && ++bytes)
|
while (_fungetc_p (stream) && todo-- && ++bytes)
|
||||||
*buf++ = fgetc (stream);
|
*buf++ = fgetc (stream);
|
||||||
if (todo)
|
if (todo)
|
||||||
{
|
{
|
||||||
int r = read ((int)stream, buf, todo);
|
int r = read ((int) stream, buf, todo);
|
||||||
if (r < 0 && !bytes)
|
if (r < 0 && !bytes)
|
||||||
bytes = r;
|
bytes = r;
|
||||||
else
|
else
|
||||||
|
@ -50,19 +50,24 @@ fread (void *data, size_t size, size_t count, FILE *stream)
|
||||||
|
|
||||||
if (__mes_debug ())
|
if (__mes_debug ())
|
||||||
{
|
{
|
||||||
eputs ("fread fd="); eputs (itoa ((int)stream));
|
eputs ("fread fd=");
|
||||||
eputs (" bytes="); eputs (itoa (bytes)); eputs ("\n");
|
eputs (itoa ((int) stream));
|
||||||
|
eputs (" bytes=");
|
||||||
|
eputs (itoa (bytes));
|
||||||
|
eputs ("\n");
|
||||||
static char buf[4096];
|
static char buf[4096];
|
||||||
if (bytes > 0 && bytes < sizeof (buf))
|
if (bytes > 0 && bytes < sizeof (buf))
|
||||||
{
|
{
|
||||||
strncpy (buf, data, bytes);
|
strncpy (buf, data, bytes);
|
||||||
buf[bytes] = 0;
|
buf[bytes] = 0;
|
||||||
eputs ("fread buf="); eputs (buf); eputs ("\n");
|
eputs ("fread buf=");
|
||||||
|
eputs (buf);
|
||||||
|
eputs ("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bytes > 0)
|
if (bytes > 0)
|
||||||
return bytes/size;
|
return bytes / size;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
FILE *
|
FILE *
|
||||||
freopen (char const *file_name, char const *opentype, FILE *stream)
|
freopen (char const *file_name, char const *opentype, FILE * stream)
|
||||||
{
|
{
|
||||||
fclose (stream);
|
fclose (stream);
|
||||||
return fopen (file_name, opentype);
|
return fopen (file_name, opentype);
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
FILE *
|
FILE *
|
||||||
freopen (char const *file_name, char const *opentype, FILE *stream)
|
freopen (char const *file_name, char const *opentype, FILE * stream)
|
||||||
{
|
{
|
||||||
fclose (stream);
|
fclose (stream);
|
||||||
return fopen (file_name, opentype);
|
return fopen (file_name, opentype);
|
||||||
|
|
|
@ -22,13 +22,16 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
fseek (FILE *stream, long offset, int whence)
|
fseek (FILE * stream, long offset, int whence)
|
||||||
{
|
{
|
||||||
off_t pos = lseek ((int)stream, offset, whence);
|
off_t pos = lseek ((int) stream, offset, whence);
|
||||||
if (__mes_debug ())
|
if (__mes_debug ())
|
||||||
{
|
{
|
||||||
eputs ("fread fd="); eputs (itoa ((int)stream));
|
eputs ("fread fd=");
|
||||||
eputs (" =>"); eputs (itoa (pos)); eputs ("\n");
|
eputs (itoa ((int) stream));
|
||||||
|
eputs (" =>");
|
||||||
|
eputs (itoa (pos));
|
||||||
|
eputs ("\n");
|
||||||
}
|
}
|
||||||
if (pos >= 0)
|
if (pos >= 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
long
|
long
|
||||||
ftell (FILE *stream)
|
ftell (FILE * stream)
|
||||||
{
|
{
|
||||||
return lseek ((int)stream, 0, SEEK_CUR);
|
return lseek ((int) stream, 0, SEEK_CUR);
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue