Fixed a long-standing error that had gone unnoticed that prevents

the use of "property list <key>" to return NULL if <key> is
undefined, instead of printing an error message that cannot be
suppressed.  Scripts which wish to test whether or not a bounding
box exists will of course want the "quiet" version of the command.
This commit is contained in:
R. Timothy Edwards 2026-03-11 16:35:52 -04:00
parent ee79bba5e4
commit 03bbc544b2
1 changed files with 17 additions and 3 deletions

View File

@ -2326,7 +2326,7 @@ CmdDoProperty(
{
PropertyRecord *proprec;
char *value;
bool propfound;
bool propfound, dolist;
int proptype, proplen, propvalue, i;
dlong dvalue;
int locargc = cmd->tx_argc - argstart + 1;
@ -2345,6 +2345,20 @@ CmdDoProperty(
"string", "integer", "dimension", "double", "plane", "compat", NULL
};
/* If the first keyword is "list", then set dolist and increment
* the starting argument position.
*/
dolist = FALSE;
if (locargc > 1)
{
if (!strcmp(cmd->tx_argv[argstart], "list"))
{
dolist = TRUE;
locargc--;
argstart++;
}
}
/* If a property type is given, parse it and then strip it from
* the arguments list.
*/
@ -2498,9 +2512,9 @@ CmdDoProperty(
#ifdef MAGIC_WRAPPER
/* If the command was "cellname list property ...", then */
/* just return NULL if the property was not found. */
if (strcmp(cmd->tx_argv[1], "list"))
if (!dolist)
#endif
TxError("Property name \"%s\" is not defined\n", cmd->tx_argv[1]);
TxError("Property name \"%s\" is not defined\n", cmd->tx_argv[argstart]);
}
}
else if (locargc >= 3)