source: branches/samba-3.0/examples/libsmbclient/testsmbc.c@ 473

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

Initial code import

File size: 6.7 KB
Line 
1/*
2 Unix SMB/CIFS implementation.
3 SMB client library test program
4 Copyright (C) Andrew Tridgell 1998
5 Copyright (C) Richard Sharpe 2000
6 Copyright (C) John Terpsra 2000
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21*/
22
23#include <stdio.h>
24#include <errno.h>
25#include <sys/time.h>
26#include <string.h>
27#include <unistd.h>
28#include <stdlib.h>
29#include <libsmbclient.h>
30#include "get_auth_data_fn.h"
31
32int global_id = 0;
33
34void print_list_fn(struct print_job_info *pji)
35{
36
37 fprintf(stdout, "Print job: ID: %u, Prio: %u, Size: %u, User: %s, Name: %s\n",
38 pji->id, pji->priority, pji->size, pji->user, pji->name);
39
40 global_id = pji->id;
41
42}
43
44int main(int argc, char *argv[])
45{
46 int err, fd, dh1, dh2, dh3, dsize, dirc;
47 const char *file = "smb://samba/public/testfile.txt";
48 const char *file2 = "smb://samba/public/testfile2.txt";
49 char buff[256];
50 char dirbuf[512];
51 char *dirp;
52 struct stat st1, st2;
53
54 err = smbc_init(get_auth_data_fn, 10); /* Initialize things */
55
56 if (err < 0) {
57