Changeset 55a36b7 in rtems


Ignore:
Timestamp:
Nov 21, 2012, 9:59:18 AM (7 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
be6f505
Parents:
c1e350c
git-author:
Sebastian Huber <sebastian.huber@…> (11/21/12 09:59:18)
git-committer:
Sebastian Huber <sebastian.huber@…> (11/21/12 15:38:34)
Message:

ftpd: Add SIZE command

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ftpd/ftpd.c

    rc1e350c r55a36b7  
    199199#include <errno.h>
    200200#include <ctype.h>
     201#include <inttypes.h>
    201202
    202203#include <rtems.h>
     
    14201421}
    14211422
     1423static void
     1424command_size(FTPD_SessionInfo_t *info, char const* fname)
     1425{
     1426  struct stat stbuf;
     1427  char buf[FTPD_BUFSIZE];
     1428
     1429  if(!info->auth)
     1430  {
     1431    send_reply(info, 550, "Access denied.");
     1432    return;
     1433  }
     1434
     1435  if (info->xfer_mode != TYPE_I || 0 > stat(fname, &stbuf) || stbuf.st_size < 0)
     1436  {
     1437    send_reply(info, 550, "Could not get file size.");
     1438  }
     1439  else
     1440  {
     1441    snprintf(buf, FTPD_BUFSIZE, "%" PRIuMAX, (uintmax_t) stbuf.st_size);
     1442    send_reply(info, 213, buf);
     1443  }
     1444}
     1445
    14221446/*
    14231447 * command_port
     
    17001724    strncpy(fname, args, 254);
    17011725    command_mdtm(info, fname);
     1726  }
     1727  else if (!strcmp("SIZE", cmd))
     1728  {
     1729    strncpy(fname, args, 254);
     1730    command_size(info, fname);
    17021731  }
    17031732  else if (!strcmp("SYST", cmd))
Note: See TracChangeset for help on using the changeset viewer.