tuyau

Client/server for transfering files (like cp)
git clone https://noulin.net/git/tuyau.git
Log | Files | Refs | README

commit 0094637ea1b32c0decd88b440a121864502dae48
parent 605dc309306e1f4336f669d146adb22bc91679cc
Author: Remy Noulin <loader2x@gmail.com>
Date:   Wed, 31 Aug 2022 02:53:46 -0400

fix sending directory to server root

package.yml |  2 +-
sclient.c   | 18 +++++++++++++++---
2 files changed, 16 insertions(+), 4 deletions(-)

Diffstat:
Mpackage.yml | 2+-
Msclient.c | 18+++++++++++++++---
2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/package.yml b/package.yml @@ -1,6 +1,6 @@ --- name: tuyau - version: 0.0.6 + version: 0.0.7 description: "Client for copying files to tuyauServer" bin: ./tuyau.c #cflags: -DA -g3 -std=gnu11 -fPIC -pipe diff --git a/sclient.c b/sclient.c @@ -252,7 +252,11 @@ int main(int ARGC, char** ARGV) { logD("mkdir in server"); char *dirname = basename(ssGet(p)); - cleanCharP(dest) = catS(destPath, "/", dirname); + cleanCharP(dest) = null; + if (destPath) + dest = catS(destPath, "/", dirname); + else + dest = strdup(dirname); u32 bufi = 0; u64 *filesize = null; @@ -329,7 +333,11 @@ int main(int ARGC, char** ARGV) { if (isDirG(localp)) { logD("mkdir in server"); cleanCharP(dirname) = catS(iK(recusive), "/", ssGet(p)); - cleanCharP(dest) = catS(destPath, "/", dirname); + cleanCharP(dest) = null; + if (destPath) + dest = catS(destPath, "/", dirname); + else + dest = strdup(dirname); u32 bufi = 0; u64 *filesize = null; @@ -350,7 +358,11 @@ int main(int ARGC, char** ARGV) { logD("Send files from localPath/p to destPath/iK(recusive)/"); // send - cleanCharP(dest) = catS(destPath, "/", iK(recusive)); + cleanCharP(dest) = null; + if (destPath) + dest = catS(destPath, "/", iK(recusive)); + else + dest = strdup(iK(recusive)); u32 bufi = 0; u64 *filesize = null; makeHeader(buf, &bufi, 0 /* command */, svrInfo, localp, dest, &filesize);