delete.c (6c0f70db) | delete.c (fa6d473e) |
---|---|
1/* 2 * Copyright 2016-2017, 2021 Hugh McMaster 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 2.1 of the License, or (at your option) any later version. 8 * --- 104 unchanged lines hidden (view full) --- 113 BOOL value_all = FALSE, value_empty = FALSE, force = FALSE; 114 int i; 115 116 if (!parse_registry_key(argvW[2], &root, &path, &key_name)) 117 return 1; 118 119 for (i = 3; i < argc; i++) 120 { | 1/* 2 * Copyright 2016-2017, 2021 Hugh McMaster 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 2.1 of the License, or (at your option) any later version. 8 * --- 104 unchanged lines hidden (view full) --- 113 BOOL value_all = FALSE, value_empty = FALSE, force = FALSE; 114 int i; 115 116 if (!parse_registry_key(argvW[2], &root, &path, &key_name)) 117 return 1; 118 119 for (i = 3; i < argc; i++) 120 { |
121 if (argvW[i][0] == '/' || argvW[i][0] == '-') | 121 WCHAR *str; 122 123 if (argvW[i][0] != '/' && argvW[i][0] != '-') 124 goto invalid; 125 126 str = &argvW[i][1]; 127 128 if (!lstrcmpiW(str, L"va")) |
122 { | 129 { |
123 WCHAR *str = &argvW[i][1]; | 130 if (value_all) goto invalid; 131 value_all = TRUE; 132 continue; 133 } 134 else if (!lstrcmpiW(str, L"ve")) 135 { 136 if (value_empty) goto invalid; 137 value_empty = TRUE; 138 continue; 139 } 140 else if (!str[0] || str[1]) 141 goto invalid; |
124 | 142 |
125 if (!lstrcmpiW(str, L"va")) 126 { 127 if (value_all) goto invalid; 128 value_all = TRUE; 129 continue; 130 } 131 else if (!lstrcmpiW(str, L"ve")) 132 { 133 if (value_empty) goto invalid; 134 value_empty = TRUE; 135 continue; 136 } 137 else if (!str[0] || str[1]) | 143 switch (towlower(*str)) 144 { 145 case 'v': 146 if (value_name || !(value_name = argvW[++i])) |
138 goto invalid; | 147 goto invalid; |
139 140 switch (towlower(*str)) 141 { 142 case 'v': 143 if (value_name || !(value_name = argvW[++i])) 144 goto invalid; 145 break; 146 case 'f': 147 if (force) goto invalid; 148 force = TRUE; 149 break; 150 default: 151 goto invalid; 152 } | 148 break; 149 case 'f': 150 if (force) goto invalid; 151 force = TRUE; 152 break; 153 default: 154 goto invalid; |
153 } 154 } 155 156 if ((value_name && value_empty) || (value_name && value_all) || (value_empty && value_all)) 157 goto invalid; 158 159 return run_delete(root, path, key_name, value_name, value_empty, value_all, force); 160 161invalid: 162 output_message(STRING_INVALID_CMDLINE); 163 return 1; 164} | 155 } 156 } 157 158 if ((value_name && value_empty) || (value_name && value_all) || (value_empty && value_all)) 159 goto invalid; 160 161 return run_delete(root, path, key_name, value_name, value_empty, value_all, force); 162 163invalid: 164 output_message(STRING_INVALID_CMDLINE); 165 return 1; 166} |