-/*
- * More client-side support functions.
- *
- * Copyright (c) 1987-2017 by the citadel.org team
- *
- * This program is open source software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
+// More client-side support functions.
+//
+// Copyright (c) 1987-2017 by the citadel.org team
+//
+// This program is open source software. Use, duplication, and/or
+// disclosure is subject to the GNU General Purpose License version 3.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
#include "textclient.h"
-/* work around solaris include files */
+// work around solaris include files
#ifdef reg
#undef reg
#endif
extern int screenwidth;
-/*
- * return proper room prompt character
- */
-int room_prompt(unsigned int qrflags)
-{
+// return proper room prompt character
+int room_prompt(unsigned int qrflags) {
int a;
a = '>';
- if (qrflags & QR_DIRECTORY)
+ if (qrflags & QR_DIRECTORY) {
a = ']';
+ }
return (a);
}
-/*
- * Register with name and address
- */
-void entregis(CtdlIPC * ipc)
-{
+// Register with name and address
+void entregis(CtdlIPC * ipc) {
char buf[SIZ];
char tmpname[30];
remove_token(reg, 0, '\n');
if (a == 2)
- safestrncpy(tmpname, buf, sizeof tmpname);
+ strncpy(tmpname, buf, sizeof tmpname);
else if (a == 3)
- safestrncpy(tmpaddr, buf, sizeof tmpaddr);
+ strncpy(tmpaddr, buf, sizeof tmpaddr);
else if (a == 4)
- safestrncpy(tmpcity, buf, sizeof tmpcity);
+ strncpy(tmpcity, buf, sizeof tmpcity);
else if (a == 5)
- safestrncpy(tmpstate, buf, sizeof tmpstate);
+ strncpy(tmpstate, buf, sizeof tmpstate);
else if (a == 6)
- safestrncpy(tmpzip, buf, sizeof tmpzip);
+ strncpy(tmpzip, buf, sizeof tmpzip);
else if (a == 7)
- safestrncpy(tmpphone, buf, sizeof tmpphone);
+ strncpy(tmpphone, buf, sizeof tmpphone);
else if (a == 9)
- safestrncpy(tmpemail, buf, sizeof tmpemail);
+ strncpy(tmpemail, buf, sizeof tmpemail);
else if (a == 10)
- safestrncpy(tmpcountry, buf, sizeof tmpcountry);
+ strncpy(tmpcountry, buf, sizeof tmpcountry);
++a;
}
}
do {
ok = 1;
- safestrncpy(holdemail, tmpemail, sizeof holdemail);
+ strncpy(holdemail, tmpemail, sizeof holdemail);
strprompt("Email address", tmpemail, 31);
r = CtdlIPCDirectoryLookup(ipc, tmpemail, buf);
if (r / 100 == 2) {
extract_token(diruser, buf, 0, '@', sizeof diruser);
extract_token(dirnode, buf, 1, '@', sizeof dirnode);
- striplt(diruser);
- striplt(dirnode);
+ string_trim(diruser);
+ string_trim(dirnode);
if ((strcasecmp(diruser, fullname))
|| (strcasecmp(dirnode, ipc->ServInfo.nodename))) {
scr_printf("\nYou can't use %s as your address.\n", tmpemail);
scr_printf("It is already in use by %s @ %s.\n", diruser, dirnode);
ok = 0;
- safestrncpy(tmpemail, holdemail, sizeof tmpemail);
+ strncpy(tmpemail, holdemail, sizeof tmpemail);
}
}
} while (ok == 0);
/*
* make all messages old in current room
*/
-void updatels(CtdlIPC * ipc)
-{
+void updatels(CtdlIPC * ipc) {
char buf[256];
int r; /* IPC response code */
/*
* only make messages old in this room that have been read
*/
-void updatelsa(CtdlIPC * ipc)
-{
+void updatelsa(CtdlIPC * ipc) {
char buf[256];
int r; /* IPC response code */
/*
* client-based uploads (for users with their own clientware)
*/
-void cli_upload(CtdlIPC * ipc)
-{
+void cli_upload(CtdlIPC * ipc) {
char flnm[PATH_MAX];
char desc[151];
char buf[256];
/*
* Function used for various image upload commands
*/
-void cli_image_upload(CtdlIPC * ipc, char *keyname)
-{
+void cli_image_upload(CtdlIPC * ipc, char *keyname) {
char flnm[PATH_MAX];
char buf[256];
int r;
r = CtdlIPCImageUpload(ipc, 1, flnm, keyname, progress, buf);
if (r / 100 == 5) {
scr_printf("%s\n", buf);
- } else if (r < 0) {
+ }
+ else if (r < 0) {
scr_printf("Cannot upload '%s': %s\n", flnm, strerror(errno));
}
/* else upload succeeded */
/*
* protocol-based uploads (Xmodem, Ymodem, Zmodem)
*/
-void upload(CtdlIPC * ipc, int c)
-{ /* c = upload mode */
+void upload(CtdlIPC * ipc, int c) { /* c = upload mode */
char flnm[PATH_MAX];
char desc[151];
char buf[256];
execlp("rz", "rz", NULL);
exit(1);
}
- } else
+ }
+ else
do {
b = ka_wait(&a);
} while ((b != xfer_pid) && (b != (-1)));
nukedir(tempdir);
}
+
/*
* validate a user (returns 0 for successful validation, nonzero if quitting)
*/
-int val_user(CtdlIPC * ipc, char *user, int do_validate)
-{
+int val_user(CtdlIPC * ipc, char *user, int do_validate) {
int a;
char cmd[256];
char buf[256];
* Webcit limits to 6 as does the code here but there are 7 in axdefs.h
*/
scr_printf("Current access level: %d (%s)\n", ax, axdefs[ax]);
- } else {
+ }
+ else {
scr_printf("%s\n%s\n", user, &cmd[4]);
}
if (resp)
/*
* Validate new users
*/
-void validate(CtdlIPC * ipc)
-{
+void validate(CtdlIPC * ipc) {
char cmd[256];
char buf[256];
int finished = 0;
} while (finished == 0);
}
-void subshell(void)
-{
+
+void subshell(void) {
int a, b;
stty_ctdl(SB_RESTORE);
/*
* <.A>ide <F>ile <D>elete command
*/
-void deletefile(CtdlIPC * ipc)
-{
+void deletefile(CtdlIPC * ipc) {
char filename[32];
char buf[256];
/*
* <.A>ide <F>ile <M>ove command
*/
-void movefile(CtdlIPC * ipc)
-{
+void movefile(CtdlIPC * ipc) {
char filename[64];
char newroom[ROOMNAMELEN];
char buf[256];
/*
* list of users who have filled out a bio
*/
-void list_bio(CtdlIPC * ipc)
-{
+void list_bio(CtdlIPC * ipc) {
char buf[256];
char *resp = NULL;
int pos = 1;
}
-/*
- * read bio
- */
-void read_bio(CtdlIPC * ipc)
-{
+// read bio
+void read_bio(CtdlIPC * ipc) {
char who[256];
char buf[256];
char *resp = NULL;