On 2010-03-23 21:17, Cor Nouws wrote:
Hi Madhur,
Madhur Kashyap wrote (23-03-10 16:44)
On Tue, Mar 23, 2010 at 5:44 PM, Noelson Duarte <[email protected]>
wrote:
StarBASIC has the function GETGUITYPE that returns a value for the OS.
Thats another valuable input I wasn't aware of. I dug more about
this in
online help and found out that it would not differentiate between
solaris
and linux. Is my understanding correct?
I think that is the case.
I need to support all three OS, viz., Windows_NT, Solaris and Linux.
This is how far I use it
If GetGuiType = 1 Then
' windows
ElseIf GetGuiType = 4 Then
' Linux
ElseIf GetGuiType = 3 Then
' Mac OS
Else
MsgBox "unknown OS", 16
Else
Hi Madhur.
Once you have detected GuiType 4 you could do a shell and run e.g.
uname -mrsn > /tmp/systemname.txt
and then read systemname.txt (piping the result of uname into OOo would
however take some programming I guess...). That should help you
distinguish between Solaris and Linux.
Since the above presents plenty of opportunities for bad or at least
hard-to-do error handling, a somewhat easier way could be to just read
/proc/version
I don't really know whether Solaris supports /proc/version or only
/proc/ for processes (http://en.wikipedia.org/wiki/Procfs#Solaris). But
if it *doesn't* exist you can be pretty sure that you are *not* on Linux.
For instance:
Sub ShowProcVersion
FileHandle = FreeFile
Open "/proc/version" for input as #FileHandle
Line input #FileHandle, VersionString
Close #FileHandle
MsgBox VersionString
End Sub
Again, I am not sure what that will show on Solaris, but on my Linux
boxes the very first token of that string is "Linux".
Cheers
-- Jan Holst Jensen
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]