1 /* 2 * lftp - file transfer program 3 * 4 * Copyright (c) 1996-2012 by Alexander V. Lukyanov (lav@yars.free.net) 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 #ifndef MVJOB_H 21 #define MVJOB_H 22 23 #include "Job.h" 24 #include "StatusLine.h" 25 #include "ArgV.h" 26 #include "trio.h" 27 28 class mvJob : public SessionJob 29 { 30 xstring_c from; 31 xstring to; 32 FA::open_mode m; 33 bool remove_target; 34 bool failed; 35 bool done; 36 37 public: 38 int Do(); Done()39 int Done() { return done; } ExitCode()40 int ExitCode() { return failed; } 41 42 xstring& FormatStatus(xstring&,int,const char *); 43 void ShowRunStatus(const SMTaskRef<StatusLine>&); 44 void SayFinal(); 45 46 void doOpen() const; cmd()47 const char *cmd() const { return m==FA::RENAME ? "mv" : "ln"; } 48 49 mvJob(FileAccess *session,const char *f,const char *t,FA::open_mode m=FA::RENAME); RemoveTargetFirst()50 void RemoveTargetFirst() { remove_target=true; } 51 }; 52 53 #endif // MVJOB_H 54