4 * Copyright 2012 Samsung Electronics Co., Ltd
6 * Licensed under the Flora License, Version 1.1 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://floralicense.org/license/
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
49 flag.StringVar(&indir, "d", "", "input drv directory")
50 flag.StringVar(&inopt, "q", "", "input opt file")
51 flag.StringVar(&outfile, "o", "stripped.drv", "output file")
52 flag.StringVar(&cpuprofile, "p", "", "write cpu profile to file")
53 flag.StringVar(&memprofile, "m", "", "write memory profile to this file")
54 flag.StringVar(&listopt, "l", "", "list available printers by model")
55 flag.StringVar(&listprod, "c", "", "list available printers by product")
56 flag.StringVar(&nameopt, "n", "", "print drv by model name")
57 flag.StringVar(&prodopt, "x", "", "print drv by product name")
64 drvm := drv.LoadDrvm(listopt)
70 drvm := drv.LoadDrvm(listprod)
75 f, err := os.Create(cpuprofile)
79 pprof.StartCPUProfile(f)
80 defer pprof.StopCPUProfile()
84 f, err := os.Create(memprofile)
88 pprof.WriteHeapProfile(f)
94 files, err := ioutil.ReadDir(indir)
99 for _, fp := range files {
101 fmt.Println("\nfile:", fn)
102 if !strings.HasSuffix(fn, ".ppd") { continue; }
103 fn = path.Join(indir, fn)
104 cmd := exec.Command("ppdi", "-o", "/tmp/tmp.drv", fn)
110 err = drvm.ExtendDrvm("/tmp/tmp.drv")
115 cmd = exec.Command("rm", "/tmp/tmp.drv")
119 drvm.SaveDrvm(outfile)