LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 05-23-2004, 04:00 AM   #1
Thaidog
Member
 
Registered: Sep 2002
Location: Hilton Head, SC
Distribution: Gentoo
Posts: 636

Rep: Reputation: 32
Question How does linux read config files?


Ok, so you can go in to say the xinetd.config file and edit your services with a simple yes or no... but how does linux/unix take these files and translate this request to the actual system?
 
Old 05-23-2004, 04:06 AM   #2
Crashed_Again
Senior Member
 
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503

Rep: Reputation: 57
hmmm...interesting question. I'll take a guess at it but I'm not totally sure. I wrote a few perl scripts that used the .conf file style. Basically all it does is take the value from the .conf file and put it as a variable in the program. Like 'yes' or 'no' and if its 'yes' then this part of the code is executed. If its 'no' then this part of the code is not executed.
 
Old 05-23-2004, 04:43 AM   #3
Thaidog
Member
 
Registered: Sep 2002
Location: Hilton Head, SC
Distribution: Gentoo
Posts: 636

Original Poster
Rep: Reputation: 32
I know that perl is a language that has the ability to "account" for veriables with in the script... which I guess would make sense here... So perl takes the variable and passes it on to the system... but how?
 
Old 05-23-2004, 04:54 AM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Are you asking how a programmer parses data?


Cheers,
Tink
 
Old 05-23-2004, 05:19 AM   #5
Thaidog
Member
 
Registered: Sep 2002
Location: Hilton Head, SC
Distribution: Gentoo
Posts: 636

Original Poster
Rep: Reputation: 32
No, I'm asking how the system translates english from the config files in to a readable format... basically the process....

like config file > facility > output
 
Old 05-23-2004, 05:53 AM   #6
elluva
Member
 
Registered: Aug 2003
Location: Belguim, Ostend and Ghent
Distribution: Ubuntu
Posts: 600

Rep: Reputation: 30
this question shouldn't be in the newbie section I think.

The conf file is just a textfile, and just like every file, it is just a bitstring on disk. When a program reads from a file, it asks the OS to get that bitstring. The OS reads it from disk and passes it through at the program. Then the program has to know (or decide) what this bitstring will represent (a string, an array of ints, an array of doubles,...). In our example it is a string. Then the program should know how to find what value, e.g. it searches the string for 'BOOLEAN_VALUE=' and checks if theres a yes or a no behind it, it will probably put that value in a variable or make a decision upon it.

As you can see, all depends from the kind of bitstring (e.g. binary, text) and the kind of fileformat (e.g. XML). If this is an answer to your question, next time ask it in the programming forum. If it wasn't, please be more accurate...

greetingz,
Elluva

Last edited by elluva; 05-23-2004 at 05:55 AM.
 
Old 05-23-2004, 02:16 PM   #7
Crashed_Again
Senior Member
 
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503

Rep: Reputation: 57
Quote:
Originally posted by Thaidog
No, I'm asking how the system translates english from the config files in to a readable format... basically the process....

like config file > facility > output
So you asking how readable code written by programmers is translated into binary that the processor can use right? It depends on the language. Some languages must have their source code compiled into a binary before execution. It is the compiler that changes the source code into binary. Other languages are interpreted languages. The source code is not compiled into a binary but rather interpreted when the program is executed.
 
Old 05-23-2004, 05:59 PM   #8
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Quote:
Originally posted by Thaidog
No, I'm asking how the system translates english from the config files in to a readable format... basically the process....

like config file > facility > output
No offense meant, but that's the same thing. "The System" is
"how each individual programmer makes his program(s) parse
a line and take appropriate action" ... some will use libraries,
some will do it in their own way. I suggest you take a basic
computing class.



Cheers,
Tink
 
Old 05-24-2004, 03:14 AM   #9
elluva
Member
 
Registered: Aug 2003
Location: Belguim, Ostend and Ghent
Distribution: Ubuntu
Posts: 600

Rep: Reputation: 30
Why do you want to know this anyway? A basic user doesn't have to know this, if you want to develop stuff, it is your own choice how you do it. Btw. Linux is the kernel and I don't think the kernel reads config files. Things that do read from config files decide themselves how config files should look like, this way it depends on the programmer how a program parses its config files...
 
Old 05-25-2004, 03:18 AM   #10
Thaidog
Member
 
Registered: Sep 2002
Location: Hilton Head, SC
Distribution: Gentoo
Posts: 636

Original Poster
Rep: Reputation: 32
Quote:
Originally posted by Crashed_Again
So you asking how readable code written by programmers is translated into binary that the processor can use right? It depends on the language. Some languages must have their source code compiled into a binary before execution. It is the compiler that changes the source code into binary. Other languages are interpreted languages. The source code is not compiled into a binary but rather interpreted when the program is executed.
Oh yeah.. that's right, perl is complied on the fly isn't it?
 
Old 05-25-2004, 10:46 AM   #11
Thaidog
Member
 
Registered: Sep 2002
Location: Hilton Head, SC
Distribution: Gentoo
Posts: 636

Original Poster
Rep: Reputation: 32
Quote:
Originally posted by elluva
Why do you want to know this anyway? A basic user doesn't have to know this, if you want to develop stuff, it is your own choice how you do it. Btw. Linux is the kernel and I don't think the kernel reads config files. Things that do read from config files decide themselves how config files should look like, this way it depends on the programmer how a program parses its config files...
Who says I'm a basic user?
 
Old 05-25-2004, 11:19 AM   #12
lyceum
Member
 
Registered: Aug 2003
Location: N.C.
Distribution: rh9, fc1, slack 9.1, 10
Posts: 229

Rep: Reputation: 30
Quote:
Oh yeah.. that's right, perl is complied on the fly isn't it?
Perl, like Java and other "interpreted languages", is compiled into bytecode rather than binary, optimizing as it goes. When the program is executed this bytecode is passed to the interpreter which translates into binary "on the fly."

i chose to put interpreted languages in quotes above, because it is a bit of a minomer. a compiler and an interpreter can be written for any language, this term is used for languages that have historically used an interpreter.
 
Old 05-25-2004, 01:44 PM   #13
Thaidog
Member
 
Registered: Sep 2002
Location: Hilton Head, SC
Distribution: Gentoo
Posts: 636

Original Poster
Rep: Reputation: 32
Quote:
Originally posted by lyceum
Perl, like Java and other "interpreted languages", is compiled into bytecode rather than binary, optimizing as it goes. When the program is executed this bytecode is passed to the interpreter which translates into binary "on the fly."
Ok... now this is the response I was looking for... is there then a "component" of the system that is this "interpreter"?

Last edited by Thaidog; 05-31-2004 at 01:13 PM.
 
Old 05-31-2004, 01:14 PM   #14
Thaidog
Member
 
Registered: Sep 2002
Location: Hilton Head, SC
Distribution: Gentoo
Posts: 636

Original Poster
Rep: Reputation: 32
bump...
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to read .chm files in linux servnov Linux - General 3 03-25-2006 01:35 AM
How to config CDRom to read udf files satimis *BSD 16 06-25-2004 10:31 PM
generic parser to read/write linux config files amitchandel Linux - Software 1 06-14-2004 05:00 PM
Standard way to read config files? nmoog Programming 4 01-19-2004 12:17 PM
Can Linux read NT 4.00 files? pol Linux - Software 6 07-28-2002 05:45 AM


All times are GMT -5. The time now is 04:56 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