#include <signal.h>
#include <errno.h>
#include <stdarg.h>
+#include <libcitadel.h>
#include "citadel.h"
#include "citadel_ipc.h"
#include "commands.h"
#include "citadel_decls.h"
#include "routines.h"
#include "routines2.h"
-#include "tools.h"
#include "rooms.h"
#include "client_chat.h"
#include "citadel_dirs.h"
#include "snprintf.h"
#endif
#include "screen.h"
+#include "ecrash.h"
struct citcmd {
struct citcmd *next;
int rc_prompt_control = 0;
time_t rc_idle_threshold = (time_t)900;
char rc_url_cmd[SIZ];
+char rc_open_cmd[SIZ];
char rc_gotmail_cmd[SIZ];
char *gl_string;
vsnprintf(buf, sizeof(buf), format, arg_ptr);
va_end(arg_ptr);
- for (i=0; i<strlen(buf); ++i) {
+ for (i=0; !IsEmptyStr(&buf[i]); ++i) {
scr_putc(buf[i]);
if (buf[i]==10) {
++lines_printed;
static void *ka_thread(void *arg)
{
+#ifdef HAVE_BACKTRACE
+ char threadName[256];
+
+ // Set up our name
+ sprintf(threadName, "ka_Thread n");
+
+ // Register for tracing
+ eCrash_RegisterThread(threadName, 0);
+#endif
really_do_keepalive();
pthread_detach(ka_thr_handle);
ka_thr_active = 0;
+
+#ifdef HAVE_BACKTRACE
+ eCrash_UnregisterThread();
+#endif
return NULL;
}
scr_printf("%s", str);
}
else {
- for (i=0; i<strlen(str); ++i) {
+ for (i=0; !IsEmptyStr(&str[i]); ++i) {
scr_printf("*");
}
}
snprintf(buf, sizeof buf, "%d", i);
strprompt(prompt, buf, 15);
i = atoi(buf);
- for (p=0; p<strlen(buf); ++p) {
+ for (p=0; !IsEmptyStr(&buf[p]); ++p) {
if ( (!isdigit(buf[p]))
&& ( (buf[p]!='-') || (p!=0) ) )
i = imin - 1;
rc_ansi_color = 0;
rc_color_use_bg = 0;
strcpy(rc_url_cmd, "");
+ strcpy(rc_open_cmd, "");
strcpy(rc_gotmail_cmd, "");
#ifdef HAVE_OPENSSL
rc_encrypt = RC_DEFAULT;
if (!strncasecmp(buf, "urlcmd=", 7))
strcpy(rc_url_cmd, &buf[7]);
+ if (!strncasecmp(buf, "opencmd=", 7))
+ strcpy(rc_open_cmd, &buf[8]);
+
if (!strncasecmp(buf, "gotmailcmd=", 11))
strcpy(rc_gotmail_cmd, &buf[11]);
{
int a;
- for (a = 0; a < strlen(cmdstr); ++a)
+ for (a = 0; !IsEmptyStr(&cmdstr[a]); ++a)
if (cmdstr[a] == '&')
return (tolower(cmdstr[a + 1]));
return (0);
strcpy(exp, strbuf);
- for (a = 0; a < strlen(exp); ++a) {
+ for (a = 0; exp[a]; ++a) {
if (strbuf[a] == '&') {
/* dont echo these non mnemonic command keys */
char buf[64];
strcpy(buf, cptr->c_keys[ncomp - 1]);
- for (a = 0; a < strlen(buf); ++a) {
+ for (a = 0; !IsEmptyStr(&buf[a]); ++a) {
if (buf[a] == ':')
return (1);
}
}
} while (FD_ISSET(0, &rfds));
- for (a = 0; a < strlen(abuf); ++a) {
+ for (a = 0; !IsEmptyStr(&abuf[a]); ++a) {
if ((abuf[a] == 27) && (abuf[a + 1] == '[')
&& (abuf[a + 2] == '?')) {
enable_color = 1;
int i;
color(DIM_WHITE);
- for (i=0; i<strlen(buf); ++i) {
+ for (i=0; !IsEmptyStr(&buf[i]); ++i) {
if (buf[i]=='<') {
pprintf("%c", buf[i]);
color(BRIGHT_MAGENTA);
choices = num_tokens(menustring, '|');
if (menuprompt != NULL) do_prompt = 1;
- if (menuprompt != NULL) if (strlen(menuprompt)==0) do_prompt = 0;
+ if ((menuprompt != NULL) && (IsEmptyStr(menuprompt))) do_prompt = 0;
while (1) {
if (display_prompt) {
for (i=0; i<choices; ++i) {
extract_token(buf, menustring, i, '|', sizeof buf);
- for (c=1; c<strlen(buf); ++c) {
+ for (c=1; !IsEmptyStr(&buf[c]); ++c) {
if ( (ch == tolower(buf[c]))
&& (buf[c-1]=='<')
&& (buf[c+1]=='>') ) {
- for (a=0; a<strlen(buf); ++a) {
+ for (a=0; !IsEmptyStr(&buf[a]); ++a) {
if ( (a!=(c-1)) && (a!=(c+1))) {
scr_putc(buf[a]);
}