~ubuntu-branches/ubuntu/utopic/gridengine/utopic

« back to all changes in this revision

Viewing changes to source/clients/qmon/util/ad2c

  • Committer: Bazaar Package Importer
  • Author(s): Mark Hymers
  • Date: 2008-06-25 22:36:13 UTC
  • Revision ID: james.westby@ubuntu.com-20080625223613-tvd9xlhuoct9kyhm
Tags: upstream-6.2~beta2
ImportĀ upstreamĀ versionĀ 6.2~beta2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
#
 
3
# ad2c : Convert app-defaults file to C strings decls.
 
4
#
 
5
# DESCRIPTION
 
6
#      Ad2c  converts  X  resource  files  into   C   declarations,
 
7
#      appropriate  for  inclusion as fallback resources.
 
8
#      It reads from the given files (or stdin if none  are  given)
 
9
#      and writes the C declarations to stdout.
 
10
 
11
# AUTHOR
 
12
#      George Ferguson, ferguson@cs.rochester.edu, 12 Nov 1990.
 
13
 
14
# DISCLAIMER
 
15
#      This software is provided as is with no  warranty  expressed
 
16
#      or  implied.  I hope you find it useful, but I won't be held
 
17
#      responsable for any damage that may occur from reading, com-
 
18
#      piling, installing or using it.
 
19
 
20
#      You are free to use any part of this  code  for  other  pur-
 
21
#      poses.  It  would  be nice if you could keep my name on some
 
22
#      part of whatever the final product is.
 
23
 
24
# CHANGE HISTORY
 
25
#       19 Mar 1991: gf
 
26
#               Made it self-contained.
 
27
#       6 Jan 1992: mycroft@gnu.ai.mit.edu (Charles Hannum)
 
28
#               Removed use of "-n" and ":read" label since Gnu and
 
29
#               IBM sed print pattern space on "n" command. Still works
 
30
#               with Sun sed, of course.
 
31
#       7 Jan 1992: matthew@sunpix.East.Sun.COM (Matthew Stier)
 
32
#               Escape quotes after escaping backslashes.
 
33
#       8 Jul 1992: Version 1.6
 
34
#       24 Feb 1994: david@ora.com (David Flanagan)
 
35
#               convert `!' comments to C-style comments.
 
36
#               output blank lines rather than deleting them.
 
37
#               this makes the output resemble the input a bit more.
 
38
#       30 May 1995: david@ora.com (David Flanagan)
 
39
#               an Xmt-specific change to comment out xmtRequires lines,
 
40
#               as suggested by Mike McGary.
 
41
#
 
42
 
 
43
 
 
44
# convert comments
 
45
 
 
46
# comment out xmtRequires lines, since we probably will run this script
 
47
# on those files too.  Only do this if the line is not \-terminated, since
 
48
# the multi-line case is too tricky and rare to bother handling correctly.
 
49
# Thanks to Mike McGary for this suggestion.
 
50
 
 
51
# ignore blanks
 
52
 
 
53
# escape backslash
 
54
 
 
55
# except the line continuation ones
 
56
 
 
57
# escape quotes
 
58
 
 
59
# add leading quote
 
60
 
 
61
# just like "read" only does not add leading quote
 
62
 
 
63
sed '
 
64
/^!$/ {
 
65
        s/^!$//
 
66
        b
 
67
}
 
68
/^!/ {
 
69
        s|^!\(.*\)|/\*\1 \*/|
 
70
        b
 
71
}
 
72
/xmtRequires:.*[^\\]$/ {
 
73
        s|^\(.*\)$|/\* \1 \*/|
 
74
        b
 
75
}
 
76
/^$/b
 
77
s/\\/\\\\/g
 
78
s/\\$//g
 
79
s/"/\\"/g
 
80
s/^/"/
 
81
: test
 
82
/\\$/b slash
 
83
s/$/",/
 
84
p
 
85
d
 
86
: slash
 
87
n
 
88
s/"/\\"/g
 
89
s/\\\\/\\/g
 
90
s/\\n/\\\\n/g
 
91
s/\\t/\\\\t/g
 
92
s/\\f/\\\\f/g
 
93
s/\\b/\\\\b/g
 
94
b test' "$@"