diff -r 000000000000 -r 2e3d3ce01487 openenvutils/commandshell/shell/test/src/cat.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/openenvutils/commandshell/shell/test/src/cat.c Tue Feb 02 10:12:00 2010 +0200 @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#include + +/** +* External command cat to display the contents of a file +*/ +int main(int *argc, char *argv[]) +{ + int ret=0; + int c; + FILE *fp; + printf("Cat external command\n"); + fp = fopen(*(argv+1), "r"); + if(!fp) + { + printf("File %s not found\n",*(argv+1)); + return 1; + } + while((c=fgetc(fp)) != EOF) + { + putchar(c); + } + fclose(fp); + return 0; +}