* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
****************************************************************************/
/****************************************************************************
****************************************************************************/
/****************************************************************************
****************************************************************************/
/***************************************************************************
****************************************************************************/
/***************************************************************************
#define A_SIZE (sizeof(request_names)/sizeof(request_names[0]))
/*---------------------------------------------------------------------------
#define A_SIZE (sizeof(request_names)/sizeof(request_names[0]))
/*---------------------------------------------------------------------------
| Return Values : Pointer to name - on success
| NULL - on invalid request code
+--------------------------------------------------------------------------*/
| Return Values : Pointer to name - on success
| NULL - on invalid request code
+--------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------
| Facility : libnmenu
| Function : int menu_request_by_name (const char *str);
/*---------------------------------------------------------------------------
| Facility : libnmenu
| Function : int menu_request_by_name (const char *str);
| Return Values : Request Id - on success
| E_NO_MATCH - request not found
+--------------------------------------------------------------------------*/
| Return Values : Request Id - on success
| E_NO_MATCH - request not found
+--------------------------------------------------------------------------*/
/* because the table is so small, it doesn't really hurt
to run sequentially through it.
/* because the table is so small, it doesn't really hurt
to run sequentially through it.
- strncpy(buf,str,sizeof(buf));
- while( (i<sizeof(buf)) && (buf[i] != '\0') )
+ strncpy(buf, str, sizeof(buf));
+ while ((i < sizeof(buf)) && (buf[i] != '\0'))
- if (strncmp(request_names[i],buf,sizeof(buf))==0)
- return MIN_MENU_COMMAND + i;
- }
+ if (strncmp(request_names[i], buf, sizeof(buf)) == 0)
+ returnCode(MIN_MENU_COMMAND + (int)i);
+ }