7 #include <libsmbclient.h>
8 #include "get_auth_data_fn.h"
11 int main(int argc
, char * argv
[])
21 smbc_init(get_auth_data_fn
, debug
);
23 printf("CAUTION: This program will overwrite a file. "
24 "Press ENTER to continue.");
25 p
= fgets(buffer
, sizeof(buffer
), stdin
);
27 fprintf(stderr
, "failed to read from stdin\n");
34 fprintf(stdout
, "\nPath: ");
36 p
= fgets(path
, sizeof(path
) - 1, stdin
);
38 fprintf(stderr
, "failed to read from stdin\n");
41 if (strlen(path
) == 0)
46 p
= path
+ strlen(path
) - 1;
52 if ((fd
= smbc_open(path
, O_WRONLY
| O_CREAT
| O_TRUNC
, 0)) < 0)
58 snprintf(buffer
, sizeof(buffer
), "%s", "Hello world\n");
60 ret
= smbc_write(fd
, buffer
, strlen(buffer
));