~ubuntu-branches/ubuntu/utopic/gutenprint/utopic

« back to all changes in this revision

Viewing changes to .pc/0001-patch-stdio.h-is-required-by-commandtoepson-and-comm.patch/src/cups/commandtocanon.c

  • Committer: Package Import Robot
  • Author(s): Till Kamppeter
  • Date: 2012-02-14 22:41:51 UTC
  • mfrom: (1.1.14)
  • Revision ID: package-import@ubuntu.com-20120214224151-81lkvr2cow0u55f5
Tags: 5.2.8~pre1-0ubuntu1
* New upstream release
  - Added support for Canon BJC 4550, S330, S520, S530D, S630, S750, S820,
    S830D, S900, S9000, PIXMA mini220, mini320, mini360, i50, i70, i450,
    i455, i470D. i550, i900D, i950, i960, i6100, i6500, i9100, i9900,
    iP3300, iP3500, iP3600, iP4900, iP6210D, iP6220D, iP6310D, iP7100,
    iP7500, iP8100, iP8600, iP9910, MP140, MP190, MP210, MP240, MP375R,
    MP470, MP490, MP530, MP900, MG2100, MG3100, MG4100, MG5300, MG6200,
    MG8200, EPSON ME Office 940FW, PX 204, PX 504A, Stylus CX3900, NX530,
    NX635, SX535WD, Stylus Office BX535WD, BX630FW, BX635FWD, TX620FWD,
    Stylus Photo RX650, WorkForce 545, 630, 645, Stylus Pro 7900/9900
    (Partial -- no orange/green inks).
  - Printers redefined: Canon BJC 3000, S300, S500, S600, S800, PIXMA i80,
    i560, i850, i860, i865, iP2000, iP4100, iP5000, MP600, MP750, MP760,
    MP770, MP780, MP790, MP970
  - Support for the following printers was greatly improved, or tested:
    Canon PIXMA MP700, MP710, MP730, MP740, MP950, MP960, MX340, MX350,
    iP4000, MG5100
  - Canon BJC series printers using photo cartridge have printing modes
    added that will select this cartridge.
  - A crash with the EPSON Stylus Photo R3000 has been fixed.
  - Chinese (Mandarin), Galician, and Ukrainian translations have
    been added.
* debian/patches/0001-patch-stdio.h-is-required-by-commandtoepson-and-comm.patch:
  Removed, applied upstream.
* 0002-genppd-don-t-write-color-profile-information-with-br.patch: Refreshed
  with quilt.
* debian/printer-driver-gutenprint.ppd-updater,
  debian/foomatic-db-gutenprint.ppd-updater: Support also pre-releases with
  "-preX" version number extension.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 *   CANON BJ command filter for the Common UNIX Printing System.
3
 
 *
4
 
 *
5
 
 * Contents:
6
 
 *
7
 
 *   main() - Main entry and command processing.
8
 
 */
9
 
 
10
 
/*
11
 
 * Include necessary headers...
12
 
 */
13
 
 
14
 
#include <cups/cups.h>
15
 
#include <ctype.h>
16
 
#include <stdlib.h>
17
 
 
18
 
 
19
 
/*
20
 
 * Macros...
21
 
 */
22
 
 
23
 
#define pwrite(s,n) fwrite((s), 1, (n), stdout)
24
 
 
25
 
 
26
 
/*
27
 
 * 'main()' - Main entry and processing of driver.
28
 
 */
29
 
 
30
 
int                     /* O - Exit status */
31
 
main(int  argc,         /* I - Number of command-line arguments */
32
 
     char *argv[])      /* I - Command-line arguments */
33
 
{
34
 
  FILE  *fp;            /* Command file */
35
 
  char  line[1024],     /* Line from file */
36
 
        *lineptr;       /* Pointer into line */
37
 
  int   feedpage;       /* Feed the page */
38
 
 
39
 
 
40
 
 /*
41
 
  * Check for valid arguments...
42
 
  */
43
 
 
44
 
  if (argc < 6 || argc > 7)
45
 
  {
46
 
   /*
47
 
    * We don't have the correct number of arguments; write an error message
48
 
    * and return.
49
 
    */
50
 
 
51
 
    fputs("ERROR: commandtocanon job-id user title copies options [file]\n", stderr);
52
 
    return (1);
53
 
  }
54
 
 
55
 
 /*
56
 
  * Open the command file as needed...
57
 
  */
58
 
 
59
 
  if (argc == 7)
60
 
  {
61
 
    if ((fp = fopen(argv[6], "r")) == NULL)
62
 
    {
63
 
      perror("ERROR: Unable to open command file - ");
64
 
      return (1);
65
 
    }
66
 
  }
67
 
  else
68
 
    fp = stdin;
69
 
 
70
 
 /*
71
 
  * Reset the printer and initiate BJL mode
72
 
  */
73
 
 
74
 
  pwrite("\x1b\x5b\x4b\x02\x00\x00\x1f" "BJLSTART\x0a", 16);
75
 
  feedpage = 0;
76
 
 
77
 
 /*
78
 
  * Read the commands from the file and send the appropriate commands...
79
 
  */
80
 
 
81
 
  while (fgets(line, sizeof(line), fp) != NULL)
82
 
  {
83
 
   /*
84
 
    * Drop trailing newline...
85
 
    */
86
 
 
87
 
    lineptr = line + strlen(line) - 1;
88
 
    if (*lineptr == '\n')
89
 
      *lineptr = '\0';
90
 
 
91
 
   /*
92
 
    * Skip leading whitespace...
93
 
    */
94
 
 
95
 
    for (lineptr = line; isspace(*lineptr); lineptr ++);
96
 
 
97
 
   /*
98
 
    * Skip comments and blank lines...
99
 
    */
100
 
 
101
 
    if (*lineptr == '#' || !*lineptr)
102
 
      continue;
103
 
 
104
 
   /*
105
 
    * Parse the command...
106
 
    */
107
 
 
108
 
    if (strncasecmp(lineptr, "Clean", 5) == 0)
109
 
    {
110
 
     /*
111
 
      * Clean heads...
112
 
      */
113
 
 
114
 
      char *what;
115
 
 
116
 
      for (what = lineptr + 6; isspace(*what); what ++);
117
 
 
118
 
      if (*what == 0)                   pwrite("@Cleaning=1ALL\x0a", 15);
119
 
      if (!strncasecmp(what,"all",3))   pwrite("@Cleaning=1ALL\x0a", 15);
120
 
      if (!strncasecmp(what,"black",5)) pwrite("@Cleaning=1K\x0a", 13);
121
 
 
122
 
    }
123
 
    else if (strncasecmp(lineptr, "PrintAlignmentPage", 18) == 0)
124
 
    {
125
 
     /*
126
 
      * Print alignment page...
127
 
      */
128
 
 
129
 
      int phase;
130
 
 
131
 
      phase = atoi(lineptr + 18);
132
 
 
133
 
      if (phase==0) pwrite("@TestPrint=Auto\x0a", 16);
134
 
      if (phase==1) pwrite("@TestPrint=Manual1\x0a", 19);
135
 
      if (phase==2) pwrite("@TestPrint=Manual2\x0a", 19);
136
 
 
137
 
      feedpage = 0;
138
 
    }
139
 
    else if (strncasecmp(lineptr, "PrintSelfTestPage", 17) == 0)
140
 
    {
141
 
     /*
142
 
      * Print version info and nozzle check...
143
 
      */
144
 
 
145
 
      pwrite("@TestPrint=NozzleCheck\x0a", 23);
146
 
 
147
 
      feedpage = 0;
148
 
    }
149
 
    else if (strncasecmp(lineptr, "ReportLevels", 12) == 0)
150
 
    {
151
 
     /*
152
 
      * Report ink levels...
153
 
      */
154
 
 
155
 
    }
156
 
    else if (strncasecmp(lineptr, "SetAlignment", 12) == 0)
157
 
    {
158
 
     /*
159
 
      * Set head alignment...
160
 
      */
161
 
 
162
 
    }
163
 
    else
164
 
      fprintf(stderr, "ERROR: Invalid printer command \"%s\"!\n", lineptr);
165
 
  }
166
 
 
167
 
 /*
168
 
  * Exit remote mode...
169
 
  */
170
 
 
171
 
  pwrite("BJLEND\x0a", 7);
172
 
 
173
 
 /*
174
 
  * Eject the page as needed...
175
 
  */
176
 
 
177
 
  if (feedpage)
178
 
  {
179
 
    putchar(13);
180
 
    putchar(10);
181
 
    putchar(12);
182
 
  }
183
 
 
184
 
 /*
185
 
  * Close the command file and return...
186
 
  */
187
 
 
188
 
  if (fp != stdin)
189
 
    fclose(fp);
190
 
 
191
 
  return (0);
192
 
}
193
 
 
194
 
 
195
 
/*
196
 
 */