4 Unix SMB/Netbios implementation.
6 printing backend routines for smbd - using files_struct rather
8 Copyright (C) Andrew Tridgell 1992-2000
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 extern int DEBUGLEVEL
;
29 /***************************************************************************
30 open a print file and setup a fsp for it. This is a wrapper around
32 ***************************************************************************/
34 files_struct
*print_fsp_open(connection_struct
*conn
,char *jobname
)
38 extern struct current_user current_user
;
39 files_struct
*fsp
= file_new();
44 jobid
= print_job_start(¤t_user
, SNUM(conn
), jobname
);
50 /* setup a full fsp */
51 fsp
->print_jobid
= jobid
;
52 fsp
->fd
= print_job_fd(jobid
);
53 GetTimeOfDay(&fsp
->open_time
);
54 fsp
->vuid
= current_user
.vuid
;
58 fsp
->can_read
= False
;
59 fsp
->can_write
= True
;
61 fsp
->print_file
= True
;
62 fsp
->modified
= False
;
63 fsp
->oplock_type
= NO_OPLOCK
;
64 fsp
->sent_oplock_break
= NO_BREAK_SENT
;
65 fsp
->is_directory
= False
;
66 fsp
->stat_open
= False
;
67 fsp
->directory_delete_on_close
= False
;
69 string_set(&fsp
->fsp_name
,print_job_fname(jobid
));
70 fsp
->wbmpx_ptr
= NULL
;
72 conn
->vfs_ops
.fstat(fsp
,fsp
->fd
, &sbuf
);
73 fsp
->mode
= sbuf
.st_mode
;
74 fsp
->inode
= sbuf
.st_ino
;
75 fsp
->dev
= sbuf
.st_dev
;
77 conn
->num_files_open
++;
82 /****************************************************************************
83 print a file - called on closing the file
84 ****************************************************************************/
85 void print_fsp_end(files_struct
*fsp
)
87 print_job_end(fsp
->print_jobid
);
90 string_free(&fsp
->fsp_name
);