Add 3.15.6 example app (for compilation tests)
This commit is contained in:
31
exampleApp/src/exampleHello.c
Normal file
31
exampleApp/src/exampleHello.c
Normal file
@@ -0,0 +1,31 @@
|
||||
/* Example showing how to register a new command with iocsh */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <epicsExport.h>
|
||||
#include <iocsh.h>
|
||||
|
||||
/* This is the command, which the vxWorks shell will call directly */
|
||||
void hello(const char *name) {
|
||||
if (name) {
|
||||
printf("Hello %s, from example\n", name);
|
||||
} else {
|
||||
puts("Hello from example");
|
||||
}
|
||||
}
|
||||
|
||||
/* Information needed by iocsh */
|
||||
static const iocshArg helloArg0 = {"name", iocshArgString};
|
||||
static const iocshArg *helloArgs[] = {&helloArg0};
|
||||
static const iocshFuncDef helloFuncDef = {"hello", 1, helloArgs};
|
||||
|
||||
/* Wrapper called by iocsh, selects the argument types that hello needs */
|
||||
static void helloCallFunc(const iocshArgBuf *args) {
|
||||
hello(args[0].sval);
|
||||
}
|
||||
|
||||
/* Registration routine, runs at startup */
|
||||
static void helloRegister(void) {
|
||||
iocshRegister(&helloFuncDef, helloCallFunc);
|
||||
}
|
||||
epicsExportRegistrar(helloRegister);
|
||||
Reference in New Issue
Block a user