Bash-Linux.com : Le SHELL pour les nuls

  Actuellement 46 lignes de commande disponibles
login as: root
root@213.186.33.18's password:
Last login: Thu Mar 11 20:17:20 2010 from 38.107.191.118
[root@bash-linux ~] # echo "Bienvenue sur Bash-Linux.com"_
 Manuel des commandes UNIX (man) Version anglaise

Indiquez la fonction :

Man Fmtmsg en anglais

fmtmsg(3) Linux Programmer's Manual fmtmsg(3)
 
NAME


fmtmsg - print formatted error messages
 
SYNOPSIS


#include int fmtmsg(long classification, const char *label, int severity, const char *text, const char *action, const char *tag);
 
DESCRIPTION


This function displays a message described by its parameters on the device(s) specified in the classification parameter. For messages writ- ten to stderr, the format depends on the MSGVERB environment variable. The label parameter identifies the source of the message. The string must consist of two colon separated parts where the first part has not more than 10 and the second part not more than 14 characters. The text parameter describes the condition of the error. The action parameter describes possible steps to recover from the error. If it is printed, it is prefixed by "TO FIX: ". The tag parameter is a reference to the online documentation where more information can be found. It should contain the label value and a unique identification number. Dummy parameters Each of the parameters can have a dummy value. The dummy classification value MM_NULLMC (0L) does not specify any output, so nothing is printed. The dummy severity value NO_SEV (0) says that no severity is supplied. The values MM_NULLLBL, MM_NULLTXT, MM_NULLACT, MM_NULLTAG are synonyms for ((char *) 0), the empty string, and MM_NULLSEV is a synonym for NO_SEV. The classification parameter The classification parameter is the sum of values describing 4 types of information. The first value defines the output channel. MM_PRINT Output to stderr. MM_CONSOLE Output to the system console. MM_PRINT | MM_CONSOLE Output to both. The second value is the source of the error: MM_HARD A hardware error occurred. MM_FIRM A firmware error occurred. MM_SOFT A software error occurred. The third value encodes the detector of the problem: MM_APPL It is detected by an application. MM_UTIL It is detected by a utility. MM_OPSYS It is detected by the operating system. The fourth value shows the severity of the incident: MM_RECOVER It is a recoverable error. MM_NRECOV It is a non-recoverable error. The severity parameter The severity parameter can take one of the following values: MM_NOSEV No severity is printed. MM_HALT This value is printed as HALT. MM_ERROR This value is printed as ERROR. MM_WARNING This value is printed as WARNING. MM_INFO This value is printed as INFO. The numeric values are between 0 and 4. Using addseverity() or the environment variable SEV_LEVEL you can add more levels and strings to print.
 
ENVIRONMENT


The environment variable MSGVERB ("message verbosity") can be used to suppress parts of the output to stderr. (It does not influence output to the console.) When this variable is defined, is non-NULL, and is a colon-separated list of valid keywords, then only the parts of the mes- sage corresponding to these keywords is printed. Valid keywords are "label", "severity", "text", "action" and "tag". The environment variable SEV_LEVEL can be used to introduce new sever- ity levels. By default, only the five severity levels described above are available. Any other numeric value would make fmtmsg() print noth- ing. If the user puts SEV_LEVEL with a format like SEV_LEVEL=[description[:description[:...]]] in the environment of the process before the first call to fmtmsg(), where each description is of the form severity-keyword,level,printstring then fmtmsg() will also accept the indicated values for the level (in addition to the standard levels 0-4), and use the indicated printstring when such a level occurs. The severity-keyword part is not used by fmtmsg() but it has to be present. The level part is a string representation of a number. The numeric value must be a number greater than 4. This value must be used in the severity parameter of fmtmsg() to select this class. It is not possible to overwrite any of the predefined classes. The printstring is the string printed when a message of this class is processed by fmtmsg().
 
RETURN VALUES


The function can return 4 values: MM_OK Everything went smooth. MM_NOTOK Complete failure. MM_NOMSG Error writing to stderr. MM_NOCON Error writing to the console.
 
CONFORMING TO


The functions fmtmsg() and addseverity(), and environment variables MSGVERB and SEV_LEVEL come from System V. The function fmtmsg() and the environment variable MSGVERB are described in POSIX.1-2001.
 
NOTES


System V and Unixware man pages tell us that these functions have been replaced by "pfmt() and addsev()" or by "pfmt(), vpfmt(), lfmt(), and vlfmt()", and will be removed later.
 
EXAMPLE


#include #include int main() { long class = MM_PRINT | MM_SOFT | MM_OPSYS | MM_RECOVER; int err; err = fmtmsg(class, "util-linux:mount", MM_ERROR, "unknown mount option", "See mount(8).", "util-linux:mount:017"); switch(err) { case MM_OK: break; case MM_NOTOK: printf("Nothing printed\n"); break; case MM_NOMSG: printf("Nothing printed to stderr\n"); break; case MM_NOCON: printf("No console output\n"); break; default: printf("Unknown error from fmtmsg()\n"); } return 0; } The output should be: util-linux:mount: ERROR: unknown mount option TO FIX: See mount(8). util-linux:mount:017 and after MSGVERB=text:action; export MSGVERB the output becomes: unknown mount option TO FIX: See mount(8).
 
SEE ALSO


addseverity(3), perror(3) 2003-11-01 fmtmsg(3)


 Dernières recherches
Man  en anglais Man fmtmsg en anglaisMan  en français Man fmtmsg en français
Man  en anglais Man sched_setscheduler en anglaisMan  en français Man sched_setscheduler en français
Man  en anglais Man forkpty en anglaisMan  en français Man forkpty en français
Man  en anglais Man rsync en anglaisMan  en français Man rsync en français
Man  en anglais Man pause en anglaisMan  en français Man pause en français
Man  en anglais Man remove en anglaisMan  en français Man remove en français
Man  en anglais Man inet_aton en anglaisMan  en français Man inet_aton en français
Man  en anglais Man sigprocmask en anglaisMan  en français Man sigprocmask en français
Man  en anglais Man mkfs en anglaisMan  en français Man mkfs en français
Man  en anglais Man split en anglaisMan  en français Man split en français
Man  en anglais Man malloc en anglaisMan  en français Man malloc en français
Man  en anglais Man fifo en anglaisMan  en français Man fifo en français
Man  en anglais Man touch en anglaisMan  en français Man touch en français
Man  en anglais Man pickup en anglaisMan  en français Man pickup en français
Man  en anglais Man date en anglaisMan  en français Man date en français

 Recherche

Dans ce moteur de recherche, vous pouvez taper directement votre besoin, en une phrase normale, humaine.
Exemple : vous cherchez comment remplacer un mot par un autre dans tous les fichiers d'un certain dossier. Vous pouvez écrire "Comment remplacer un mot par un autre dans tous les fichiers d'un dossier". Le moteur vous ramenera les résultats en fonction de leur pertinence.
Vous pouvez bien sûr ne chercher qu'un seul mot-clé, par exemple "find".
 Toutes les lignes de code
Par popularité
Par fonction
Recherche avancée
 Les logiciels SHELL/SSH
Putty
Astuces Bash
Faire du SHELL avec PHP!
 La doc officielle
Les man Linux en français
Les man Linux en anglais
 Proposer vos bash
Partagez vos lignes!
 Les requêtes
Déposer une requête
Voir/répondre à une requête
 Quelques sites interessants
Bons sites pour apprendre
 Rechercher