-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstring.c
More file actions
29 lines (26 loc) · 943 Bytes
/
Copy pathstring.c
File metadata and controls
29 lines (26 loc) · 943 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <stdio.h>
#include "string.h"
int main() {
ssh_string_struct *s1 = ssh_string_new(6);
printf("%p\n%p\n%d\n", s1, s1->data, s1->size);
int rc = ssh_string_fill(s1, "hello1", 6);
if (rc != 0) return 1;
ssh_string_struct *s2 = ssh_string_from_char("hello");
printf("%p\n%s\n%d\n", s2, s2->data, s2->size);
ssh_string_struct *s3 = ssh_string_from_data("hello3", 6);
printf("%p\n%s\n%d\n", s3, s3->data, s3->size);
size_t len = ssh_string_len(s3);
printf("%ld\n", len);
char *cstr = ssh_string_get_char(s2);
printf("ctsr: %s\n", cstr);
char *cstr2 = ssh_string_to_char(s1);
printf("cstr2: %s\n", cstr2);
ssh_string_free_char(cstr2);
printf("cstr2: %s\n", cstr2); // Did this as test to see if cstr2 is free
ssh_string_struct *s4 = ssh_string_copy(s1);
printf("%s\n", s4->data);
// char *s5 = get_array("it worked");
// printf("array: %s\n %p %zu\n", s5, s5, sizeof(s5));
int x = ssh_string_cmp(s1, s2);
return 0;
}