A program to show the file pointed to by a symlink

#include<unistd.h>
#include<stdio.h>
#include<malloc.h>

int tracelink(char *filename)
{
	char *buffer=malloc(1024);
	long a;
	
	a=readlink(filename,buffer,1023);
	if(a<0)
	{
		printf("An error occured\n");
		return -1;
	}
	else
	{
		printf("%s\n",buffer);
		return 0;
	}
}

int main(int argc,char **argv)
{
	if(argc==1)
	{
		printf("Specify the symlink as an argument\n");
	}
	else
	{
		tracelink(argv[1]);
	}
	return 0;
}

A program to list a directories' contents along with their size

#include<unistd.h>
#include<sys/types.h>
#include<sys/dir.h>
#include<sys/stat.h>

#include<string.h>
#include<malloc.h>

int listdir(char *dname);
int main(int argc,char **argv)
{
	int i;
	char **dirs;
	
	if(argc==1)
	{
		listdir(".");
	}
	else
	{
		for(i=1;i<argc;i++)
		{
			listdir(argv[i]);
		}
	}
	return 0;
}

A program to find total and free memory

#include<stdio.h>
#include<malloc.h>
int main()
{
	FILE *fp = fopen("/proc/meminfo","r");
	long mb;
	char *token=malloc(40);
	
	fscanf(fp,"%s",token);
	fscanf(fp,"%s",token);
	mb=atol(token,10)/1024;
	printf("Total memory = %ld MB\n",mb);
	
	fscanf(fp,"%s %s",token,token);
	fscanf(fp,"%s",token);
	mb=atol(token,10)/1024;
	printf("Free memory = %ld MB\n",mb);
	
	fclose(fp);
	
	return 0;
}

Summer training 2010 started

We started Summer training 2010 on #dgplug , you can get the details here.

badam-halwa-of-embedded-systems

The Badam Halwa of Embedded Systems is an introductory presentation to address basic concepts in systems programming for newbies.

Summer Training 2009 started

We started Summer Training 2009. IRC logs can be found here.

Can you join us in #dgplug on  irc.freenode,net

Paul W. Frields is going to talk on Fedora Docs

Paul W. Frields, the fearless Fedora Project Leader and long time contributor to the Fedora Docs project, is going to conduct a session on Fedora Docs as part of dgplug’s summer training.

files

what does the file /etc/fstab contain??

is it something related to disk quotas..???

need info for ccna course and exam

i want to do CCNA. i live in kolkata. Now a senior dada did ccna from iiht nearly 2 years ago . so i went to the address given by him (at exide more near rabindra sadan metro station) but found it was actually IIJT infotech . Upon meeting the senior counsillor she said they were previous iiht and now they have changed their course to be more job-oriented. after cross-checking with my senior it was found he had also known her as she was there in his time too.
Syndicate content