解决一个擦除的bug

This commit is contained in:
2026-07-21 20:18:28 +08:00
parent f50b9c9e66
commit 66a1e8fd6a
25 changed files with 2005 additions and 61 deletions

View File

@@ -0,0 +1,14 @@
#pragma once
#include <stdlib.h>
#include <stdint.h>
int lftpd_inet_listen(int port);
int lftpd_inet_listen_multi(int port, int backlog);
int lftpd_inet_get_socket_port(int socket);
int lftpd_inet_accept(int socket);
int lftpd_inet_read_line(int socket, char *buffer, size_t buffer_len);
int lftpd_inet_write_string(int socket, const char *message);
int lftpd_inet_write(int socket, const void *buf, int len);
int lftpd_inet_read(int socket, void *buf, int len);
int lftpd_inet_close(int socket);

View File

@@ -0,0 +1,18 @@
#pragma once
#include <stdint.h>
char *lftpd_io_canonicalize_path(const char *base, const char *name);
int lftpd_io_open_read(const char *path);
int lftpd_io_open_write(const char *path);
int lftpd_io_read(int handle, void *buf, int len);
int lftpd_io_write(int handle, const void *buf, int len);
void lftpd_io_close(int handle);
int lftpd_io_stat(const char *path, uint32_t *p_size, int *p_is_dir);
int lftpd_io_unlink(const char *path);
void *lftpd_io_opendir(const char *path);
int lftpd_io_readdir(void *dp, char *name, int name_max, uint32_t *p_size, int *p_is_dir);
void lftpd_io_closedir(void *dp);

View File

@@ -0,0 +1,7 @@
#pragma once
#include "dbg_log.h"
#define lftpd_log_error(format, ...) DBG_ERROR("[FTP] " format, ##__VA_ARGS__)
#define lftpd_log_info(format, ...) DBG_INFO("[FTP] " format, ##__VA_ARGS__)
#define lftpd_log_debug(format, ...)

View File

@@ -0,0 +1,42 @@
#pragma once
#define STATUS_110 "Restart marker reply."
#define STATUS_120 "Service ready in %d minutes."
#define STATUS_125 "Data connection already open; transfer starting."
#define STATUS_150 "File status okay; about to open data connection."
#define STATUS_200 "Command okay."
#define STATUS_202 "Command not implemented, superfluous at this site."
#define STATUS_211 "System status, or system help reply."
#define STATUS_212 "Directory status."
#define STATUS_213 "File status."
#define STATUS_214 "Help message."
#define STATUS_215 "%s system type."
#define STATUS_220 "Service ready for new user."
#define STATUS_221 "Service closing control connection."
#define STATUS_225 "Data connection open; no transfer in progress."
#define STATUS_226 "Closing data connection."
#define STATUS_227 "Entering Passive Mode (%d,%d,%d,%d,%d,%d)."
#define STATUS_229 "Entering Extended Passive Mode (|||%d|)."
#define STATUS_230 "User logged in, proceed."
#define STATUS_250 "Requested file action okay, completed."
#define STATUS_257 "\"%s\" created."
#define STATUS_331 "User name okay, need password."
#define STATUS_332 "Need account for login."
#define STATUS_350 "Requested file action pending further information."
#define STATUS_421 "Service not available, closing control connection."
#define STATUS_425 "Can't open data connection."
#define STATUS_426 "Connection closed; transfer aborted."
#define STATUS_450 "Requested file action not taken. File unavailable (e.g., file busy)."
#define STATUS_451 "Requested action aborted: local error in processing."
#define STATUS_452 "Requested action not taken. Insufficient storage space in system."
#define STATUS_500 "Syntax error, command unrecognized. This may include errors such as command line too long."
#define STATUS_501 "Syntax error in parameters or arguments."
#define STATUS_502 "Command not implemented."
#define STATUS_503 "Bad sequence of commands."
#define STATUS_504 "Command not implemented for that parameter."
#define STATUS_530 "Not logged in."
#define STATUS_532 "Need account for storing files."
#define STATUS_550 "Requested action not taken. File unavailable (e.g., file not found, no access)."
#define STATUS_551 "Requested action aborted: page type unknown."
#define STATUS_552 "Requested file action aborted. Exceeded storage allocation (for current directory or dataset)."
#define STATUS_553 "Requested action not taken. File name not allowed."

View File

@@ -0,0 +1,5 @@
#pragma once
#define CRLF "\r\n"
char* lftpd_string_trim(char* s);