[devel] procps.git

Alexey Tourbin =?iso-8859-1?q?at_=CE=C1_altlinux=2Eru?=
Чт Сен 14 04:51:44 MSD 2006


И чо, я сделал патч к procps, куда его теперь коммитить?
В /people/ldv/packages/procps.git писать не дают, а куда тогда?

$ git-push --all git.alt:/people/ldv/packages/procps.git
updating 'refs/heads/master'
  from 25366cd4b1691a887e135a58ab894dff6cbae560
  to   64ef9663bc217c76ee80007a8cda189a3c7e6919
updating 'refs/heads/origin'
  from 0000000000000000000000000000000000000000
  to   25366cd4b1691a887e135a58ab894dff6cbae560
Generating pack...
Done counting 7 objects.
Result has 4 objects.
Deltifying 4 objects.
 100% (4/4) done
Total 4, written 4 (delta 3), reused 0 (delta 0)
Unpacking 4 objects
unable to create temporary sha1 filename ./objects/obj_aObEAo: Permission denied
fatal: failed to write object
unpack unpacker exited with error code
ng refs/heads/master n/a (unpacker error)
ng refs/heads/origin n/a (unpacker error)
$ git-log -p --max-count=1
commit 64ef9663bc217c76ee80007a8cda189a3c7e6919
Author: Alexey Tourbin <at на localhost.localdomain>
Date:   Thu Sep 14 04:42:46 2006 +0400

    Implement the following behaviour:
    
    1) execute a program also when a key is pressed;
    2) but if that key is 'q' then exit instead.
    
    This makes watch look more like an interactive program.

diff --git a/procps/watch.c b/procps/watch.c
index 18ded5e..4abad74 100644
--- a/procps/watch.c
+++ b/procps/watch.c
@@ -20,6 +20,7 @@ #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/ioctl.h>
+#include <sys/select.h>
 #include <time.h>
 #include <unistd.h>
 #include <locale.h>
@@ -227,6 +228,7 @@ main(int argc, char *argv[])
 	nonl();
 	noecho();
 	cbreak();
+	nodelay(stdscr, TRUE);
 
 	for (;;) {
 		time_t t = time(NULL);
@@ -236,6 +238,10 @@ main(int argc, char *argv[])
 		FILE *p;
 		int x, y;
 		int oldeolseen = 1;
+		int key;
+
+		if ((key = getch()) == 'q') 
+			do_exit(0);
 
 		if (screen_size_changed) {
 			get_terminal_size();
@@ -314,7 +320,16 @@ main(int argc, char *argv[])
 
 		first_screen = 0;
 		refresh();
-		usleep(interval * 1000000);
+
+		/* wait until tiemout or until a key press */
+		{
+			fd_set set;
+			int fd = fileno(stdin);
+			struct timeval timeout = { interval, 0 };
+			FD_ZERO(&set);
+			FD_SET(fd, &set);
+			select(fd + 1, &set, NULL, NULL, &timeout);
+		}
 	}
 
 	endwin();
$
----------- следующая часть -----------
Было удалено вложение не в текстовом формате...
Имя     : =?iso-8859-1?q?=CF=D4=D3=D5=D4=D3=D4=D7=D5=C5=D4?=
Тип     : application/pgp-signature
Размер  : 189 байтов
Описание: =?iso-8859-1?q?=CF=D4=D3=D5=D4=D3=D4=D7=D5=C5=D4?=
Url     : <http://lists.altlinux.org/pipermail/devel/attachments/20060914/943771e6/attachment-0001.bin>


Подробная информация о списке рассылки Devel