From 540db0b3e7e829e71c4c32a4bcc44d4d0addcfb7 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 20 Nov 2014 01:54:12 -0600 Subject: Add very early support for compressed PPDs to make_driver_db_cups This relates to Bug 2191 --- tdeprint/driverparse.c | 43 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 8 deletions(-) (limited to 'tdeprint/driverparse.c') diff --git a/tdeprint/driverparse.c b/tdeprint/driverparse.c index 2b7a93d60..8d850b837 100644 --- a/tdeprint/driverparse.c +++ b/tdeprint/driverparse.c @@ -1,3 +1,23 @@ +/* + * This file is part of the KDE libraries + * Copyright (c) 2001 Michael Goffioul + * Copyright (c) 2014 Timothy Pearson + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License version 2 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + **/ + #include "driverparse.h" #include @@ -9,15 +29,16 @@ #include char **files = NULL; +char **fileorigins = NULL; int nfiles = 0, maxfiles = 0; int nhandlers = 0, maxhandlers = 0; int nlibs = 0, maxlibs = 0; typedef struct { void (*init)(const char*); - int (*parse)(const char*, FILE*); + int (*parse)(const char*, const char*, FILE*); char *name; - int namelen; + int namelen; } handler; handler **handlers = NULL; void **libs = NULL; @@ -39,7 +60,7 @@ void freeHandlers(void) free(handlers); } -void registerHandler(const char *name, void(*initf)(const char*), int(*parsef)(const char*, FILE*)) +void registerHandler(const char *name, void(*initf)(const char*), int(*parsef)(const char*, const char*, FILE*)) { handler *h = (handler*)malloc(sizeof(handler)); h->init = initf; @@ -88,6 +109,7 @@ void initFiles(void) { maxfiles = 100; files = (char**)malloc(sizeof(char*) * maxfiles); + fileorigins = (char**)malloc(sizeof(char*) * maxfiles); } void freeFiles(void) @@ -95,7 +117,9 @@ void freeFiles(void) int i; for (i=0; iname, handlers[hi]->namelen) == 0) { - handlers[hi]->parse(files[i]+handlers[hi]->namelen, dbFile); + handlers[hi]->parse(files[i]+handlers[hi]->namelen, fileorigins[i], dbFile); break; } fprintf(stdout, "%d\n", i); -- cgit v1.2.1