summaryrefslogtreecommitdiffstats
path: root/source/printing/print_generic.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/printing/print_generic.c')
-rw-r--r--source/printing/print_generic.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/source/printing/print_generic.c b/source/printing/print_generic.c
index 4d77b827bf6..2a6b11ebc4e 100644
--- a/source/printing/print_generic.c
+++ b/source/printing/print_generic.c
@@ -1,5 +1,6 @@
/*
- Unix SMB/CIFS implementation.
+ Unix SMB/Netbios implementation.
+ Version 3.0
printing command routines
Copyright (C) Andrew Tridgell 1992-2000
@@ -55,7 +56,7 @@ static int print_run_command(int snum,char *command, int *outfd, ...)
{
pstring syscmd;
- char *arg;
+ char *p, *arg;
int ret;
va_list ap;
va_start(ap, outfd);
@@ -75,9 +76,13 @@ static int print_run_command(int snum,char *command, int *outfd, ...)
}
va_end(ap);
- pstring_sub(syscmd, "%p", PRINTERNAME(snum));
+ p = PRINTERNAME(snum);
+
+ pstring_sub(syscmd, "%p", p);
standard_sub_snum(snum,syscmd,sizeof(syscmd));
+ /* Convert script args to unix-codepage */
+ dos_to_unix(syscmd);
ret = smbrun(syscmd,outfd);
DEBUG(3,("Running the command `%s' gave %d\n",syscmd,ret));
@@ -153,7 +158,7 @@ static int generic_job_submit(int snum, struct printjob *pjob)
return 0;
pstrcpy(print_directory, pjob->filename);
- p = strrchr_m(print_directory,'/');
+ p = strrchr(print_directory,'/');
if (!p)
return 0;
*p++ = 0;
@@ -168,13 +173,13 @@ static int generic_job_submit(int snum, struct printjob *pjob)
/* send it to the system spooler */
ret = print_run_command(snum,
- lp_printcommand(snum), NULL,
- "%s", p,
- "%J", jobname,
- "%f", p,
- "%z", job_size,
- "%c", job_page_count,
- NULL);
+ lp_printcommand(snum), NULL,
+ "%s", p,
+ "%J", jobname,
+ "%f", p,
+ "%z", job_size,
+ "%c", job_page_count,
+ NULL);
chdir(wd);
@@ -193,7 +198,9 @@ static int generic_queue_get(int snum, print_queue_struct **q, print_status_stru
print_queue_struct *queue = NULL;
fstring printer_name;
+ /* Convert printer name (i.e. share name) to unix-codepage */
fstrcpy(printer_name, lp_servicename(snum));
+ dos_to_unix(printer_name);
print_run_command(snum, lp_lpqcommand(snum), &fd, NULL);
@@ -204,7 +211,7 @@ static int generic_queue_get(int snum, print_queue_struct **q, print_status_stru
}
numlines = 0;
- qlines = fd_lines_load(fd, &numlines);
+ qlines = fd_lines_load(fd, &numlines, True);
close(fd);
/* turn the lpq output into a series of job structures */