move hc_* file functions from shared.c/.h to filehandling.c/.h

This commit is contained in:
Gabriele Gristina
2019-07-13 00:20:41 +02:00
parent f7898da386
commit d0ec5c7b77
4 changed files with 427 additions and 427 deletions

View File

@@ -10,12 +10,31 @@
#include <string.h>
#include <errno.h>
u64 count_lines (HCFILE *fp);
#if defined (__CYGWIN__)
int _wopen (const char *path, int oflag, ...);
#endif
size_t fgetl (HCFILE *fp, char *line_buf);
bool hc_fopen (HCFILE *fp, const char *path, char *mode);
int hc_fscanf (HCFILE *fp, const char *format, void *ptr);
int hc_fprintf (HCFILE *fp, const char *format, ...);
int hc_vfprintf (HCFILE *fp, const char *format, va_list ap);
int hc_fseek (HCFILE *fp, off_t offset, int whence);
void hc_rewind (HCFILE *fp);
off_t hc_ftell (HCFILE *fp);
int hc_fgetc (HCFILE *fp);
int hc_fileno (HCFILE *fp);
int hc_feof (HCFILE *fp);
void hc_fflush (HCFILE *fp);
void hc_fclose (HCFILE *fp);
int hc_fputc (int c, HCFILE *fp);
char *hc_fgets (char *buf, int len, HCFILE *fp);
size_t hc_fwrite (void *ptr, size_t size, size_t nmemb, HCFILE *fp);
size_t hc_fread (void *ptr, size_t size, size_t nmemb, HCFILE *fp);
size_t fgetl (HCFILE *fp, char *line_buf);
u64 count_lines (HCFILE *fp);
size_t in_superchop (char *buf);
size_t superchop_with_length (char *buf, const size_t len);
size_t in_superchop (char *buf);
#endif // _FILEHANDLING_H

View File

@@ -14,7 +14,9 @@
#include <fcntl.h>
#include <ctype.h>
#include <math.h>
#include "zlib.h"
#include "filehandling.h"
#if defined (_WIN)
#include <winsock2.h> // needed for select()
@@ -62,27 +64,6 @@ bool hc_string_is_digit (const char *s);
void hc_string_trim_trailing (char *s);
void hc_string_trim_leading (char *s);
#if defined (__CYGWIN__)
int _wopen(const char *path, int oflag, ...);
#endif
bool hc_fopen (HCFILE *fp, const char *path, char *mode);
int hc_fscanf (HCFILE *fp, const char *format, void *ptr);
int hc_fprintf (HCFILE *fp, const char *format, ...);
int hc_vfprintf (HCFILE *fp, const char *format, va_list ap);
int hc_fseek (HCFILE *fp, off_t offset, int whence);
void hc_rewind (HCFILE *fp);
off_t hc_ftell (HCFILE *fp);
int hc_fgetc (HCFILE *fp);
int hc_fileno (HCFILE *fp);
int hc_feof (HCFILE *fp);
void hc_fflush (HCFILE *fp);
void hc_fclose (HCFILE *fp);
int hc_fputc (int c, HCFILE *fp);
char *hc_fgets (char *buf, int len, HCFILE *fp);
size_t hc_fwrite (void *ptr, size_t size, size_t nmemb, HCFILE *fp);
size_t hc_fread (void *ptr, size_t size, size_t nmemb, HCFILE *fp);
bool hc_same_files (char *file1, char *file2);
u32 hc_strtoul (const char *nptr, char **endptr, int base);