/****************************************************************************
- * Copyright 2020 Thomas E. Dickey *
+ * Copyright 2020,2021 Thomas E. Dickey *
* Copyright 1998-2012,2015 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
#include "menu.priv.h"
-MODULE_ID("$Id: m_req_name.c,v 1.25 2020/05/24 01:40:20 anonymous.maarten Exp $")
+MODULE_ID("$Id: m_req_name.c,v 1.27 2021/06/17 21:11:08 tom Exp $")
#define DATA(s) { s }
#define A_SIZE (sizeof(request_names)/sizeof(request_names[0]))
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : const char * menu_request_name (int request);
-|
+|
| Description : Get the external name of a menu request.
|
| Return Values : Pointer to name - on success
}
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : int menu_request_by_name (const char *str);
-|
+|
| Description : Search for a request with this name.
|
| Return Values : Request Id - on success
to run sequentially through it.
*/
size_t i = 0;
- char buf[16];
T((T_CALLED("menu_request_by_name(%s)"), _nc_visbuf(str)));
if (str != 0 && (i = strlen(str)) != 0)
{
+ char buf[16];
+
if (i > sizeof(buf) - 2)
i = sizeof(buf) - 2;
memcpy(buf, str, i);