char buf[PATH_MAX];
int a;
struct ctdlroom qrbuf;
+ int rv = 0;
extract_token(filename, cmdbuf, 0, '|', sizeof filename);
extract_token(newroom, cmdbuf, 1, '|', sizeof newroom);
return;
}
- if (getroom(&qrbuf, newroom) != 0) {
+ if (CtdlGetRoom(&qrbuf, newroom) != 0) {
cprintf("%d '%s' does not exist.\n", ERROR + ROOM_NOT_FOUND, newroom);
return;
}
snprintf(buf, sizeof buf,
"cat ./files/%s/filedir |grep \"%s\" >>./files/%s/filedir",
CC->room.QRdirname, filename, qrbuf.QRdirname);
- system(buf);
+ rv = system(buf);
cprintf("%d File '%s' has been moved.\n", CIT_OK, filename);
}
char which_user[USERNAME_SIZE];
int which_floor;
int a;
+ int rv;
extract_token(filename, cmdbuf, 0, '|', sizeof filename);
if (!strcasecmp(filename, "_userpic_")) {
extract_token(which_user, cmdbuf, 1, '|', sizeof which_user);
- if (getuser(&usbuf, which_user) != 0) {
+ if (CtdlGetUser(&usbuf, which_user) != 0) {
cprintf("%d No such user.\n",
ERROR + NO_SUCH_USER);
return;
ERROR + FILE_NOT_FOUND, pathname, strerror(errno));
return;
}
- fread(&MimeTestBuf[0], 1, 32, CC->download_fp);
+ rv = fread(&MimeTestBuf[0], 1, 32, CC->download_fp);
rewind (CC->download_fp);
OpenCmdResult(pathname, GuessMimeType(&MimeTestBuf[0], 32));
}
/*
* abort an upload
*/
-void abort_upl(struct CitContext *who)
+void abort_upl(CitContext *who)
{
if (who->upload_fp != NULL) {
fclose(who->upload_fp);
buf = malloc(bytes + 1);
fseek(CC->download_fp, start_pos, 0);
+
actual_bytes = fread(buf, 1, bytes, CC->download_fp);
- cprintf("%d %d\n", BINARY_FOLLOWS, (int)actual_bytes);
- client_write(buf, actual_bytes);
+ if (actual_bytes > 0) {
+ cprintf("%d %d\n", BINARY_FOLLOWS, (int)actual_bytes);
+ client_write(buf, bytes);
+ }
+ else {
+ cprintf("%d %s\n", ERROR, strerror(errno));
+ }
free(buf);
}
{
int bytes;
char *buf;
+ int rv;
unbuffer_output();
cprintf("%d %d\n", SEND_BINARY, bytes);
buf = malloc(bytes + 1);
client_read(buf, bytes);
- fwrite(buf, bytes, 1, CC->upload_fp);
+ rv = fwrite(buf, bytes, 1, CC->upload_fp);
free(buf);
}
CTDL_MODULE_INIT(file_ops)
{
- CtdlRegisterProtoHook(cmd_delf, "DELF", "Autoconverted. TODO: document me.");
- CtdlRegisterProtoHook(cmd_movf, "MOVF", "Autoconverted. TODO: document me.");
- CtdlRegisterProtoHook(cmd_open, "OPEN", "Autoconverted. TODO: document me.");
- CtdlRegisterProtoHook(cmd_clos, "CLOS", "Autoconverted. TODO: document me.");
- CtdlRegisterProtoHook(cmd_uopn, "UOPN", "Autoconverted. TODO: document me.");
- CtdlRegisterProtoHook(cmd_ucls, "UCLS", "Autoconverted. TODO: document me.");
- CtdlRegisterProtoHook(cmd_read, "READ", "Autoconverted. TODO: document me.");
- CtdlRegisterProtoHook(cmd_writ, "WRIT", "Autoconverted. TODO: document me.");
- CtdlRegisterProtoHook(cmd_oimg, "OIMG", "Autoconverted. TODO: document me.");
- CtdlRegisterProtoHook(cmd_ndop, "NDOP", "Autoconverted. TODO: document me.");
- CtdlRegisterProtoHook(cmd_nuop, "NUOP", "Autoconverted. TODO: document me.");
- CtdlRegisterProtoHook(cmd_uimg, "UIMG", "Autoconverted. TODO: document me.");
+ if (!threading) {
+ CtdlRegisterProtoHook(cmd_delf, "DELF", "Autoconverted. TODO: document me.");
+ CtdlRegisterProtoHook(cmd_movf, "MOVF", "Autoconverted. TODO: document me.");
+ CtdlRegisterProtoHook(cmd_open, "OPEN", "Autoconverted. TODO: document me.");
+ CtdlRegisterProtoHook(cmd_clos, "CLOS", "Autoconverted. TODO: document me.");
+ CtdlRegisterProtoHook(cmd_uopn, "UOPN", "Autoconverted. TODO: document me.");
+ CtdlRegisterProtoHook(cmd_ucls, "UCLS", "Autoconverted. TODO: document me.");
+ CtdlRegisterProtoHook(cmd_read, "READ", "Autoconverted. TODO: document me.");
+ CtdlRegisterProtoHook(cmd_writ, "WRIT", "Autoconverted. TODO: document me.");
+ CtdlRegisterProtoHook(cmd_oimg, "OIMG", "Autoconverted. TODO: document me.");
+ CtdlRegisterProtoHook(cmd_ndop, "NDOP", "Autoconverted. TODO: document me.");
+ CtdlRegisterProtoHook(cmd_nuop, "NUOP", "Autoconverted. TODO: document me.");
+ CtdlRegisterProtoHook(cmd_uimg, "UIMG", "Autoconverted. TODO: document me.");
+ }
/* return our Subversion id for the Log */
return "$Id$";
}