mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
client/server: client sends its CWD to server
This commit is contained in:
parent
0bb15d3d16
commit
277735db65
2 changed files with 20 additions and 1 deletions
12
client.c
12
client.c
|
|
@ -127,10 +127,15 @@ main(int argc, char *const *argv)
|
|||
}
|
||||
}
|
||||
|
||||
char cwd[4096];
|
||||
getcwd(cwd, sizeof(cwd));
|
||||
const uint16_t cwd_len = strlen(cwd) + 1;
|
||||
|
||||
const uint16_t term_len = strlen(term) + 1;
|
||||
uint32_t total_len = 0;
|
||||
|
||||
/* Calculate total length */
|
||||
total_len += sizeof(cwd_len) + cwd_len;
|
||||
total_len += sizeof(term_len) + term_len;
|
||||
total_len += sizeof(argc);
|
||||
|
||||
|
|
@ -147,6 +152,13 @@ main(int argc, char *const *argv)
|
|||
goto err;
|
||||
}
|
||||
|
||||
if (send(fd, &cwd_len, sizeof(cwd_len), 0) != sizeof(cwd_len) ||
|
||||
send(fd, cwd, cwd_len, 0) != cwd_len)
|
||||
{
|
||||
LOG_ERRNO("failed to send CWD to server");
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (send(fd, &term_len, sizeof(term_len), 0) != sizeof(term_len) ||
|
||||
send(fd, term, term_len, 0) != term_len)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue