/* * error return values * all the queue manipulation functions return these; * you can interpret them yourself, or print the error * message in qe_errbuf, which describes these codes */ #define QE_ISERROR(x) ((x) < 0) /* true if x is a qlib error code */ #define QE_NONE 0 /* no errors */ #define QE_BADTICKET -3 /* bad ticket for the queue */ #define QE_EMPTY -4 /* take it off an empty queue */ #define QE_TOOFULL -5 /* append it to a full queue */ #define QE_NOROOM -6 /* can't allocate space (sys err) */ #define QE_TOOMANYQS -7 /* too many queues in use (max 100) */ #define QE_INTINCON -8 /* internal inconsistency */ /* * the error buffer; contains a message describing the last queue * error (but is NUL if no error encountered); not cleared on success */ extern char qe_errbuf[256]; typedef long int QTICKET; /* macros to fill qe_errbuf */ #define ERRBUF(str) (void) strncpy(qe_errbuf, str,sizeof(qe_errbuf)) #define ERRBUF2(str,n) (void) sprintf(qe_errbuf, str, n) #define ERRBUF3(str,n,m) (void) sprintf(qe_errbuf, str, n, m) QTICKET create_queue(void); /* create a queue */ int delete_queue(QTICKET); /* delete a queue */ int put_on_queue(QTICKET, int); /* put number on end of queue */ int take_off_queue(QTICKET); /* pull number off front of queue */ extern char qe_errbuf[256];