mirror of
git://projects.qi-hardware.com/kicad-libs.git
synced 2024-11-25 20:30:16 +02:00
45 lines
779 B
Bash
Executable File
45 lines
779 B
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# dcm2desc - Convert .dcm files to genex descriptions
|
|
#
|
|
# Copyright 2012 by Werner Almesberger
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
|
|
|
|
usage()
|
|
{
|
|
echo "usage: $0 [-L libdir ...] [-l lib ...]" 1>&2
|
|
exit 1
|
|
}
|
|
|
|
|
|
scan_dcm()
|
|
{
|
|
for n in "$@"; do
|
|
sed -e '/^\$CMP /{s///;x;}' \
|
|
-e '/^[DKF] /{s///;x;G;s/\n/: /;p;s/: .*//;x;}' \
|
|
-e d <"$n"
|
|
done
|
|
}
|
|
|
|
|
|
while [ "$1" ]; do
|
|
case "$1" in
|
|
-L) shift
|
|
[ "`echo \"$1\"/*.dcm`" != "$1/*.dcm" ] &&
|
|
scan_dcm "$1"/*.dcm;;
|
|
-l) shift
|
|
scan_dcm "$1";;
|
|
-*) usage;;
|
|
*) usage;;
|
|
esac
|
|
shift
|
|
done
|
|
|
|
exit 0
|