Add a function to a program, and call that function from the command line in the function

Add a function to a program, and call that function from the command line in the function

I have to add a custom function which shows currently running foreground and background processes launched by this shell. How do I define and call that function from the shell’s command line?
#include “smallsh.h” /*include file for example*/

/*program buffers and work pointers*/
static char inpbuf[MAXBUF], tokbuf[2*MAXBUF],
*ptr = inpbuf, *tok = tokbuf;

userin(p) /*print prompt and read a line*/
char *p;
{

int c, count;

/*initialization for later routines*/
ptr = inpbuf;
tok = tokbuf;

/*display prompt*/
printf(“%s “,p);

for(count = 0;;)
{
if((c = getchar()) == EOF)
return(EOF);

if(count

if(narg