LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-30-2005, 08:03 PM   #1
gandil
LQ Newbie
 
Registered: Dec 2005
Posts: 7

Rep: Reputation: 0
Question Random Sentence Generator?


Hi everyone;
I am interested in linux kernel programming it is nice but so hard until now.
I wanna implement a Linux kernel module that gives out fortune cookies.
I wanna do something like proc/mycookies to take some cookies from user
and for each run will print a random sentence.

I mean i will write some sentences to a file(fortune file) and i will load my fortune file first
$ cat cookielist.txt > /proc/mycookie...

Then
When user prompt it;it will print out a sentence randomly.
Like:
$ cat /proc/mycookie
Lucky you: Your fortune is meaningless


is there any idea? Where should i start?
 
Old 12-30-2005, 08:18 PM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Start by learning a bit about Linux and programming.

First, your application does not require "kernel programming". It can likely be done with a simple shell script.

Where are you now (on the learning curve)? Do you have Linux installed and running? Have you learned some command line things?
 
Old 12-30-2005, 08:45 PM   #3
gandil
LQ Newbie
 
Registered: Dec 2005
Posts: 7

Original Poster
Rep: Reputation: 0
Thank You for Your Reply

Until now i make a small shell like top command which take user id,process id etc and i learned how to add a system call to kernel. is it enough?
 
Old 12-30-2005, 10:21 PM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Quote:
Originally Posted by gandil
Until now i make a small shell like top command which take user id,process id etc and i learned how to add a system call to kernel. is it enough?
I have no clue what you are talking about.....
 
Old 12-30-2005, 10:31 PM   #5
gandil
LQ Newbie
 
Registered: Dec 2005
Posts: 7

Original Poster
Rep: Reputation: 0
I know i can write a small shell program that will out a random sentence from a speicif file. I didn't talk bout it. I mean i wanna write a random sentence generator in kernel as a function of kernel. When user prompt it will out a random sentence from a specific file that loaded before.


Understood?
 
Old 12-31-2005, 08:14 AM   #6
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Quote:
Originally Posted by gandil
I know i can write a small shell program that will out a random sentence from a speicif file. I didn't talk bout it. I mean i wanna write a random sentence generator in kernel as a function of kernel. When user prompt it will out a random sentence from a specific file that loaded before.


Understood?
NO!! Why do you want to do this as a kernel function? It seems that you simply need an application that puts out random sentences in response to some kind of user input. You do not need to have the kernel do this.
 
Old 01-01-2006, 04:32 AM   #7
DarkElf109
Member
 
Registered: Dec 2005
Location: Phoenix, AZ
Distribution: Ubuntu, Debian, Gentoo
Posts: 43

Rep: Reputation: 15
Er, not to speak for the person requesting assistance, but I get the feeling that this is for learning, not practical use. I can't personally answer your question, gandil, but I think I understand what you're trying to do.
 
Old 01-01-2006, 10:14 AM   #8
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
I meant nothing negative or critical--I simply stated that I did not understand what OP was trying to do. Language of course could be an issue.

Watch to see if OP turns out to be a "one question hit and run". I see this a LOT on fora----someone has a question, registers, asks, and then disappears. No way to help them in the long haul.....
My value system says you stick around and try to help someone else---while of course continuing to ask your own questions. It is called "learning together"
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off




All times are GMT -5. The time now is 02:48 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration