OSDN Git Service

Unnecessary require was erased from the spec file.
[lxcf/lxcf.git] / lxcf / lib / lxcf-parmchk-float
1 #!/usr/bin/python
2 # copyright (C) 2013 FUJITSU LIMITED All Rights Reserved
3
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; version 2
7 # of the License.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 # 02110-1301, USA.
18
19 # -*- coding: utf-8 -*-
20
21 import sys
22 from optparse import OptionParser
23
24 parser = OptionParser()
25
26 (options, args) = parser.parse_args(sys.argv)
27
28 argc = len(args)
29
30 if (argc != 2):
31     print "usage : lxcf-parmchk-float val"
32     quit()
33
34 parm = args[1]
35
36 if (parm == '-'):
37     exit(0)
38
39 f = 0
40 d1 = 0
41 d2 = 0
42 for c in parm:
43     if (f == 0) and (c == '.'):
44         f = 1
45         continue
46
47     if c.isdigit():
48         if f == 1:
49             d2 = 1
50         else:
51             d1 = 1
52         continue
53     else:
54         exit(1)
55
56 exit(0)