-/* $Id$
- *
+/*
* More client-side support functions.
* Unlike routines.c, some of these DO use global variables.
- *
*/
#include <stdlib.h>
int ret;
ret = open(name, mode);
if (ret < 0) {
- err_printf("Cannot open file '%s', mode=%d, errno=%d\n",
+ scr_printf("Cannot open file '%s', mode=%d, errno=%d\n",
name, mode, errno);
interr(errno);
}
/* Can we upload this image? */
r = CtdlIPCImageUpload(ipc, 0, NULL, keyname, NULL, buf);
if (r / 100 != 2) {
- err_printf("%s\n", buf);
+ scr_printf("%s\n", buf);
return;
}
newprompt("Image file to be uploaded: ", flnm, 55);
r = CtdlIPCImageUpload(ipc, 1, flnm, keyname, progress, buf);
if (r / 100 == 5) {
- err_printf("%s\n", buf);
+ scr_printf("%s\n", buf);
} else if (r < 0) {
- err_printf("Cannot upload '%s': %s\n", flnm, strerror(errno));
+ scr_printf("Cannot upload '%s': %s\n", flnm, strerror(errno));
}
/* else upload succeeded */
}
int xfer_pid;
int a, b;
FILE *fp, *lsfp;
- int r;
int rv;
if ((room_flags & QR_UPLOAD) == 0) {
xfer_pid = fork();
if (xfer_pid == 0) {
rv = chdir(tempdir);
+ if (rv < 0) {
+ scr_printf("failed to change into %s Reason %s\nAborting now.\n",
+ tempdir,
+ strerror(errno));
+ nukedir(tempdir);
+ return;
+ }
switch (c) {
case 0:
stty_ctdl(0);
fclose(fp);
exit(0);
case 1:
- screen_reset();
stty_ctdl(3);
execlp("rx", "rx", flnm, NULL);
exit(1);
case 2:
- screen_reset();
stty_ctdl(3);
execlp("rb", "rb", NULL);
exit(1);
case 3:
- screen_reset();
stty_ctdl(3);
execlp("rz", "rz", NULL);
exit(1);
b = ka_wait(&a);
} while ((b != xfer_pid) && (b != (-1)));
stty_ctdl(0);
- screen_set();
if (a != 0) {
scr_printf("\r*** Transfer unsuccessful.\n");
flnm);
newprompt(buf, desc, 150);
snprintf(buf, sizeof buf, "%s/%s", tempdir, flnm);
- r = CtdlIPCFileUpload(ipc, flnm, desc, buf, progress, tbuf);
+ CtdlIPCFileUpload(ipc, flnm, desc, buf, progress, tbuf);
scr_printf("%s\n", tbuf);
}
pclose(lsfp);
{
int a, b;
- screen_reset();
stty_ctdl(SB_RESTORE);
a = fork();
if (a == 0) {
signal(SIGINT, SIG_DFL);
signal(SIGQUIT, SIG_DFL);
execlp(getenv("SHELL"), getenv("SHELL"), NULL);
- err_printf("Could not open a shell: %s\n", strerror(errno));
+ scr_printf("Could not open a shell: %s\n", strerror(errno));
exit(errno);
}
do {
b = ka_wait(NULL);
} while ((a != b) && (a != (-1)));
stty_ctdl(0);
- screen_set();
}
/*
if (IsEmptyStr(filename))
return;
CtdlIPCDeleteFile(ipc, filename, buf);
- err_printf("%s\n", buf);
+ scr_printf("%s\n", buf);
}
return;
newprompt("Enter target room: ", newroom, ROOMNAMELEN - 1);
CtdlIPCMoveFile(ipc, filename, newroom, buf);
- err_printf("%s\n", buf);
+ scr_printf("%s\n", buf);
}
r = CtdlIPCListUsersWithBios(ipc, &resp, buf);
if (r / 100 != 1) {
- pprintf("%s\n", buf);
+ scr_printf("%s\n", buf);
return;
}
while (resp && !IsEmptyStr(resp)) {
extract_token(buf, resp, 0, '\n', sizeof buf);
remove_token(resp, 0, '\n');
if ((pos + strlen(buf) + 5) > screenwidth) {
- pprintf("\n");
+ scr_printf("\n");
pos = 1;
}
- pprintf("%s, ", buf);
+ scr_printf("%s, ", buf);
pos = pos + strlen(buf) + 2;
}
- pprintf("%c%c \n\n", 8, 8);
+ scr_printf("%c%c \n\n", 8, 8);
if (resp) free(resp);
}
do {
newprompt("Read bio for who ('?' for list) : ", who, 25);
- pprintf("\n");
+ scr_printf("\n");
if (!strcmp(who, "?"))
list_bio(ipc);
} while (!strcmp(who, "?"));
r = CtdlIPCGetBio(ipc, who, &resp, buf);
if (r / 100 != 1) {
- pprintf("%s\n", buf);
+ scr_printf("%s\n", buf);
return;
}
while (!IsEmptyStr(resp)) {
extract_token(buf, resp, 0, '\n', sizeof buf);
remove_token(resp, 0, '\n');
- pprintf("%s\n", buf);
+ scr_printf("%s\n", buf);
}
if (resp) free(resp);
}