[AD] small patch.

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


here's a small patch to fetch os_version and os_revision info under various 
unixes... since it has not been tested under anything else than linux i send 
it to the list rather than putting it in cvs.

-henrik
--- usystem.c.old	Mon Jul 30 20:17:08 2001
+++ usystem.c	Mon Jul 30 20:13:49 2001
@@ -121,7 +121,28 @@
    #ifdef HAVE_SYS_UTSNAME_H
 
       struct utsname utsn;
+      char *tmpstr, *tmpstr2;
+      int pos;
+      
       uname(&utsn);
+
+      /* fetch OS version and revision */
+      tmpstr = malloc(strlen(utsn.release)+1);
+      strcpy(tmpstr, utsn.release);
+      tmpstr2 = NULL;
+
+      for (pos = 0; pos <= strlen(utsn.release); pos++)
+      {
+         if (tmpstr[pos] == '.') {
+	    tmpstr[pos] = '\0';
+	    if (!tmpstr2) tmpstr2 = &tmpstr[pos] + 1;
+	 }
+      }
+
+      os_version = atoi(tmpstr);
+      os_revision = atoi(tmpstr2);
+
+      free(tmpstr);
 
       /* try to detect Unix systems we know of */
       if (!strcmp(utsn.sysname, "Linux")) {


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/