2 * Unix SMB/CIFS implementation.
4 * Copyright (C) Guenther Deschner 2008
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
20 #include <sys/types.h>
30 int main(int argc
, const char **argv
)
32 NET_API_STATUS status
;
33 struct libnetapi_ctx
*ctx
= NULL
;
34 const char *hostname
= NULL
;
40 struct poptOption long_options
[] = {
42 POPT_COMMON_LIBNETAPI_EXAMPLES
46 status
= libnetapi_init(&ctx
);
51 pc
= poptGetContext("file_close", argc
, argv
, long_options
, 0);
53 poptSetOtherOptionHelp(pc
, "hostname fileid");
54 while((opt
= poptGetNextOpt(pc
)) != -1) {
57 if (!poptPeekArg(pc
)) {
58 poptPrintHelp(pc
, stderr
, 0);
61 hostname
= poptGetArg(pc
);
63 if (!poptPeekArg(pc
)) {
64 poptPrintHelp(pc
, stderr
, 0);
67 fileid
= atoi(poptGetArg(pc
));
71 status
= NetFileClose(hostname
, fileid
);
73 printf("NetFileClose failed with: %s\n",
74 libnetapi_get_error_string(ctx
, status
));