[PC-BSD Commits] r1204 - pcbsd/trunk/PBCsource

svn at pcbsd.org svn at pcbsd.org
Thu Jan 17 06:20:25 PST 2008


Author: kris
Date: 2008-01-17 06:20:24 -0800 (Thu, 17 Jan 2008)
New Revision: 1204

Modified:
   pcbsd/trunk/PBCsource/pbistart.c
Log:

Updated pbistart.c to bring up the kdesu dialog a lot faster, don't read
all the way to the end of the file when we don't need to. 



Modified: pcbsd/trunk/PBCsource/pbistart.c
===================================================================
--- pcbsd/trunk/PBCsource/pbistart.c	2008-01-17 13:20:50 UTC (rev 1203)
+++ pcbsd/trunk/PBCsource/pbistart.c	2008-01-17 14:20:24 UTC (rev 1204)
@@ -17,6 +17,8 @@
  char *progname;
  char awkcmd[300];
  char lineskip[50];
+ char pbiskip[50];
+ char tardatalines[50];
  char tarcmd[300];
  char dialogpid[10];
  char killcmd[150];
@@ -219,6 +221,44 @@
 strcat(awkcmd, tmpfile);
 system(awkcmd);
 
+// Get the pbi skip location so we know where to stop reading
+if ((file = open(tmpfile, 0x0)) < 0 ) {
+    exit(2);
+}
+
+charread = read(file, pbiskip, 4);
+pbiskip[charread]='\0';
+
+//printf("PBIskip=%s\n", pbiskip);
+close(file);
+
+// Get how many lines we want to read now
+strcpy(whoamicmd, "expr ");
+strcat(whoamicmd, pbiskip);
+strcat(whoamicmd, " - ");
+strcat(whoamicmd, lineskip);
+strcat(whoamicmd, " > ");
+strcat(whoamicmd, pbitmpdir);
+strcat(whoamicmd, "/tarreadlines");
+system(whoamicmd);
+
+strcpy(tmpfile, pbitmpdir);
+strcat(tmpfile, "/tarreadlines");
+
+
+// Get the pbi skip location so we know where to stop reading
+if ((file = open(tmpfile, 0x0)) < 0 ) {
+    exit(2);
+}
+
+charread = read(file, tardatalines, 4);
+tardatalines[charread]='\0';
+
+//printf("tardatalines=%s\n", tardatalines);
+close(file);
+
+
+
 // If we have a local style path
 if(progname[0] == '.')
 {
@@ -248,10 +288,12 @@
 strcat(tarcmd, lineskip);
 strcat(tarcmd, " '");
 strcat(tarcmd, progname);
-strcat(tarcmd, "' | tar xv -C '");
+strcat(tarcmd, "' | head -n ");
+strcat(tarcmd, tardatalines);
+strcat(tarcmd, " | tar xv --fast-read -C '");
 strcat(tarcmd, pbitmpdir);
 strcat(tarcmd, "/'");
-strcat(tarcmd, " -f - 2>/dev/null");
+strcat(tarcmd, " -f - . 2>/dev/null");
 strcat(tarcmd, " ; exit $?");
 //printf("tarcmd: %s\n", tarcmd);
 



More information about the Commits mailing list