All pastes #192414 Raw Edit

Unnamed

public c v1 · immutable
·published 2006-10-05 22:26 UTC
rendered paste body
#include <stdio.h>#define NBR_ESPACES 8 void str_decal (unsigned char ligne[], int col, int decal);int main (void){	unsigned char ligne[512];	int col = 0, i, j, chars = 1, c;	while ((c = getchar ()) != -1)	{		ligne[col] = c;		i = 0;		if (c == 10)		{			ligne[col] = '\0';			while (ligne[i] != '\0')			{				if (ligne[i] == '\t')				{					chars = NBR_ESPACES - (chars % NBR_ESPACES);					str_decal (ligne, i, chars);					for (j = i; j <= i + chars; j++)						ligne[j] = ' ';										chars = 1;				}				else					chars++;				i++;							}			printf ("%s\n", ligne);			col = -1;			chars = 1;		}		col++;	}	return 0;}void str_decal (unsigned char ligne[], int col, int decal){	unsigned char copie[512];	int i = col;	while (ligne[i] != '\0')	{				copie[i - col] = ligne[i];		i++;	}	copie[i - col] = '\0';	i = col;	while (copie[i - col] != '\0')	{		ligne[i + decal] = copie[i - col];		i++;	}	ligne[i + decal] = '\0';}