FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
exitCli.c
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
8 /********************************************************************
9  * Copyright:
10  * GSI, Gesellschaft fuer Schwerionenforschung mbH
11  * Planckstr. 1
12  * D-64291 Darmstadt
13  * Germany
14  ********************************************************************
15  * exitCli.c
16  * handles CTL C in ROOT clients of remote event server
17  * created 12. 3.1999 by Horst Goeringer
18  *
19  * 22. 4.1999, H.G.: close TCP connection in client, not here
20  * 10. 6.1999, H.G.: call sleep only if required
21  ********************************************************************
22  */
23 #include <stdio.h> // for printf
24 #include <unistd.h> // for sleep
25 
26 extern int imySig;
27 extern int iTimeOut;
28 extern int iOutMode;
29 
30 void exitCli() /* handles Ctl C */
31 {
32  // int iRC;
33  int iSleep; /* sleep time here */
34  int iSocket;
35  // int iMode = 2;
36  // char cMsg[128] = "";
37 
38  iSocket = imySig;
39  imySig = -1;
40  iSleep = iTimeOut;
41 
42  printf("\n-I- user specified CTL C: ");
43 
44  if (iSocket > 0) {
45  if (iOutMode) {
46  printf("close connection (socket %d), hold client for %d s\n", iSocket, iSleep);
47  } else {
48  printf("close connection\n");
49  }
50 
51  if (iSleep) {
52  sleep(iSleep);
53  }
54  } else {
55  printf("\n");
56  }
57 } /* exitCli */
void exitCli()
Definition: exitCli.c:30
int iOutMode
Definition: MRevBuffer.cxx:73
int imySig
Definition: MRevBuffer.cxx:72
int iTimeOut
Definition: MRevBuffer.cxx:71