#include "client_passwords.h"
#include "citadel_decls.h"
#include "tools.h"
-#include "acconfig.h"
+#include "sysdep.h"
#ifndef HAVE_SNPRINTF
#include "snprintf.h"
#endif
pprintf(" User Name Num L LastCall Calls Posts\n");
pprintf("------------------------- ----- - ---------- ----- -----\n");
- if (listing != NULL) while (strlen(listing) > 0) {
+ if (listing != NULL) while (!IsEmptyStr(listing)) {
extract_token(buf, listing, 0, '\n', sizeof buf);
remove_token(listing, 0, '\n');
}
}
- if (strlen(bbb) == 0) {
+ if (IsEmptyStr(bbb)) {
scr_printf("No room '%s'.\n", towhere);
return;
}
}
safestrncpy(room_name, room->RRname, ROOMNAMELEN);
room_flags = room->RRflags;
- room_flags = room->RRflags2;
+ room_flags2 = room->RRflags2;
from_floor = curr_floor;
curr_floor = room->RRfloor;
newmailcount);
}
color(DIM_WHITE);
- if (strlen(rc_gotmail_cmd) > 0) {
+ if (!IsEmptyStr(rc_gotmail_cmd)) {
system(rc_gotmail_cmd);
}
}
mptr = tmp;
}
}
- if (strlen(targ) > 0) {
+ if (!IsEmptyStr(targ)) {
gf_toroom(ipc, targ, mode);
return;
}
mptr = tmp;
}
}
- if (strlen(targ) > 0) {
+ if (!IsEmptyStr(targ)) {
gf_toroom(ipc, targ, mode);
} else {
scr_printf("There are no rooms on '%s'.\n", &floorlist[tofloor][0]);
scr_printf("Enable color support: "); color(BRIGHT_CYAN); scr_printf("%s\n", (user->flags & US_COLOR)? "Yes" : "No"); color(DIM_WHITE);
}
scr_printf("Be unlisted in userlog: "); color(BRIGHT_CYAN); scr_printf("%s\n", (user->flags & US_UNLISTED)? "Yes" : "No"); color(DIM_WHITE);
- if (strlen(editor_paths[0]) > 0) {
+ if (!IsEmptyStr(editor_paths[0])) {
scr_printf("Always enter messages with the full-screen editor: "); color(BRIGHT_CYAN); scr_printf("%s\n", (user->flags & US_EXTEDIT)? "Yes" : "No"); color(DIM_WHITE);
}
free(user);
char pass2[20];
char buf[SIZ];
- if (strlen(rc_password) > 0) {
+ if (!IsEmptyStr(rc_password)) {
strcpy(pass1, rc_password);
strcpy(pass2, rc_password);
} else {
if (!longlist) {
color(BRIGHT_WHITE);
- pprintf(" User Name Room Idle From host\n");
+ pprintf(" User Name Room ");
+ if (screenwidth >= 80) pprintf(" Idle From host");
+ pprintf("\n");
color(DIM_WHITE);
- pprintf(" ------------------------- -------------------- ---- ------------------------\n");
+ pprintf(" ------------------------- --------------------");
+ if (screenwidth >= 80) pprintf(" ---- ------------------------");
+ pprintf("\n");
}
r = CtdlIPCOnlineUsers(ipc, &listing, &timenow, buf);
listing = SortOnlineUsers(listing);
if (r / 100 == 1) {
- while (strlen(listing) > 0) {
+ while (!IsEmptyStr(listing)) {
int isidle = 0;
/* Get another line */
idlesecs = (idletime - (idlehours * 3600) - (idlemins * 60));
if (idletime > rc_idle_threshold) {
- /*
- while (strlen(roomname) < 20) {
- strcat(roomname, " ");
- }
- strcpy(&roomname[14], "[idle]");
- */
- if (skipidle)
+ if (skipidle) {
isidle = 1;
+ }
}
if (longlist) {
(long) idlemins,
(long) idlesecs);
- if ( (strlen(actual_user)+strlen(actual_room)+strlen(actual_host)) > 0) {
+ if ( (!IsEmptyStr(actual_user)&&
+ !IsEmptyStr(actual_room)&&
+ !IsEmptyStr(actual_host))) {
pprintf("(really ");
- if (strlen(actual_user)>0) pprintf("<%s> ", actual_user);
- if (strlen(actual_room)>0) pprintf("in <%s> ", actual_room);
- if (strlen(actual_host)>0) pprintf("from <%s> ", actual_host);
+ if (!IsEmptyStr(actual_user)) pprintf("<%s> ", actual_user);
+ if (!IsEmptyStr(actual_room)) pprintf("in <%s> ", actual_room);
+ if (!IsEmptyStr(actual_host)) pprintf("from <%s> ", actual_host);
pprintf(")\n");
}
pprintf("\n");
} else {
- if (isidle == 0) {
- if (extract_int(buf, 0) == last_session) {
- pprintf(" ");
- } else {
+ if (isidle == 0) {
+ if (extract_int(buf, 0) == last_session) {
+ pprintf(" ");
+ }
+ else {
+ color(BRIGHT_MAGENTA);
+ pprintf("%-3s", flags);
+ }
+ last_session = extract_int(buf, 0);
+ color(BRIGHT_CYAN);
+ pprintf("%-25s ", username);
color(BRIGHT_MAGENTA);
- pprintf("%-3s", flags);
- }
- last_session = extract_int(buf, 0);
- color(BRIGHT_CYAN);
- pprintf("%-25s ", username);
- color(BRIGHT_MAGENTA);
- roomname[20] = 0;
- pprintf("%-20s ", roomname);
- if (idletime > rc_idle_threshold) {
- /* over 1000d, must be gone fishing */
- if (idlehours > 23999) {
- pprintf("fish");
- /* over 10 days */
- } else if (idlehours > 239) {
- pprintf("%3ldd",
- idlehours / 24);
- /* over 10 hours */
- } else if (idlehours > 9) {
- pprintf("%1ldd%02ld",
- idlehours / 24,
- idlehours % 24);
- /* less than 10 hours */
- } else {
- pprintf("%1ld:%02ld",
- idlehours, idlemins);
+ roomname[20] = 0;
+ pprintf("%-20s", roomname);
+
+ if (screenwidth >= 80) {
+ pprintf(" ");
+ if (idletime > rc_idle_threshold) {
+ /* over 1000d, must be gone fishing */
+ if (idlehours > 23999) {
+ pprintf("fish");
+ /* over 10 days */
+ } else if (idlehours > 239) {
+ pprintf("%3ldd", idlehours / 24);
+ /* over 10 hours */
+ } else if (idlehours > 9) {
+ pprintf("%1ldd%02ld",
+ idlehours / 24,
+ idlehours % 24);
+ /* less than 10 hours */
+ }
+ else {
+ pprintf("%1ld:%02ld", idlehours, idlemins);
+ }
+ }
+ else {
+ pprintf(" ");
+ }
+ pprintf(" ");
+ color(BRIGHT_CYAN);
+ fromhost[24] = '\0';
+ pprintf("%-24s", fromhost);
}
- }
- else {
- pprintf(" ");
- }
- pprintf(" ");
- color(BRIGHT_CYAN);
- fromhost[24] = '\0';
- pprintf("%-24s\n", fromhost);
- color(DIM_WHITE);
- }
+ pprintf("\n");
+ color(DIM_WHITE);
+ }
}
}
}
int home=0;
char relhome[PATH_MAX]="";
char ctdldir[PATH_MAX]=CTDLDIR;
-
+ int lp;
calc_dirs_n_files(relh, home, relhome, ctdldir);
GSTA: /* See if we have a username and password on disk */
if (rc_remember_passwords) {
get_stored_password(hostbuf, portbuf, fullname, password);
- if (strlen(fullname) > 0) {
+ if (!IsEmptyStr(fullname)) {
r = CtdlIPCTryLogin(ipc, fullname, aaa);
if (r / 100 == 3) {
if (*nonce) {
termn8 = 0;
newnow = 0;
do {
- if (strlen(rc_username) > 0) {
+ if (!IsEmptyStr(rc_username)) {
strcpy(fullname, rc_username);
} else {
newprompt("Enter your name: ", fullname, 29);
} while (
(!strcasecmp(fullname, "bbs"))
|| (!strcasecmp(fullname, "new"))
- || (strlen(fullname) == 0));
+ || (IsEmptyStr(fullname)));
if (!strcasecmp(fullname, "off")) {
mcmd = 29;
goto NEWUSR;
/* password authentication */
- if (strlen(rc_password) > 0) {
+ if (!IsEmptyStr(rc_password)) {
strcpy(password, rc_password);
} else {
newprompt("\rPlease enter your password: ", password, -19);
goto PWOK;
}
scr_printf("<< wrong password >>\n");
- if (strlen(rc_password) > 0)
+ if (!IsEmptyStr(rc_password))
logoff(ipc, 2);
goto GSTA;
-NEWUSR: if (strlen(rc_password) == 0) {
+NEWUSR: if (IsEmptyStr(rc_password)) {
scr_printf("'%s' not found.\n", fullname);
scr_printf("Type 'off' if you would like to exit.\n");
if (ipc->ServInfo.newuser_disabled == 1) {
if (b > 1)
scr_printf("*** You have %d new private messages in Mail>\n", b);
color(DIM_WHITE);
- if (strlen(rc_gotmail_cmd) > 0) {
+ if (!IsEmptyStr(rc_gotmail_cmd)) {
system(rc_gotmail_cmd);
}
}
dotgoto(ipc, "_MAIL_", 1, 0);
break;
case 20:
- if (strlen(argbuf) > 0) {
+ if (!IsEmptyStr(argbuf)) {
updatels(ipc);
dotgoto(ipc, argbuf, 0, 0);
}
break;
case 52:
- if (strlen(argbuf) > 0) {
+ if (!IsEmptyStr(argbuf)) {
if (rc_alt_semantics) {
updatelsa(ipc);
}
formout(ipc, "goodbye");
logoff(ipc, 0);
}
+ /* Free the ungoto list */
+ for (lp = 0; lp < uglistsize; lp++) {
+ free(uglist[lp]);
+ }
+ uglistsize = 0;
goto GSTA;
} /* end main() */