6 #include <libsmbclient.h>
8 #define MAX_BUFF_SIZE 255
9 char g_workgroup[MAX_BUFF_SIZE];
10 char g_username[MAX_BUFF_SIZE];
11 char g_password[MAX_BUFF_SIZE];
12 char g_server[MAX_BUFF_SIZE];
13 char g_share[MAX_BUFF_SIZE];
15 char g_print_user[MAX_BUFF_SIZE];
16 char g_print_name[MAX_BUFF_SIZE];
17 unsigned int g_print_id;
18 unsigned int g_print_priority;
19 unsigned int g_print_size;
21 int print_queue_empty;
23 void auth_fn(const char *server, const char *share, char *workgroup, int wgmaxlen,
24 char *username, int unmaxlen, char *password, int pwmaxlen)
27 strncpy(workgroup, g_workgroup, wgmaxlen - 1);
29 strncpy(username, g_username, unmaxlen - 1);
31 strncpy(password, g_password, pwmaxlen - 1);
33 strcpy(g_server, server);
34 strcpy(g_share, share);
38 void print_list_fn_2(struct print_job_info *pji)
40 print_queue_empty = 0;
44 void print_list_fn(struct print_job_info *pji)
48 g_print_priority = pji->priority;
49 g_print_size = pji->size;
50 strcpy(g_print_user,pji->user);
51 strcpy(g_print_name,pji->name);
53 /* fprintf(stdout, "Print job: ID: %u, Prio: %u, Size: %u, User: %s, Name: %s\n",
54 pji->id, pji->priority, pji->size, pji->user, pji->name); */
58 int main(int argc, char** argv)
62 char url[MAX_BUFF_SIZE];
64 bzero(g_workgroup,MAX_BUFF_SIZE);
65 bzero(url,MAX_BUFF_SIZE);
66 bzero(g_print_user,MAX_BUFF_SIZE);
67 bzero(g_print_name,MAX_BUFF_SIZE);
73 print_queue_empty = 0;
78 strncpy(g_workgroup,argv[1],strlen(argv[1]));
79 strncpy(g_username,argv[2],strlen(argv[2]));
80 strncpy(g_password,argv[3],strlen(argv[3]));
81 strncpy(url,argv[4],strlen(argv[4]));
83 smbc_init(auth_fn, 0);
85 while ( ! print_queue_empty ) /* Wait until the queue is empty */
88 print_queue_empty = 1;
89 smbc_list_print_jobs(url,print_list_fn_2);
92 smbc_list_print_jobs(url,print_list_fn);