1 // $Id: parserpmdump.c,v 1.1 2003/09/29 22:01:57 ensc Exp $
3 // Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
4 // based on parserpmdump.cc by Jacques Gelinas
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2, or (at your option)
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 Litte utility to extract non config file from
22 an rpm --dump command.
31 int main (int argc, char *argv[])
33 int *tblen = alloca(argc * sizeof(int));
37 for (i=1; i<argc; i++) tblen[i] = strlen(argv[i]);
38 while (fgets(tmp,sizeof(tmp)-1,stdin)!=NULL){
40 // Check if the file is in an excluded directory
41 for (i=1; i<argc; i++){
42 if (strncmp(argv[i],tmp,tblen[i])==0) break;
46 int last = strlen(tmp)-1;
52 if (last >= 0 && tmp[last] == '\n') tmp[last] = '\0';
56 while (*pt > ' ') pt++;
57 if (*pt == ' ') *pt++ = '\0';
59 sscanf(start,"%o",&mode);
66 if (S_ISREG(mode) && type == 0) printf ("%s\n",tmp);