diff options
author | Richard Sharpe <sharpe@samba.org> | 2002-11-15 22:51:03 +0000 |
---|---|---|
committer | Richard Sharpe <sharpe@samba.org> | 2002-11-15 22:51:03 +0000 |
commit | b45c92f31ea0442d623ac2d92dcd97215c1ed481 (patch) | |
tree | 812e8c1b21e55d5df4d0d14f9332e4ea55fb87a5 /examples | |
parent | f85da55c3778632b14cc99b4032db4cf33b54bb6 (diff) | |
download | samba-b45c92f31ea0442d623ac2d92dcd97215c1ed481.tar.gz samba-b45c92f31ea0442d623ac2d92dcd97215c1ed481.tar.bz2 samba-b45c92f31ea0442d623ac2d92dcd97215c1ed481.zip |
Fix some problems with tree.c reported by users.
(This used to be commit b0772a1a0531896d5b343863434622d4d0ff437f)
Diffstat (limited to 'examples')
-rw-r--r-- | examples/libsmbclient/Makefile | 2 | ||||
-rw-r--r-- | examples/libsmbclient/testsmbc.c | 126 | ||||
-rw-r--r-- | examples/libsmbclient/tree.c | 3 |
3 files changed, 6 insertions, 125 deletions
diff --git a/examples/libsmbclient/Makefile b/examples/libsmbclient/Makefile index 8c1def8a16..5fe9977c0a 100644 --- a/examples/libsmbclient/Makefile +++ b/examples/libsmbclient/Makefile @@ -11,7 +11,7 @@ all: testsmbc tree testsmbc: testsmbc.o @echo Linking testsmbc - @$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lsmbclient + @$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lsmbclient -L/usr/local/lib testsmbc-static: testsmbc.o @echo Linking testsmbc diff --git a/examples/libsmbclient/testsmbc.c b/examples/libsmbclient/testsmbc.c index ec98774dcf..888a9c0d4f 100644 --- a/examples/libsmbclient/testsmbc.c +++ b/examples/libsmbclient/testsmbc.c @@ -94,74 +94,10 @@ int main(int argc, char *argv[]) if (argc > 1) { - /* Try to list the print jobs ... */ + if ((dh1 = smbc_opendir(argv[1]))<1) { - if (smbc_list_print_jobs("smb://samba/pclp", print_list_fn) < 0) { - - fprintf(stderr, "Could not list print jobs: %s, %d\n", strerror(errno), errno); - exit(1); - - } - - /* Try to delete the last job listed */ - - if (global_id > 0) { - - fprintf(stdout, "Trying to delete print job %u\n", global_id); - - if (smbc_unlink_print_job("smb://samba/pclp", global_id) < 0) { - - fprintf(stderr, "Failed to unlink job id %u, %s, %u\n", global_id, - strerror(errno), errno); - - exit(1); - - } - - } - - /* Try to print a file ... */ - - if (smbc_print_file("smb://samba/public/testfile2.txt", "smb://samba/pclp") < 0) { - - fprintf(stderr, "Failed to print job: %s %u\n", strerror(errno), errno); - exit(1); - - } - - /* Try to delete argv[1] as a file ... */ - - if (smbc_unlink(argv[1]) < 0) { - - fprintf(stderr, "Could not unlink: %s, %s, %d\n", - argv[1], strerror(errno), errno); - - exit(0); - - } - - if ((dh1 = smbc_opendir("smb://"))<1) { - - fprintf(stderr, "Could not open directory: smb://: %s\n", - strerror(errno)); - - exit(1); - - } - - if ((dh2 = smbc_opendir("smb://sambanet")) < 0) { - - fprintf(stderr, "Could not open directory: smb://sambanet: %s\n", - strerror(errno)); - - exit(1); - - } - - if ((dh3 = smbc_opendir("smb://samba")) < 0) { - - fprintf(stderr, "Could not open directory: smb://samba: %s\n", - strerror(errno)); + fprintf(stderr, "Could not open directory: %s: %s\n", + argv[1], strerror(errno)); exit(1); @@ -202,62 +138,6 @@ int main(int argc, char *argv[]) dirp = (char *)dirbuf; - if ((dirc = smbc_getdents(dh2, (struct smbc_dirent *)dirp, - sizeof(dirbuf))) < 0) { - - fprintf(stderr, "Problems getting directory entries: %s\n", - strerror(errno)); - - exit(1); - - } - - /* Now, process the list of names ... */ - - fprintf(stdout, "\nDirectory listing, size = %u\n", dirc); - - while (dirc > 0) { - - dsize = ((struct smbc_dirent *)dirp)->dirlen; - fprintf(stdout, "Dir Ent, Type: %u, Name: %s, Comment: %s\n", - ((struct smbc_dirent *)dirp)->smbc_type, - ((struct smbc_dirent *)dirp)->name, - ((struct smbc_dirent *)dirp)->comment); - - dirp += dsize; - (char *)dirc -= dsize; - - } - - dirp = (char *)dirbuf; - - if ((dirc = smbc_getdents(dh3, (struct smbc_dirent *)dirp, - sizeof(dirbuf))) < 0) { - - fprintf(stderr, "Problems getting directory entries: %s\n", - strerror(errno)); - - exit(1); - - } - - /* Now, process the list of names ... */ - - fprintf(stdout, "Directory listing, size = %u\n", dirc); - - while (dirc > 0) { - - dsize = ((struct smbc_dirent *)dirp)->dirlen; - fprintf(stdout, "\nDir Ent, Type: %u, Name: %s, Comment: %s\n", - ((struct smbc_dirent *)dirp)->smbc_type, - ((struct smbc_dirent *)dirp)->name, - ((struct smbc_dirent *)dirp)->comment); - - (char *)dirp += dsize; - (char *)dirc -= dsize; - - } - exit(1); } diff --git a/examples/libsmbclient/tree.c b/examples/libsmbclient/tree.c index da60236e60..f357c0306d 100644 --- a/examples/libsmbclient/tree.c +++ b/examples/libsmbclient/tree.c @@ -51,7 +51,8 @@ void error_message(gchar *message) { /* Ensure that the dialog box is destroyed when the user clicks ok. */ gtk_signal_connect_object (GTK_OBJECT (okay_button), "clicked", - GTK_SIGNAL_FUNC (gtk_widget_destroy), dialog); + GTK_SIGNAL_FUNC (gtk_widget_destroy), + GTK_OBJECT(dialog)); gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog)->action_area), okay_button); |