Indent
programme de formatage de code source
From Wikipedia, the free encyclopedia
indent est un logiciel libre de mise en forme de codes sources en langage C. Il modifie l'apparence d'un fichier source en ajoutant ou supprimant des espaces et des retours à la ligne.
Créateur
Jim Kingdon (d)
Dernière version
2.2.13 ()[2],[3]
indent
| Créateur | Jim Kingdon (d) |
|---|---|
| Développé par | Projet GNU |
| Première version | [1] |
| Dernière version | 2.2.13 ()[2],[3] |
| Dépôt | git.savannah.gnu.org/cgit/indent.git |
| Système d'exploitation | GNU/Linux, BSD et macOS |
| Environnement | UNIX, BSD, GNU/Linux |
| Langues | Anglais uniquement |
| Type | Indentation |
| Licence | GNU GPL |
| Site web | www.gnu.org/software/indent |
indent fait partie du projet GNU, Il est distribué selon les termes de la licence GNU GPL.
Exemple
On souhaite indenter le fichier suivant :
/* exemple à indenter */
#include <stdio.h>
int main(void)
{
char msg[] = "hello world\n";
char * end = msg + sizeof (msg);
char * cur;
for(cur = msg; cur != end; ++cur) { putchar(*cur); }
return 0;
}
Avec les paramètres par défaut, on obtient le style GNU:
#include <stdio.h>
int
main (void)
{
char msg[] = "hello world\n";
char *end = msg + sizeof (msg);
char *cur;
for (cur = msg; cur != end; ++cur)
{
putchar (*cur);
}
return 0;
}
Avec l'option -kr (pour "Kernighan and Ritchie"), on obtient :
#include <stdio.h>
int main(void)
{
char msg[] = "hello world\n";
char *end = msg + sizeof(msg);
char *cur;
for (cur = msg; cur != end; ++cur) {
putchar(*cur);
}
return 0;
}
