This is Unofficial EPICS BASE Doxygen Site
caRepeater.cpp File Reference
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "epicsAssert.h"
#include "osiUnistd.h"
#include "epicsGetopt.h"
#include "udpiiu.h"
+ Include dependency graph for caRepeater.cpp:

Go to the source code of this file.

Macros

#define epicsAssertAuthor   "Jeff Hill johill@lanl.gov"
 
#define CAN_DETACH_STDINOUT
 

Functions

int main (int argc, char *argv[])
 

Macro Definition Documentation

#define CAN_DETACH_STDINOUT

Definition at line 39 of file caRepeater.cpp.

#define epicsAssertAuthor   "Jeff Hill johill@lanl.gov"

Definition at line 31 of file caRepeater.cpp.

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 56 of file caRepeater.cpp.

57 {
58  bool detachinout = true;
59 
60  int opt;
61  while ((opt = getopt(argc, argv, "hv")) != -1) {
62  switch (opt) {
63  default:
64  usage(argv);
65  fprintf(stderr, "\nUnknown argument '%c'\n", opt);
66  return 1;
67  case 'h':
68  usage(argv);
69  return 0;
70  case 'v':
71  detachinout = false;
72  break;
73  }
74  }
75 
76 #ifdef CAN_DETACH_STDINOUT
77  if(detachinout) {
78  int readfd = open("/dev/null", O_RDONLY);
79  int writefd = open("/dev/null", O_WRONLY);
80 
81  dup2(readfd, 0);
82  dup2(writefd, 1);
83  dup2(writefd, 2);
84 
85  close(readfd);
86  close(writefd);
87  }
88 #else
89  (void)detachinout;
90 #endif
91 
92  chdir ( "/" );
93  ca_repeater ();
94  return ( 0 );
95 }
int getopt(int nargc, char *const *nargv, const char *ostr)
Definition: epicsGetopt.c:65
void ca_repeater()
Definition: repeater.cpp:482
#define stderr
Definition: epicsStdio.h:32