#include <ascii.h>
#endif
-/* Debug printing -- remove before 0.0.8 final */
-#if 1
-#define DPRINT(s)
-#else
-#define DPRINT(s) printf s
-#endif
-
#ifndef MAP_FAILED
#define MAP_FAILED -1
#endif
*/
int add_fd(const int fd, const int events)
{
- DPRINT(("add_fd(%d, %x)\n", fd, events));
#if HAVE_POLL
if (fd >= FD_MAX) {
printf("add_fd(%d, %x): failed\n", fd, events);
*/
void del_fd(const int fd)
{
- DPRINT(("del_fd(%d)\n", fd));
#if HAVE_POLL
if (fd >= FD_MAX)
return;
{
const unsigned int one = 1;
struct conn *c = (struct conn *)(malloc(sizeof(struct conn)));
- DPRINT(("alloc_new_conn(%d)\n", sock));
if (c == NULL) return c;
*/
void destroy_conn(struct conn * const c)
{
- DPRINT(("destroy_conn:\n"));
if (c == NULL) return;
del_fd(c->sock);
destroy_ftran(c->transfer);
remove_from_linked_list((struct list_element *)c);
-
- DPRINT(("destroy_conn done.\n"));
}
/*
struct conn *c = NULL, *next = first_conn->next_conn;
int checked_through = 0;
- DPRINT(("process_all_clients: num_ac %d\n", num_ac));
-
/* run through the linked list */
while (next != NULL && checked_through < num_ac) {
int bytes_avail;
if (!fds[c->sock].revents & POLLIN) {
continue;
}
- DPRINT(("process_all_clients: fd %d has POLLIN set\n", c->sock));
#else
if (!FD_ISSET(c->sock, active_clients)) {
continue;
int do_upload(struct ftran *f)
{
char upload_buf[16384];
- int avail, size;
+ int size;
#if WANT_ASCII
/* keep buffer size small in ascii transfers
to prevent process stalling while filtering
#if HAVE_POLL
i = poll(fds, highest_fds + 1, 60000);
- DPRINT(("poll returns %d\n", i));
#if 0
{
int j;
i = vsnprintf(buf, 256, fmt, args);
va_end(args);
- DPRINT((buf));
err = send(c->sock, buf, i, 0);
if (err == -1 && errno == EPIPE) {
destroy_conn(c);
if (glob("README*", 0, NULL, &pglob) != 0) return;
for (i = 0; i < pglob.gl_pathc; i++) {
- const char * const temp = pglob.gl_pathv[i];
struct stat buf;
char str[256];
-
char *tm;
- if (stat(temp, &buf) == -1) continue;
+ if (stat(pglob.gl_pathv[i], &buf) == -1) continue;
/* remove trailing LF */
tm = ctime(&buf.st_mtime);
snprintf(str, 256, "250-Please read the file %s\r\n"
"250-\tIt was last modified %s - %ld days ago\r\n",
- temp, tm,
+ pglob.gl_pathv[i], tm,
(now - buf.st_mtime) / 86400);
send(c->sock, str, strlen(str), 0);
}