Add 3.15.6 example app (for compilation tests)

This commit is contained in:
Ralph Lange
2019-11-20 10:06:53 +01:00
parent 7634107dfb
commit 064b4d3998
30 changed files with 1023 additions and 0 deletions

View 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);