Indian Gnu/Linux User Group [ILUG-HUBLI] Get Thunderbird!
Home arrow Blog
Thursday, 20 November 2008
 
 
Newsflash
A blog of all section with no images
Overview of the ten major Linux distributions PDF Print E-mail
Written by Administrator   
Wednesday, 07 June 2006
A review of the 10 major Linux distributions out there, giving the pros and cons of each and every one of them Courtesy by Clement Lefebvre @ LinuxForums.org Introduction The Microsoft Windows operating system is developed and released by a single company. It comes with a minimal set of applications (a calculator, a few games, some networking tools, an Internet browser.. etc). Other software can be obtained by users from various sources and installed on the operating system. GNU/Linux is different. A GNU/Linux operating system is made of a Linux kernel, a set of GNU tools, an installation program, a package management system and a lot of other software components. Because all these components are free to use and to distribute, anybody can assemble and configure them according to their needs and create their very own GNU/Linux operating system. Since 1993, a lot of people and companies have been distributing Linux operating systems. These distributions made it easy for people to get and to install a working GNU/Linux system on their personal computer.
Read more...
Mandriva 2006 PDF Print E-mail
Written by Administrator   
Saturday, 11 February 2006

Mandriva Linux 10.1: System overview

Mandriva Linux 10.1 features the following major softwares:

  • Linux Kernel 2.6.8 (and various fixes from 2.6.9rc)

  • Xorg 6.7.0

  • KDE 3.2.3

  • GNOME 2.6

  • Glibc 2.3.3, GCC 3.4.1

  • Apache 2.0.50, PHP 4.3.8

  • MySQL 4.0.18, Samba 3.0.6

  • Mozilla 1.7.2, GIMP 2.0.4

  • OpenOffice.org 1.1.3


Read more...
Building C programs on Linux PDF Print E-mail
Written by Administrator   
Tuesday, 20 September 2005
HowTo build simple C programs on Linux

1. Introduction

This document will step you though compiling and running simple C programs under the Linux operating system. It is meant as a guide for beginners who may know how to program in C but don't know how to build a C program on Linux. This document uses simple C programs to illustrate how to build the programs under Linux. It covers writing a basic C program but it is not meant as a guide to teach the language. We will also step through the basics of writing a Makefile for your project.

This document also assumes that you know how to create/edit files on Linux and that you have the GNU C compiler installed. An easy way to tell if you have a C compiler installed is by issuing the command 'which gcc'. We are also assuming that the compile is executed from the command line. There are far too many GUI/IDE type environments to cover otherwise.

2. A Simple program

2.1 Writing the source

The source of our first program is below:
code:
#include <stdio.h>

main()
{
printf("Linuxquestions.org\n");
}


Save the program above and call it simplelq.c

Here is the breakdown of the program above.
The first line #include <stdio.h> is a preprocessor directive. This basically tells the compiler that we are using the functions that are in the stdio library. The stdio library contains all the basic functions needed for basic input and output for our program.

The second line main() is a required function for every C program. main() is the starting point for the program. Like all functions the body begins with a { (open curly brace) and ends with a } (close curly brace).

The body of our main function printf ("Linuxquestions.org\n"); is a function call to the printf function. printf stands for print formatted and has complex rules for printing text, numbers to specific formats. Here we are just displaying the test "Linuxquestions.org" to the screen. The \n at the end of string is a newline. It tells printf to end the line and start any additional text on the next line. All function calls in C must end in a ;

2.2 Compiling the Source

The compile is done from the command line.

code:
$ gcc -o simplelq simplelq.c
$


gcc is the GNU C compiler. The -o option tells it what to name the output file and the simplelq.c is the source file.

The output from the compiler will be a binary file called simplelq

2.3 Running the executable

In order to run our sample executable we will need to apply the execute permission to the file. The we will execute it after.
code:
$ chmod 744 simplelq
$ ./simplelq
Linuxquestions.org


The output of our sample program produced the text "Linuxquestions.org" to the console (or screen). Try to add some more text to the sample program, recompile and watch the output.

3. Dealing with multiple sources

In most projects that are more that a couple functions you will most likely want to split out the source into multiple files. Splitting the code allows the source to be more manageable by avoiding huge source files and to group like functions together.
Here is an example that has multiple sources:

3.1 The source files
code:
 
/* File: appendall.h */

/* below is a forward deceleration of a function. It differs from a
function header by the semicolon at the end. Any source that wants to
use the appendall function needs to include this header file. */

void appendall( int iArgCount,
char * iArgs[],
char * szReturnBuffer,
int iSize );


code:

/* File: appendall.c */

#include <stdio.h>


void appendall( int iArgCount,
char * iArgs[],
char * szReturnBuffer,
int iSize )
{
int i = 0;

for ( i = 0; i < iArgCount; i++ ) /* Loop through all the arguments */
{
/* Test to see if the added length of the new arg will exceed */
/* the length of our buffer */

if (( strlen( szReturnBuffer ) + strlen( iArgs[i] )) < iSize )
{

strcat( szReturnBuffer, iArgs[i] ); /* concatenate */
strcat( szReturnBuffer, " " ); /* add a string */
}
else
{
printf( "Error: exceeded buffer size\n");
break;
}
}
}


code:
/* File appendallmain.cpp */

*/ This include will pull in the function declaration for appendall.h
*/
#include "appendall.h"

#define SIZE 500

main( int argc, char * argv[])
{
char szNewString[SIZE]; /* declare a character array of size 500 */

appendall( argc, argv, szNewString, SIZE ); /* Call the function */
printf("%s", szNewString );
}


3.2 Compiling the Source

The compile is done from the command line.

There are a couple ways to do this. One is to compile and link in one step and the other is to build the objects separately and then link.

Compile and link multiple sources in one step.
code:
$ gcc -o appendall appendall.c appendallmain.c
$


Compile and link in multiple steps:
code:

$ gcc -c appendall.c
$ gcc -c appendallmain.c
$ gcc -o appendall appendall.o appendallmain.o
$

The -c flag tells the compiler to compiler only and not call the linker.

It is easier to build and link in one step, but if you are using Makefiles to manage your project the separate compile and link makes building much quicker.

Here is a simple Makefile for building the above sources:
code:
all: appendall

appendall.o: appendall.c appendall.h
gcc -c appendall.c

appendallmain.o: appendallmain.c appendall.h
gcc -c appendallmain.c

appendall: appendall.o appendallmain.o
gcc -o appendall appendall.o appendallmain.o

clean:
rm *.o appendall


Run make to build the sources:
code:
$ make
gcc -c appendall.c
gcc -c appendallmain.c
gcc -o appendall appendall.o appendallmain.o
$


Here is the basic breakup of a Makefile rule:

target ... : prerequisites ...
command
...
...


There must be a <tab> character before all the commands after a rule. Spaces instead of tabs will result in errors.

4. Suggest Links

http://www.gnu.org/software/gcc/gcc.html
http://www.gnu.org/manual/make/html...r/make_toc.html
http://www.linuxquestions.org/questions/search.php?s=
Creating shared FAT32 Partition PDF Print E-mail
Written by Administrator   
Tuesday, 20 September 2005
This is to help create a functioning FAT32 (vfat) partition to be shared between your linux and windows OS's. For simplicity, i'll assume that you're using hda1 for windows, hda2 as an extended partition for linux with hda5,6 and 7 for /, /usr, and swap contained as logical sub-partitions. That's a normal setup. Now you'll want to create a new partition using fdisk. Some people seem to be afraid of this, but i find it very easy to use. First, go to the command line and as root type:

telinit s

this will take you to single user mode, which means disks aren't usually mounted and stuff like that (it's not a good idea to try and format a disk that's already mounted and in use). type:

fdisk hda

this will take you into the menu-driven fdisk program. type:

p

to list your current partitions, and take a moment to familiarize yourself with the setup. an i.d. of 83 is an ext3 linux native partition, i.d. 82 means a linux swap partition.

Now you want to create a new primary partition, with a file system type FAT32 (this can be easily accessed by both OS's) to do this, type:

n <---- create new partition
p <---- primary
3 <---- label it hda3 (3rd primary)

At this point it'll ask for first and last sector, which will default to first available sector and last available sector (take up any free space left), if you want to control the size yourself, say create a 5 gigabyte partition, accept the first default, then type +5000M

Now change the fs type with

t
c <---- this specifies vfat filesystem

and review what you've done with 'p' to make sure everything is the way you want it. If you're satisfied, use 'w' to write the partition table to disk, and exit fdisk. (WARNING: this will write the partition table to disk, make sure you haven't changed any of your old partitions)

At this point you need to format the new parition, which can be done with mkfs, although i had to download dosfsutils because slackware didn't come with mkfs.vfat (FAT32) included. If you are missing this package, try the following link to download the rpm (i'm still looking for a good source package).

http://rpmfind.net/linux/RPM/ultrapenguin/1.1.9/sparc/RedHat/RPMS/mkdosfs-ygg-0.3b-8.sparc.html

Either way, in the end the command should look something like this:

mkfs -t vfat /dev/hda3
OR
mkfs.vfat /dev/hda3

Assuming that works, there's just one thing left to do: edit your /etc/fstab to automatically mount the new partition on boot. Use emacs, vi or whatever editor you're familiar with, and add the following line:

/dev/hda3 /mnt/windows defaults,umask=000 0 0

There are actually several different sets of options you could use in place of defaults, but i have this setup and it so far it works extremely well for me. Type:

mount -a or mount /dev/hda3

and bingo ! ,you should be able to read and write to this partion from linux or windows!
<< Start < Prev 1 2 3 Next > End >>

Results 1 - 8 of 17
 
Top! Top!