Make a branch to make krunner Good Enough For Aaron™.
[kdebase/uwolfer.git] / workspace / ksysguard / ksysguardd / Command.h
blob16503e0cb227ccef4eb808c2461f9185aefe0138
1 /*
2 KSysGuard, the KDE System Guard
4 Copyright (c) 1999 - 2001 Chris Schlaeger <cs@kde.org>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 #include "ksysguardd.h"
24 #ifndef KSG_COMMAND_H
25 #define KSG_COMMAND_H
27 typedef void (*cmdExecutor)(const char*);
29 /**
30 Set this flag to '1' to request a rescan of the available sensors
31 in the front end.
33 extern int ReconfigureFlag;
35 /**
36 Has nearly the same meaning like the above flag ;)
38 extern int CheckSetupFlag;
40 /**
41 Delivers the error message to the front end.
43 void print_error( const char*, ... )
44 #ifdef __GNUC__
45 __attribute__ ( ( format ( printf, 1, 2 ) ) )
46 #endif
49 /**
50 Writes the error message to the syslog daemon.
52 void log_error( const char*, ... )
53 #ifdef __GNUC__
54 __attribute__ ( ( format ( printf, 1, 2 ) ) )
55 #endif
60 /**
61 Use this function to register a command with the name
62 @ref command and the function pointer @ref ex.
64 void registerCommand( const char* command, cmdExecutor ex );
66 /**
67 Use this function to remove a command with the name
68 @ref command.
70 void removeCommand( const char* command );
72 /**
73 Use this function to add a new monitior with the name @ref monitor
74 from the type @ref type.
75 @ref ex is a pointer to the function that is called to get a value
76 and @ref iq is a pointer to the function that returns information
77 about this monitor.
78 @ref sm is a parameter to the sensor module object that is passed by
79 the initXXX method.
81 void registerAnyMonitor( const char* monitor, const char* type, cmdExecutor ex,
82 cmdExecutor iq, struct SensorModul* sm, int isLegacy );
84 /**
85 Use this function to add a new monitior with the name @ref monitor
86 from the type @ref type.
87 It will be marked as non-legacy.
88 @ref ex is a pointer to the function that is called to get a value
89 and @ref iq is a pointer to the function that returns information
90 about this monitor.
91 @ref sm is a parameter to the sensor module object that is passed by
92 the initXXX method.
94 void registerMonitor( const char* monitor, const char* type, cmdExecutor ex,
95 cmdExecutor iq, struct SensorModul* sm );
97 /**
98 Use this function to add a new monitior with the name @ref monitor
99 from the type @ref type. This monitor will be flagged as legacy,
100 which will forbid it from being listed by the 'modules' command.
101 The command will continue to function normally otherwise.
102 @ref ex is a pointer to the function that is called to get a value
103 and @ref iq is a pointer to the function that returns information
104 about this monitor.
105 @ref sm is a parameter to the sensor module object that is passed by
106 the initXXX method.
108 void registerLegacyMonitor( const char* monitor, const char* type, cmdExecutor ex,
109 cmdExecutor iq, struct SensorModul* sm );
112 Use this function to remove the monitior with the name @ref monitor.
114 void removeMonitor( const char* monitor );
118 Internal usage.
120 void executeCommand( const char* command );
122 void initCommand( void );
123 void exitCommand( void );
125 void printMonitors( const char* cmd );
126 void printTest( const char* cmd );
128 void exQuit( const char* cmd );
130 #endif