Tous les collages #1410979 Brut Modifier

Shriphani Palakodety

public c v1 · immuable
#1410979 ·publié 2009-05-03 06:31 UTC
corps du collage affiché
#include<stdio.h>char **split(char *string){	//return a string split at the space		char *output[9];	int i = 0;		int j = 0;	while (i < 9)	{		if (*string == ' ' || *string == '\t')		{			string++;		}		else if (*string != ' ' && *string != '\t')		{			output[i] = string;			i++;			while (*string != ' ' && *string != '\t')			{				string++;			}		}	}	return output;}char *getline(){	char buf[1000];	char readChar='a';	int i, j = 0;	while ((i = read(0, &(readChar), 1)) > 0)	{		if (readChar == '\n')		{			buf[j] = '\0';			j = 0;			return buf;		}		buf[j++] = readChar;	}	if (i == 0)		return NULL;}		main(){	char *line = getline();	line = getline();	int i = 0;	while(line != NULL)	{	if (split(line)[0][7] == 'r')	{		printf("%s is readable by everyone\n",split(line)[8]);		i++;	}	line = getline();	}	printf("%d file listings\n",i);}