source: branches/samba-3.0/examples/libsmbclient/testread.c@ 518

Last change on this file since 518 was 1, checked in by Paul Smedley, 19 years ago

Initial code import

File size: 1.4 KB
Line 
1#include <sys/types.h>
2#include <stdio.h>
3#include <unistd.h>
4#include <string.h>
5#include <time.h>
6#include <errno.h>
7#include <libsmbclient.h>
8#include "get_auth_data_fn.h"
9
10
11int main(int argc, char * argv[])
12{
13 int fd;
14 int ret;
15 int debug = 0;
16 int mode = 0666;
17 int savedErrno;
18 char buffer[2048];
19 char * pSmbPath = NULL;
20 time_t t0;
21 time_t t1;
22 struct stat st;
23
24 if (argc == 1)
25 {
26 pSmbPath = "smb://RANDOM/Public/bigfile";
27 }
28 else if (argc == 2)
29 {
30 pSmbPath = argv[1];
31 }
32 else
33 {
34 printf("usage: "
35 "%s [ smb://path/to/file ]\n",
36 argv[0]);
37 return 1;
38 }
39
40 smbc_init(get_auth_data_fn, debug);
41
42 printf("Open file %s\n", pSmbPath);
43
44 t0 = time(NULL);
45
46 if ((fd = smbc_open(pSmbPath, O_RDONLY, 0)) < 0)