Find the answer to your Linux question:
Results 1 to 6 of 6
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    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...

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

    is there any idea? Where should i start?

  2. #2
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    St. Petersburg, FL
    Any particular reason why you'd want to implement this in the kernel?

  3. #3
    Linux User Game master pro's Avatar
    Join Date
    Sep 2005
    Tasmania, australia
    Is that like the thing in slackware, when you log in it gives you a random quote thingy?

  4. $spacer_open
  5. #4
    Linux Enthusiast scientica's Avatar
    Join Date
    Sep 2003
    South- or "Mid-" Sweden
    first I'd recoment stop using colored text for all of the post (pun intended)

    I'd start looking in the Documents folder in the linux kernel source tree, and then (unless there's some documentation that says other wise) I'd look for files and folders with names like proc, proc.c, proc.h, etc in the source tree and then look them throuhg and see if they say how to extend the "proc fs" (iirc /proc is a pseudo fs, you might find it along with the other file systems sources), and it might actyally resid inside the sys-fs code (not sure but I'd guess /sys is expected to deprecate /proc at some point, my guess would be in 2.8 or 3.0).
    And if that fails I'd check lkml ( - linux kernel magazine ) and/or kerneltap ( ) and naturally google

    also I think you can save a lot of coding using code from fortune (I think it's GPL or BSD licensed, but if you plan only to play around and not release the code the license is irrelevant - I'm no lawyer, so don't take my words for law ), just put propper cretid where due, and use the same license and I think it should be alright (yet again, I'm no lawyer and really don't like licenses, but this world we live in require them to keep things open... :/ ).

    Regards Scienitca (registered user #335819 - )
    A master is nothing more than a student who knows something of which he can teach to other students.

  6. #5
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    St. Petersburg, FL
    Once again, I don't see why you'd implement this in kernel space? If you could enlighten me, just for shits and giggles?

  7. #6
    this was a bad idea. i did but not useful. if any one wants i can send code.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts