summaryrefslogtreecommitdiff
path: root/cad/gnetlist/patches/patch-ab
blob: 44d9af9d6729078854d9aa15ed1b5daf0e2ba117 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
$NetBSD: patch-ab,v 1.3 2002/05/31 15:51:44 dmcmahill Exp $

use sh(1) and awk(1) not bash(1) and gawk(1).  Also use short options for
head(1) and tail(1).

--- src/gschem2pcb.orig	Fri Apr 21 16:48:38 2000
+++ src/gschem2pcb
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 # 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
@@ -43,7 +43,7 @@
 	fi
 
 # Search for the beginning of the filename assuming it ends by .sch
-FILENAME=`echo "$1" | sed 's/.sch//g' -`
+FILENAME=`echo "$1" | sed 's/.sch//g' `
 PCBFILENAME=$FILENAME.pcb
 
 # test if a .pcb file exists
@@ -59,7 +59,7 @@
 	gnetlist -g PCB -o $NETFILENAME $1  
 	gnetlist -g PCBboard -o $PCBTEMPFILENAME $1 
 	echo
-	gawk 'BEGIN {FS=","}
+	awk 'BEGIN {FS=","}
 		/^PKG_*/{
 		footprint=$1
 		sub(/PKG_/,"",footprint)
@@ -68,23 +68,23 @@
 		value=substr($3,0,length($3)-1)
 		printf("Error: the footprint %s for the device %s does not exist\n",footprint,$2,value)
 		}' $PCBTEMPFILENAME
-	gawk '/^Element\(.*/{printf("%s\t%s\t\n",$3,$4)}' $PCBFILENAME|sort > $LISTFILE
-	gawk '/^Element\(.*/{printf("%s\t%s\t\n",$3,$4)}' $PCBTEMPFILENAME|sort > $NEWLISTFILE
-	UREF=`diff $NEWLISTFILE $LISTFILE | gawk '/</{printf("%s\n",$2)}' -`
+	awk '/^Element\(.*/{printf("%s\t%s\t\n",$3,$4)}' $PCBFILENAME|sort > $LISTFILE
+	awk '/^Element\(.*/{printf("%s\t%s\t\n",$3,$4)}' $PCBTEMPFILENAME|sort > $NEWLISTFILE
+	UREF=`diff $NEWLISTFILE $LISTFILE | awk '/</{printf("%s\n",$2)}' -`
 	#Search for UREF if $PCBTEMPFILENAME and create $PCBNEWFILENAME
 	#Header of the pcb file
-	head --lines 5 $PCBTEMPFILENAME > $PCBNEWFILENAME
+	head -n 5 $PCBTEMPFILENAME > $PCBNEWFILENAME
 	for f in `echo $UREF`; do
 		echo "Find new element $f"
-		LINE=`grep -n $f $PCBTEMPFILENAME|sed 's/:.*$//g' -`
-		gawk -v line=$LINE '{if (NR>=line)
+		LINE=`grep -n $f $PCBTEMPFILENAME|sed 's/:.*$//g' `
+		awk -v line=$LINE '{if (NR>=line)
 					{print
 					if ($1==")") exit}
 					}' $PCBTEMPFILENAME >> $PCBNEWFILENAME
 					
 	done
 	# End of the pcb file
-	tail --lines 24 $PCBTEMPFILENAME >> $PCBNEWFILENAME
+	tail -n 24 $PCBTEMPFILENAME >> $PCBNEWFILENAME
 	
 	# Un peu de ménage (in french in the texte)
 	rm $PCBTEMPFILENAME $NEWLISTFILE $LISTFILE
@@ -96,7 +96,7 @@
 	gnetlist -g PCB -o $NETFILENAME $1 
 	gnetlist -g PCBboard -o $PCBFILENAME $1 
 	# Test if a footprint has not been found
-	gawk 'BEGIN {FS=","}
+	awk 'BEGIN {FS=","}
 		/^PKG_*/{
 		footprint=$1
 		sub(/PKG_/,"",footprint)