Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 2250 → Rev 2251

/branches/fs/uspace/cat/cat.c
0,0 → 1,42
/*
* Cat
*/
 
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <async.h>
#include <ipc/services.h>
#include "../fs/fs.h"
 
 
int main(int argc, char *argv[])
{
//Why does my console have no number?
printf("This is your cat! \n");
 
char * fname = "version";
char * buff = "012345678901234567890123456789012";
unsigned int file_handle;
 
int fs_phone;
 
fs_phone = ipc_connect_me_to(PHONE_NS, SERVICE_FS, 0);
while (fs_phone < 0) {
usleep(10000);
fs_phone = ipc_connect_me_to(PHONE_NS, SERVICE_FS, 0);
}
 
file_handle = async_req_2(fs_phone, FS_OPEN, (unsigned int) fname, 0, NULL, NULL);
 
printf("I got file handle %d \n",file_handle);
 
char * retval = (char * ) async_req_3(fs_phone, FS_READ, file_handle, (unsigned int) buff, 32, NULL, NULL, NULL);
 
printf("Data read: %d\n", retval);
 
return 0;
}