ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/Syncify/Syncify.cpp
(Generate patch)

Comparing Syncify/Syncify.cpp (file contents):
Revision 437 by douglas, 2005-04-05T16:05:16-07:00 vs.
Revision 440 by douglas, 2005-04-07T22:53:00-07:00

# Line 5 | Line 5
5   // $Id$
6  
7   #include "Syncify.hpp"
8 + #include "SambaReader.hpp"
9  
10   #include <menes-api/exename.hpp>
11   #include <menes-app/simple.hpp>
# Line 51 | Line 52 | extern "C"
52   {
53          void authenticate(const char* srv, const char* shr, char* wg, int wglen, char* un, int unlen, char* pw, int pwlen)
54          {
55 <                static ext::String user("Douglas Thrift"), password(::getpass("Password:"));
55 >                static ext::Buffer user("Douglas Thrift"), password(::getpass("Password:"));
56  
57 <                _foreach (ext::String, atom, user)
57 >                _foreach (ext::Buffer, atom, user)
58                          un[_index] = *atom;
59 <                _foreach (ext::String, atom, password)
59 >                _foreach (ext::Buffer, atom, password)
60                          pw[_index] = *atom;
61  
62                  un[user.GetSize() < size_t(unlen) ? user.GetSize() : unlen - 1] = '\0';
# Line 78 | Line 79 | Syncify::~Syncify()
79   ext::String Syncify::program(api::GetExecutablePath().GetName());
80   bool Syncify::debug(false);
81  
82 < void Syncify::syncify(const ext::String& local, const ext::String& remote)
82 > void Syncify::syncify(const api::Path& local, const ext::String& remote)
83   {
84          try
85          {
# Line 91 | Line 92 | void Syncify::syncify(const ext::String&
92                  case SMBC_FILE:
93                          if (entity->name == pattern)
94                          {
95 <                                api::Cout << entity->name << ios::NewLine;
95 >                                api::Path path(local.GetChild(entity->name));
96 >
97 >                                if (!path.Exists())
98 >                                {
99 >                                        SambaReader samba(remote + "/" + entity->name);
100 >                                        api::FileWriter file(path.GetPath());
101 >
102 >                                        ios::ReadToWrite(samba, file);
103 >                                }
104                          }
105                          break;
106                  case SMBC_DIR:
# Line 103 | Line 112 | void Syncify::syncify(const ext::String&
112                  ::smbc_closedir(directory);
113  
114                  _foreach (const ext::RedBlackSet<ext::String>, directory, directories)
115 <                        syncify(local + "/" + *directory, remote + "/" + *directory);
115 >                        syncify(local.GetChild(*directory), remote + "/" + *directory);
116          }
117          catch (const Error& error)
118          {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines