* Do not define _BSD_SOURCE but define _DEFAULT_SOURCE instead.
[alpine.git] / pith / util.h
blob701ed061d62b625abf46847448bd0e5aa1b5a3c8
1 /*
2 * $Id: util.h 761 2007-10-23 22:35:18Z hubert@u.washington.edu $
4 * ========================================================================
5 * Copyright 2006 University of Washington
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * ========================================================================
16 #ifndef PITH_UTIL_INCLUDED
17 #define PITH_UTIL_INCLUDED
20 #include "../pith/news.h"
23 #define plural(n) ((n) == 1 ? "" : "s")
26 #define READONLY_FOLDER(S) ((S) && (S)->rdonly && !IS_NEWS(S))
28 #define STREAMNAME(S) (((S) && sp_fldr(S) && sp_fldr(S)[0]) \
29 ? sp_fldr(S) \
30 : ((S) && (S)->mailbox && (S)->mailbox[0]) \
31 ? (S)->mailbox \
32 : "?")
36 * Simple, handy macro to determine if folder name is remote
37 * (on an imap server)
39 #define IS_REMOTE(X) (*(X) == '{' && *((X) + 1) && *((X) + 1) != '}' \
40 && strchr(((X) + 2), '}'))
43 /* (0,0) is upper left */
44 typedef struct screen_position {
45 int row;
46 int col;
47 } Pos;
50 #define SCREEN_FUN_NULL ((void (*)(struct pine *)) NULL)
53 /* exported protoypes */
54 int *cpyint(int);
56 /* currently mandatory to implement stubs */
58 /* called when we detect a serious program error */
59 void alpine_panic(char *);
61 /* called when testing to see if panic state is in effect */
62 int panicking(void);
64 /* logs or prints a message then exits */
65 void exceptional_exit(char *, int);
68 #endif /* PITH_UTIL_INCLUDED */