Projet

Général

Profil

Paste
Télécharger au format
Statistiques
| Branche: | Révision:

root / plugins / disk / smart-c / common.h @ 64089240

Historique | Voir | Annoter | Télécharger (1,51 ko)

1
/*
2
 * Copyright (C) 2008 Helmut Grohne <helmut@subdivi.de> - All rights reserved.
3
 *
4
 * This copyrighted material is made available to anyone wishing to use,
5
 * modify, copy, or redistribute it subject to the terms and conditions
6
 * of the GNU General Public License v.2 or v.3.
7
 */
8
#ifndef COMMON_H
9
#define COMMON_H
10

    
11
#define PROC_STAT "/proc/stat"
12

    
13
/** Write yes to stdout and return 0. The intended use is give an autoconf
14
 * response like "return writeyes();".
15
 * @returns a success state to be passed on as the return value from main */
16
int writeyes(void);
17

    
18
/** Answer an autoconf request by checking the readability of the given file.
19
 */
20
int autoconf_check_readable(const char *);
21

    
22
/** Obtain an integer value from the environment. In the absence of the
23
 * variable the given defaultvalue is returned.  */
24
int getenvint(const char *, int defaultvalue);
25

    
26
/** Print a name.warning line using the "name_warning" or "warning" environment
27
 * variables. */
28
void print_warning(const char *name);
29

    
30
/** Print a name.critical line using the "name_critical" or "critical"
31
 * environment variables. */
32
void print_critical(const char *name);
33

    
34
/** Print both name.warning and name.critical lines using environment
35
 * variables. */
36
void print_warncrit(const char *name);
37

    
38
/** Fail by printing the given message and a newline to stderr.
39
 * @returns a failure state to be passed on as the return value from main */
40
int fail(const char *message);
41

    
42
#define xisspace(x) isspace((int)(unsigned char) x)
43
#define xisdigit(x) isdigit((int)(unsigned char) x)
44

    
45
#endif