if line.startswith('#'):
continue
- if '{' in line:
+ if line.endswith('{'):
in_section = True
- elif '}' in line:
+ elif line.startswith('}'):
in_section = False
break
-
+
elif in_section:
m = re.search('ssid\s*=\s*"(.*?)"', line)
if m:
i += 1
continue
- if '{' in line:
+ if line.endswith('{'):
in_section = True
-
- elif '}' in line:
+
+ elif line.startswith('}'):
in_section = False
if enabled and ssid and not found_ssid:
lines.insert(i, ' ssid="' + ssid + '"\n')