improved error number handling.
handled a broken pipe condition from an anonymous pipe in awk
This commit is contained in:
@ -34,19 +34,20 @@ typedef struct qse_dir_ent_t qse_dir_ent_t;
|
||||
|
||||
enum qse_dir_errnum_t
|
||||
{
|
||||
QSE_DIR_ENOERR = 0, /**< no error */
|
||||
QSE_DIR_EOTHER, /**< other error */
|
||||
QSE_DIR_ENOIMPL, /**< not implemented */
|
||||
QSE_DIR_ESYSERR, /**< subsystem(system call) error */
|
||||
QSE_DIR_EINTERN, /**< internal error */
|
||||
QSE_DIR_ENOERR = 0, /**< no error */
|
||||
QSE_DIR_EOTHER, /**< other error */
|
||||
QSE_DIR_ENOIMPL, /**< not implemented */
|
||||
QSE_DIR_ESYSERR, /**< subsystem(system call) error */
|
||||
QSE_DIR_EINTERN, /**< internal error */
|
||||
|
||||
QSE_DIR_ENOMEM, /**< out of memory */
|
||||
QSE_DIR_EINVAL, /**< invalid parameter */
|
||||
QSE_DIR_EACCES, /**< access denied */
|
||||
QSE_DIR_ENOENT, /**< no such file */
|
||||
QSE_DIR_EEXIST, /**< already exist */
|
||||
QSE_DIR_EINTR, /**< interrupted */
|
||||
QSE_DIR_EPIPE /**< broken pipe */
|
||||
QSE_DIR_ENOMEM, /**< out of memory */
|
||||
QSE_DIR_EINVAL, /**< invalid parameter */
|
||||
QSE_DIR_EACCES, /**< access denied */
|
||||
QSE_DIR_ENOENT, /**< no such file */
|
||||
QSE_DIR_EEXIST, /**< already exist */
|
||||
QSE_DIR_EINTR, /**< interrupted */
|
||||
QSE_DIR_EPIPE, /**< broken pipe */
|
||||
QSE_DIR_EAGAIN /**< resource not available temporarily */
|
||||
};
|
||||
typedef enum qse_dir_errnum_t qse_dir_errnum_t;
|
||||
|
||||
|
@ -85,6 +85,7 @@ enum qse_fio_errnum_t
|
||||
QSE_FIO_EEXIST, /**< already exist */
|
||||
QSE_FIO_EINTR, /**< interrupted */
|
||||
QSE_FIO_EPIPE, /**< broken pipe */
|
||||
QSE_FIO_EAGAIN /**< resource not available temporarily */
|
||||
};
|
||||
typedef enum qse_fio_errnum_t qse_fio_errnum_t;
|
||||
|
||||
|
@ -45,7 +45,9 @@ enum qse_mux_errnum_t
|
||||
QSE_MUX_EACCES, /**< access denied */
|
||||
QSE_MUX_ENOENT, /**< no such file */
|
||||
QSE_MUX_EEXIST, /**< already exist */
|
||||
QSE_MUX_EINTR /**< interrupted */
|
||||
QSE_MUX_EINTR, /**< interrupted */
|
||||
QSE_MUX_EPIPE, /**< broken pipe */
|
||||
QSE_MUX_EAGAIN, /**< resource not available temporarily */
|
||||
};
|
||||
typedef enum qse_mux_errnum_t qse_mux_errnum_t;
|
||||
|
||||
|
@ -124,6 +124,8 @@ enum qse_pio_errnum_t
|
||||
QSE_PIO_EEXIST, /**< already exist */
|
||||
QSE_PIO_EINTR, /**< interrupted */
|
||||
QSE_PIO_EPIPE, /**< broken pipe */
|
||||
QSE_PIO_EAGAIN, /**< resource not available temporarily */
|
||||
|
||||
QSE_PIO_ENOHND, /**< no handle available */
|
||||
QSE_PIO_ECHILD, /**< the child is not valid */
|
||||
QSE_PIO_EILSEQ, /**< illegal sequence */
|
||||
|
@ -73,6 +73,9 @@ enum qse_sio_errnum_t
|
||||
QSE_SIO_ENOENT, /**< no such file */
|
||||
QSE_SIO_EEXIST, /**< already exist */
|
||||
QSE_SIO_EINTR, /**< interrupted */
|
||||
QSE_SIO_EPIPE, /**< broken pipe */
|
||||
QSE_SIO_EAGAIN, /**< resource not available temporarily */
|
||||
|
||||
QSE_SIO_EILSEQ, /**< illegal sequence */
|
||||
QSE_SIO_EICSEQ, /**< incomplete sequence */
|
||||
QSE_SIO_EILCHR /**< illegal character */
|
||||
|
@ -28,32 +28,13 @@
|
||||
#include <qse/types.h>
|
||||
#include <qse/macros.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#if defined(_WIN32) && !defined(__WATCOMC__)
|
||||
#include <tchar.h>
|
||||
#define qse_fgets(x,y,s) _fgetts(x,y,s)
|
||||
#define qse_fgetc(x) _fgettc(x)
|
||||
#define qse_fputs(x,s) _fputts(x,s)
|
||||
#define qse_fputc(x,s) _fputtc(x,s)
|
||||
#elif defined(QSE_CHAR_IS_MCHAR)
|
||||
#define qse_fgets(x,y,s) fgets(x,y,s)
|
||||
#define qse_fgetc(x) fgetc(x)
|
||||
#define qse_fputs(x,s) fputs(x,s)
|
||||
#define qse_fputc(x,s) fputc(x,s)
|
||||
#else
|
||||
#define qse_fgets(x,y,s) fgetws(x,y,s)
|
||||
#define qse_fgetc(x) fgetwc(x)
|
||||
#define qse_fputs(x,s) fputws(x,s)
|
||||
#define qse_fputc(x,s) fputwc(x,s)
|
||||
#endif
|
||||
typedef struct QSE_FILE QSE_FILE;
|
||||
|
||||
#define QSE_FILE FILE
|
||||
#define QSE_STDIN stdin
|
||||
#define QSE_STDOUT stdout
|
||||
#define QSE_STDERR stderr
|
||||
#define QSE_STDIN ((QSE_FILE*)1)
|
||||
#define QSE_STDOUT ((QSE_FILE*)2)
|
||||
#define QSE_STDERR ((QSE_FILE*)3)
|
||||
|
||||
typedef int (*qse_getdelim_t) (const qse_char_t* ptr,qse_size_t len,void* arg);
|
||||
|
||||
@ -89,11 +70,11 @@ QSE_EXPORT int qse_dprintf (
|
||||
QSE_EXPORT QSE_FILE* qse_fopen (
|
||||
const qse_char_t* path, const qse_char_t* mode);
|
||||
|
||||
QSE_EXPORT void qse_fclose (QSE_FILE* fp);
|
||||
QSE_EXPORT int qse_fflush (QSE_FILE* fp);
|
||||
QSE_EXPORT void qse_clearerr (QSE_FILE* fp);
|
||||
QSE_EXPORT int qse_feof (QSE_FILE* fp);
|
||||
QSE_EXPORT int qse_ferror (QSE_FILE* fp);
|
||||
QSE_EXPORT void qse_fclose (QSE_FILE* stream);
|
||||
QSE_EXPORT int qse_fflush (QSE_FILE* stream);
|
||||
QSE_EXPORT void qse_clearerr (QSE_FILE* stream);
|
||||
QSE_EXPORT int qse_feof (QSE_FILE* stream);
|
||||
QSE_EXPORT int qse_ferror (QSE_FILE* stream);
|
||||
|
||||
/**
|
||||
* The qse_getline() function read a line from a file pointer @a fp
|
||||
@ -101,7 +82,8 @@ QSE_EXPORT int qse_ferror (QSE_FILE* fp);
|
||||
*
|
||||
* @return -2 on error, -1 on eof, length of data read on success
|
||||
*/
|
||||
QSE_EXPORT qse_ssize_t qse_getline (qse_char_t **buf, qse_size_t *n, QSE_FILE *fp);
|
||||
QSE_EXPORT qse_ssize_t qse_getline (
|
||||
qse_char_t **buf, qse_size_t *n, QSE_FILE *stream);
|
||||
|
||||
/**
|
||||
* The qse_getdelim() function reads characters from a file pointer @a fp
|
||||
@ -112,7 +94,7 @@ QSE_EXPORT qse_ssize_t qse_getline (qse_char_t **buf, qse_size_t *n, QSE_FILE *f
|
||||
*/
|
||||
QSE_EXPORT qse_ssize_t qse_getdelim (
|
||||
qse_char_t **buf, qse_size_t *n,
|
||||
qse_getdelim_t fn, void* fnarg, QSE_FILE *fp);
|
||||
qse_getdelim_t fn, void* fnarg, QSE_FILE* stream);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -46,9 +46,10 @@ enum qse_httpd_errnum_t
|
||||
QSE_HTTPD_ENOENT,
|
||||
QSE_HTTPD_EEXIST,
|
||||
QSE_HTTPD_EINTR,
|
||||
QSE_HTTPD_EPIPE,
|
||||
QSE_HTTPD_EAGAIN,
|
||||
QSE_HTTPD_ENOBUF,
|
||||
|
||||
QSE_HTTPD_ENOBUF, /* no buffer available */
|
||||
QSE_HTTPD_EDISCON, /* client disconnnected */
|
||||
QSE_HTTPD_EBADREQ, /* bad request */
|
||||
QSE_HTTPD_ETASK
|
||||
|
Reference in New Issue
Block a user