summaryrefslogtreecommitdiff
path: root/pith/util.h
blob: 850022b0794a7bbc32aaea87668b9f4835131c4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
 * $Id: util.h 761 2007-10-23 22:35:18Z hubert@u.washington.edu $
 *
 * ========================================================================
 * Copyright 2013-2022 Eduardo Chappa
 * Copyright 2006 University of Washington
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * ========================================================================
 */

#ifndef PITH_UTIL_INCLUDED
#define PITH_UTIL_INCLUDED


#include "../pith/news.h"


#define plural(n)	((n) == 1 ? "" : "s")


#define	READONLY_FOLDER(S)  ((S) && (S)->rdonly && !IS_NEWS(S))

#define STREAMNAME(S)	(((S) && sp_fldr(S) && sp_fldr(S)[0])        \
			  ? sp_fldr(S)                               \
			  : ((S) && (S)->mailbox && (S)->mailbox[0]) \
			    ? (S)->mailbox                           \
			    : "?")


/*
 * Simple, handy macro to determine if folder name is remote 
 * (on an imap server)
 */
#define	IS_REMOTE(X)	(*(X) == '{' && *((X) + 1) && *((X) + 1) != '}' \
			 && strchr(((X) + 2), '}'))


/* (0,0) is upper left */
typedef struct screen_position {
    int row;
    int col;
} Pos;


#define SCREEN_FUN_NULL ((void (*)(struct pine *)) NULL)


/* exported prototypes */
int           *cpyint(int);

/* currently mandatory to implement stubs */

/* called when we detect a serious program error */
void	  alpine_panic(char *);

/* called when testing to see if panic state is in effect */
int	 panicking(void);

/* logs or prints a message then exits */
void	  exceptional_exit(char *, int);


#endif /* PITH_UTIL_INCLUDED */