Logo Search packages:      
Sourcecode: jupp version File versions  Download package


/* $MirOS: contrib/code/jupp/utils.h,v 1.3 2008/05/13 13:08:31 tg Exp $ */
 *    Various utilities
 *    Copyright
 *          (C) 1992 Joseph H. Allen
 *          (C) 2001 Marek 'Marx' Grac
 *    This file is part of JOE (Joe's Own Editor)
#ifndef _JOE_UTILS_H
#define _JOE_UTILS_H 1

#include "config.h"

#include <sys/types.h>              /* we need size_t, ssize_t */
#include <signal.h>

 * Functions which return minimum/maximum of two numbers  
unsigned int uns_min PARAMS((unsigned int a, unsigned int b));
signed int int_min PARAMS((signed int a, int signed b));
signed long long_max PARAMS((signed long a, signed long b));
signed long long_min PARAMS((signed long a, signed long b));

/* Versions of 'read' and 'write' which automatically retry when interrupted */
ssize_t joe_read PARAMS((int fd, void *buf, size_t siz));
ssize_t joe_write PARAMS((int fd, void *buf, size_t siz));

/* wrappers to *alloc routines */
void *joe_malloc PARAMS((size_t size));
void *joe_calloc PARAMS((size_t nmemb, size_t size));
void *joe_realloc PARAMS((void *ptr, size_t size));
void joe_free PARAMS((void *ptr));

typedef RETSIGTYPE (*sighandler_t)(int);

#define REINSTALL_SIGHANDLER(sig, handler) joe_set_signal(sig, handler)
#define REINSTALL_SIGHANDLER(sig, handler) do {} while(0)

/* wrapper to hide signal interface differrencies */
int joe_set_signal PARAMS((int signum, sighandler_t handler));

int parse_ws PARAMS((unsigned char **p,int cmt));
int parse_ident PARAMS((unsigned char **p,unsigned char *buf,int len));
int parse_kw PARAMS((unsigned char **p,unsigned char *kw));
int parse_tows PARAMS((unsigned char **p,unsigned char *buf));
int parse_field PARAMS((unsigned char **p,unsigned char *field));
int parse_char PARAMS((unsigned char  **p,unsigned char c));
int parse_int PARAMS((unsigned char **p,int *buf));
int parse_string PARAMS((unsigned char **p,unsigned char *buf,int len));
int parse_range PARAMS((unsigned char **p,int *first,int *second));

void tty_xonoffbaudrst(void);


Generated by  Doxygen 1.6.0   Back to index