Re: Hide user in top(1).

2012-06-01 Thread Brynet
On Fri, Jun 01, 2012 at 04:02:11PM -0400, Brynet wrote:
> Hi,
> 
> Sometimes it's handy to hide a user from top(1) output, on a desktop
> system for example you might want to quickly hide yourself and see what
> else is running.
> 
> The syntax for interactive mode is u -user, passwd(5) entries shouldn't
> begin with that character.
> 
> '-', like '+', will clear all filters when used without an argument.
> 
> Non-interactive mode is unchanged.
> 
> Anyone like this?
> -Bryan.

Ugh, wrong diff.

-Bryan.

Index: display.c
===
RCS file: /cvs/src/usr.bin/top/display.c,v
retrieving revision 1.42
diff -u -p -u -r1.42 display.c
--- display.c   15 Apr 2012 19:52:16 -  1.42
+++ display.c   1 Jun 2012 19:29:08 -
@@ -782,7 +782,7 @@ show_help(void)
"r count pid  - renice process `pid' to nice value `count'\n"
"S- toggle the display of system processes\n"
"s time   - change delay between displays to `time' seconds\n"
-   "u user   - display processes for `user' (u+ selects all 
users)\n"
+   "u [-]user- show processes for `user' (u+ shows all, u -user 
hides user)\n"
"\n");
 
if (smart_terminal) {
Index: machine.c
===
RCS file: /cvs/src/usr.bin/top/machine.c,v
retrieving revision 1.72
diff -u -p -u -r1.72 machine.c
--- machine.c   21 Apr 2012 03:14:50 -  1.72
+++ machine.c   1 Jun 2012 19:29:08 -
@@ -330,6 +330,7 @@ get_process_info(struct system_info *si,
 int (*compare) (const void *, const void *))
 {
int show_idle, show_system, show_threads, show_uid, show_pid, show_cmd;
+   int hide_uid;
int total_procs, active_procs;
struct kinfo_proc **prefp, *pp;
int what = KERN_PROC_KTHREAD;
@@ -356,6 +357,7 @@ get_process_info(struct system_info *si,
show_system = sel->system;
show_threads = sel->threads;
show_uid = sel->uid != (uid_t)-1;
+   hide_uid = sel->huid != (uid_t)-1;
show_pid = sel->pid != (pid_t)-1;
show_cmd = sel->command != NULL;
 
@@ -381,6 +383,7 @@ get_process_info(struct system_info *si,
if (pp->p_stat != SZOMB &&
(show_idle || pp->p_pctcpu != 0 ||
pp->p_stat == SRUN) &&
+   (!hide_uid || pp->p_ruid != sel->huid) &&
(!show_uid || pp->p_ruid == sel->uid) &&
(!show_pid || pp->p_pid == sel->pid) &&
(!show_cmd || strstr(pp->p_comm,
Index: machine.h
===
RCS file: /cvs/src/usr.bin/top/machine.h,v
retrieving revision 1.16
diff -u -p -u -r1.16 machine.h
--- machine.h   10 Apr 2011 03:20:59 -  1.16
+++ machine.h   1 Jun 2012 19:29:08 -
@@ -74,6 +74,7 @@ struct process_select {
int system; /* show system processes */
int threads;/* show threads */
uid_t   uid;/* only this uid (unless uid == -1) */
+   uid_t   huid;   /* hide this uid (unless huid == -1) */
pid_t   pid;/* only this pid (unless pid == -1) */
char   *command;/* only this command (unless == NULL) */
 };
Index: top.1
===
RCS file: /cvs/src/usr.bin/top/top.1,v
retrieving revision 1.59
diff -u -p -u -r1.59 top.1
--- top.1   16 Dec 2011 14:50:24 -  1.59
+++ top.1   1 Jun 2012 19:29:08 -
@@ -354,11 +354,16 @@ Toggle the display of system processes.
 Set the delay between screen updates to
 .Ar time
 seconds.
-.It u Ar user
+.It Xo
+.Ic u
+.Oo - Oc Ns Ar user
+.Xc
 Show only those processes owned by
 .Ar user .
 .Sq u+
 shows processes belonging to all users.
+.Sq u -user
+hides processes belonging to a single user.
 .El
 .Sh THE DISPLAY
 .\" The actual display varies depending on the specific variant of Unix
Index: top.c
===
RCS file: /cvs/src/usr.bin/top/top.c,v
retrieving revision 1.77
diff -u -p -u -r1.77 top.c
--- top.c   20 Apr 2012 16:36:11 -  1.77
+++ top.c   1 Jun 2012 19:29:08 -
@@ -282,6 +282,7 @@ main(int argc, char *argv[])
ps.idle = Yes;
ps.system = No;
ps.uid = (uid_t)-1;
+   ps.huid = (uid_t)-1;
ps.pid = (pid_t)-1;
ps.command = NULL;
 
@@ -540,7 +541,6 @@ rundisplay(void)
char ch, *iptr;
int change, i;
struct pollfd pfd[1];
-   uid_t uid;
static char command_chars[] = "\f qh?en#sdkriIuSopCHg+P1";
 
/*
@@ -774,15 +774,21 @@ rundisplay(void)
new_message(MT_standout,
"Username to show: ");
if (readline(tempbuf, sizeof(tempb

Hide user in top(1).

2012-06-01 Thread Brynet
Hi,

Sometimes it's handy to hide a user from top(1) output, on a desktop
system for example you might want to quickly hide yourself and see what
else is running.

The syntax for interactive mode is u -user, passwd(5) entries shouldn't
begin with that character.

'-', like '+', will clear all filters when used without an argument.

Non-interactive mode is unchanged.

Anyone like this?
-Bryan.

Index: display.c
===
RCS file: /cvs/src/usr.bin/top/display.c,v
retrieving revision 1.42
diff -u -p -u -r1.42 display.c
--- display.c   15 Apr 2012 19:52:16 -  1.42
+++ display.c   1 Jun 2012 19:29:08 -
@@ -782,7 +782,7 @@ show_help(void)
"r count pid  - renice process `pid' to nice value `count'\n"
"S- toggle the display of system processes\n"
"s time   - change delay between displays to `time' seconds\n"
-   "u user   - display processes for `user' (u+ selects all 
users)\n"
+   "u [-]user- show processes for `user' (u+ shows all, u -user 
hides one)\n"
"\n");
 
if (smart_terminal) {
Index: machine.c
===
RCS file: /cvs/src/usr.bin/top/machine.c,v
retrieving revision 1.72
diff -u -p -u -r1.72 machine.c
--- machine.c   21 Apr 2012 03:14:50 -  1.72
+++ machine.c   1 Jun 2012 19:29:08 -
@@ -330,6 +330,7 @@ get_process_info(struct system_info *si,
 int (*compare) (const void *, const void *))
 {
int show_idle, show_system, show_threads, show_uid, show_pid, show_cmd;
+   int hide_uid;
int total_procs, active_procs;
struct kinfo_proc **prefp, *pp;
int what = KERN_PROC_KTHREAD;
@@ -356,6 +357,7 @@ get_process_info(struct system_info *si,
show_system = sel->system;
show_threads = sel->threads;
show_uid = sel->uid != (uid_t)-1;
+   hide_uid = sel->huid != (uid_t)-1;
show_pid = sel->pid != (pid_t)-1;
show_cmd = sel->command != NULL;
 
@@ -381,6 +383,7 @@ get_process_info(struct system_info *si,
if (pp->p_stat != SZOMB &&
(show_idle || pp->p_pctcpu != 0 ||
pp->p_stat == SRUN) &&
+   (!hide_uid || pp->p_ruid != sel->huid) &&
(!show_uid || pp->p_ruid == sel->uid) &&
(!show_pid || pp->p_pid == sel->pid) &&
(!show_cmd || strstr(pp->p_comm,
Index: machine.h
===
RCS file: /cvs/src/usr.bin/top/machine.h,v
retrieving revision 1.16
diff -u -p -u -r1.16 machine.h
--- machine.h   10 Apr 2011 03:20:59 -  1.16
+++ machine.h   1 Jun 2012 19:29:08 -
@@ -74,6 +74,7 @@ struct process_select {
int system; /* show system processes */
int threads;/* show threads */
uid_t   uid;/* only this uid (unless uid == -1) */
+   uid_t   huid;   /* hide this uid (unless huid == -1) */
pid_t   pid;/* only this pid (unless pid == -1) */
char   *command;/* only this command (unless == NULL) */
 };
Index: top.1
===
RCS file: /cvs/src/usr.bin/top/top.1,v
retrieving revision 1.59
diff -u -p -u -r1.59 top.1
--- top.1   16 Dec 2011 14:50:24 -  1.59
+++ top.1   1 Jun 2012 19:29:08 -
@@ -354,11 +354,16 @@ Toggle the display of system processes.
 Set the delay between screen updates to
 .Ar time
 seconds.
-.It u Ar user
+.It Xo
+.Ic u
+.Oo - Oc Ns Ar user
+.Xc
 Show only those processes owned by
 .Ar user .
 .Sq u+
 shows processes belonging to all users.
+.Sq u -user
+hides processes belonging to a single user.
 .El
 .Sh THE DISPLAY
 .\" The actual display varies depending on the specific variant of Unix
Index: top.c
===
RCS file: /cvs/src/usr.bin/top/top.c,v
retrieving revision 1.77
diff -u -p -u -r1.77 top.c
--- top.c   20 Apr 2012 16:36:11 -  1.77
+++ top.c   1 Jun 2012 19:29:08 -
@@ -282,6 +282,7 @@ main(int argc, char *argv[])
ps.idle = Yes;
ps.system = No;
ps.uid = (uid_t)-1;
+   ps.huid = (uid_t)-1;
ps.pid = (pid_t)-1;
ps.command = NULL;
 
@@ -540,7 +541,6 @@ rundisplay(void)
char ch, *iptr;
int change, i;
struct pollfd pfd[1];
-   uid_t uid;
static char command_chars[] = "\f qh?en#sdkriIuSopCHg+P1";
 
/*
@@ -774,15 +774,21 @@ rundisplay(void)
new_message(MT_standout,
"Username to show: ");
if (readline(tempbuf, sizeof(tempbuf)) > 0) {
-   if (tempbuf[0] == '+' &&
+   if ((temp

Re: mg - more emacs scroll compatibility

2012-06-01 Thread Loganaden Velvindron
Just to be clear, I'm just saying that I like it, not that I have any
power to ok something :-)

On Fri, Jun 1, 2012 at 11:44 AM, Loganaden Velvindron
 wrote:
> Yeah, it makes it feel even closer to emacs.
>
> On Thu, May 31, 2012 at 7:02 PM, Mark Lumsden  wrote:
>> Show a message and beep when you reach either end of a buffer.
>>
>> ok?
>>
>> -lum
>>
>> Index: basic.c
>> ===
>> RCS file: /cvs/src/usr.bin/mg/basic.c,v
>> retrieving revision 1.33
>> diff -u -p -r1.33 basic.c
>> --- basic.c 31 May 2012 10:55:53 -  1.33
>> +++ basic.c 31 May 2012 14:54:24 -
>> @@ -269,8 +269,11 @@ forwpage(int f, int n)
>>
>>lp = curwp->w_linep;
>>while (n--)
>> -   if ((lp = lforw(lp)) == curbp->b_headp)
>> +   if ((lp = lforw(lp)) == curbp->b_headp) {
>> +   ttbeep();
>> +   ewprintf("End of buffer");
>>return(TRUE);
>> +   }
>>
>>curwp->w_linep = lp;
>>curwp->w_rflag |= WFFULL;
>> @@ -314,6 +317,10 @@ backpage(int f, int n)
>>
>>while (n-- && lback(lp) != curbp->b_headp) {
>>lp = lback(lp);
>> +   }
>> +   if (lp == curwp->w_linep) {
>> +   ttbeep();
>> +   ewprintf("Beginning of buffer");
>>}
>>curwp->w_linep = lp;
>>curwp->w_rflag |= WFFULL;
>>
>
>
>
> --
> Brightest day,
> Blackest night,
> No bug shall escape my sight,
> And those who worship evil's mind,
> be wary of my powers,
> puffy lantern's light !



--
Brightest day,
Blackest night,
No bug shall escape my sight,
And those who worship evil's mind,
be wary of my powers,
puffy lantern's light !



Re: cscope support in mg

2012-06-01 Thread Mark Lumsden
> Here is an updated diff with following changes...
> 
> Manpage update.
> Remove conditional compilation of cscope functionality.
> Fixed a memory leak in csexists function.
> Treat current word at cursor as default input for cscope commands.
> 
> Comments?

I like it. I'm using your previous diffs (ctags/shell-command-on-region
etc..) to develope mg, so I'm keen for it to go in. I recall others
being interested in this, do they have anything to say? Or are there 
any objectors?

mark



Paga $880 solo por hoy SAMSUNG PL120

2012-06-01 Thread Bonus Cupon Especial!
Si no podes visualizar este mail, ingresa a:
http://news1.bonuscupon.com.ar/r.html?uid=1.p.295h.e9.1jwb6op1qd



Re: mg - more emacs scroll compatibility

2012-06-01 Thread Loganaden Velvindron
Yeah, it makes it feel even closer to emacs.

On Thu, May 31, 2012 at 7:02 PM, Mark Lumsden  wrote:
> Show a message and beep when you reach either end of a buffer.
>
> ok?
>
> -lum
>
> Index: basic.c
> ===
> RCS file: /cvs/src/usr.bin/mg/basic.c,v
> retrieving revision 1.33
> diff -u -p -r1.33 basic.c
> --- basic.c 31 May 2012 10:55:53 -  1.33
> +++ basic.c 31 May 2012 14:54:24 -
> @@ -269,8 +269,11 @@ forwpage(int f, int n)
>
>lp = curwp->w_linep;
>while (n--)
> -   if ((lp = lforw(lp)) == curbp->b_headp)
> +   if ((lp = lforw(lp)) == curbp->b_headp) {
> +   ttbeep();
> +   ewprintf("End of buffer");
>return(TRUE);
> +   }
>
>curwp->w_linep = lp;
>curwp->w_rflag |= WFFULL;
> @@ -314,6 +317,10 @@ backpage(int f, int n)
>
>while (n-- && lback(lp) != curbp->b_headp) {
>lp = lback(lp);
> +   }
> +   if (lp == curwp->w_linep) {
> +   ttbeep();
> +   ewprintf("Beginning of buffer");
>}
>curwp->w_linep = lp;
>curwp->w_rflag |= WFFULL;
>



--
Brightest day,
Blackest night,
No bug shall escape my sight,
And those who worship evil's mind,
be wary of my powers,
puffy lantern's light !