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.
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; }
Notes et références
Voir aussi
Articles connexes Projet GNU Style d'indentation astyle
Lien externe Page officielle
Catégorie:Logiciel libre sous licence GPL Catégorie:Outil de développement logiciel Catégorie:Logiciel pour Unix Catégorie:Logiciel du projet GNU