/** * Copyright (C) 2008 Happy Fish / YuQing * * FastDFS may be copied only under the terms of the GNU General * Public License V3, which may be found in the FastDFS source kit. * Please visit the FastDFS Home Page http://www.csource.org/ for more detail. **/ #include #include #include #include #include #include #include #include "fdfs_client.h" #include "fastcommon/logger.h" int main(int argc, char *argv[]) { char *conf_filename; ConnectionInfo *pTrackerServer; int result; char file_id[128]; if (argc < 3) { printf("Usage: %s \n", argv[0]); return 1; } log_init(); g_log_context.log_level = LOG_ERR; ignore_signal_pipe(); conf_filename = argv[1]; if ((result=fdfs_client_init(conf_filename)) != 0) { return result; } pTrackerServer = tracker_get_connection(); if (pTrackerServer == NULL) { fdfs_client_destroy(); return errno != 0 ? errno : ECONNREFUSED; } snprintf(file_id, sizeof(file_id), "%s", argv[2]); if ((result=storage_delete_file1(pTrackerServer, NULL, file_id)) != 0) { printf("delete file fail, " \ "error no: %d, error info: %s\n", \ result, STRERROR(result)); } tracker_disconnect_server_ex(pTrackerServer, true); fdfs_client_destroy(); return result; }