any leftover changes

This commit is contained in:
albert 2003-09-17 17:14:32 +00:00
parent 769b6b16a5
commit d611d4e66f
6 changed files with 59 additions and 13 deletions

View File

@ -155,8 +155,10 @@ install: $(filter-out $(SKIP) $(addprefix $(DESTDIR),$(SKIP)),$(INSTALL))
############ prog.c --> prog.o ############ prog.c --> prog.o
top.o : top.h
%.o : %.c %.o : %.c
$(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -c -o $@ $^ $(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -c -o $@ $<
w.o: w.c w.o: w.c
$(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) $(W_SHOWFROM) -c $< $(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) $(W_SHOWFROM) -c $<

4
NEWS
View File

@ -1,9 +1,11 @@
procps-3.1.11 --> procps-3.1.12 procps-3.1.11 --> procps-3.1.12
ps: explicit width ("ps -o pid,wchan:42,args")
ps: $PS_FORMAT works properly #201575
top: new Linux 2.6.0-test4 CPU stats shown top: new Linux 2.6.0-test4 CPU stats shown
top: multiple -p options work again top: multiple -p options work again
top: fixed 4 GB wrap-around top: fixed 4 GB wrap-around
ps: comes with tests ps: has a set of tests to ensure correctness
man page: /var/run/utmp, not /etc/utmp #206583 man page: /var/run/utmp, not /etc/utmp #206583
required flags moved out of CFLAGS #205429 required flags moved out of CFLAGS #205429
RPM generation handles /lib64 RPM generation handles /lib64

View File

@ -152,9 +152,13 @@ If all column headers are empty ("ps -o pid= -o comm=") then the
header line will not be output. Column width will increase as header line will not be output. Column width will increase as
needed for wide headers; this may be used to widen up columns needed for wide headers; this may be used to widen up columns
such as WCHAN ("ps -o pid,wchan=WIDE-WCHAN-COLUMN -o comm"). such as WCHAN ("ps -o pid,wchan=WIDE-WCHAN-COLUMN -o comm").
Explicit width control ("ps opid,wchan:42,cmd") is offered too.
The behavior of "ps -o pid=X,comm=Y" varies with personality; The behavior of "ps -o pid=X,comm=Y" varies with personality;
output may be one column named "X,comm=Y" or two columns output may be one column named "X,comm=Y" or two columns
named "X" and "Y". Use multiple -o options when in doubt. named "X" and "Y". Use multiple -o options when in doubt.
Use the $PS_FORMAT environment variable to specify a default
as desired; DefSysV and DefBSD are macros that may be used to
choose the default UNIX or BSD columns.
The "-g" option can select by session leader OR by group name. The "-g" option can select by session leader OR by group name.
Selection by session leader is specified by many standards, Selection by session leader is specified by many standards,
@ -186,7 +190,7 @@ Heuristics are used to determine the behavior of this option. To ensure
that the desired behavior is obtained, specify the other option (sorting that the desired behavior is obtained, specify the other option (sorting
or formatting) in some other way. or formatting) in some other way.
For sorting, BSD "O" option syntax is O[+|-]k1[,[+|-]k2[,...]] For sorting, obsolete BSD "O" option syntax is O[+|-]k1[,[+|-]k2[,...]]
Order the process listing according to the multilevel sort specified by Order the process listing according to the multilevel sort specified by
the sequence of short keys from SORT KEYS, k1, k2, ... The `+' is quite the sequence of short keys from SORT KEYS, k1, k2, ... The `+' is quite
optional, merely re-iterating the default direction on a key. `-' reverses optional, merely re-iterating the default direction on a key. `-' reverses

View File

@ -268,6 +268,7 @@ out:
while(items--){ while(items--){
format_node *endp; format_node *endp;
char *equal_loc; char *equal_loc;
char *colon_loc;
sep_loc = strpbrk(walk," ,\t\n"); sep_loc = strpbrk(walk," ,\t\n");
/* if items left, then sep_loc is not in header override */ /* if items left, then sep_loc is not in header override */
if(items && sep_loc) *sep_loc = '\0'; if(items && sep_loc) *sep_loc = '\0';
@ -276,6 +277,15 @@ out:
*equal_loc = '\0'; *equal_loc = '\0';
equal_loc++; equal_loc++;
} }
colon_loc = strpbrk(walk,":");
if(colon_loc){ /* if width override */
*colon_loc = '\0';
colon_loc++;
if(strspn(colon_loc,"0123456789") != strlen(colon_loc) || *colon_loc=='0'){
free(buf);
goto badwidth;
}
}
fnode = do_one_spec(walk,equal_loc); fnode = do_one_spec(walk,equal_loc);
if(!fnode){ if(!fnode){
if(!*errbuf){ /* if didn't already create an error string */ if(!*errbuf){ /* if didn't already create an error string */
@ -289,6 +299,14 @@ out:
free(buf); free(buf);
goto unknown; goto unknown;
} }
if(colon_loc){
if(fnode->next){
free(buf);
goto notmacro;
}
// FIXME: enforce signal width to 8, 9, or 16 (grep: SIGNAL wide_signals)
fnode->width = atoi(colon_loc); // already verified to be a number
}
endp = fnode; while(endp->next) endp = endp->next; /* find end */ endp = fnode; while(endp->next) endp = endp->next; /* find end */
endp->next = sfn->f_cooked; endp->next = sfn->f_cooked;
sfn->f_cooked = fnode; sfn->f_cooked = fnode;
@ -302,6 +320,8 @@ out:
if(0) unknown: err=errbuf; if(0) unknown: err=errbuf;
if(0) empty: err="Empty format list."; if(0) empty: err="Empty format list.";
if(0) improper: err="Improper format list."; if(0) improper: err="Improper format list.";
if(0) badwidth: err="Column widths must be unsigned decimal numbers.";
if(0) notmacro: err="Can't set width for a macro (multi-column) format specifier.";
if(strchr(sfn->sf,'%')) err = aix_format_parse(sfn); if(strchr(sfn->sf,'%')) err = aix_format_parse(sfn);
return err; return err;
} }
@ -733,13 +753,14 @@ static const char *generate_sysv_list(void){
* The "broken" flag enables a really bad Unix98 misfeature. * The "broken" flag enables a really bad Unix98 misfeature.
*/ */
const char *process_sf_options(int localbroken){ const char *process_sf_options(int localbroken){
const char *err;
sf_node *sf_walk; sf_node *sf_walk;
int option_source; /* true if user-defined */ int option_source; /* true if user-defined */
if(personality & PER_BROKEN_o) localbroken = 1; if(personality & PER_BROKEN_o) localbroken = 1;
if(personality & PER_GOOD_o) localbroken = 0; if(personality & PER_GOOD_o) localbroken = 0;
broken = localbroken; broken = localbroken;
if(sf_list){ if(sf_list){
const char *err;
err = parse_O_option(sf_list); err = parse_O_option(sf_list);
if(err) return err; if(err) return err;
} }
@ -782,8 +803,6 @@ const char *process_sf_options(int localbroken){
if(format_flags) return "Conflicting format options."; if(format_flags) return "Conflicting format options.";
option_source = 1; option_source = 1;
}else{ }else{
format_node *fmt_walk;
format_node *fn;
const char *spec; const char *spec;
switch(format_flags){ switch(format_flags){
@ -822,14 +841,32 @@ const char *process_sf_options(int localbroken){
char *tmp; char *tmp;
tmp = getenv("PS_FORMAT"); /* user override kills default */ tmp = getenv("PS_FORMAT"); /* user override kills default */
if(tmp && *tmp){ if(tmp && *tmp){
spec = tmp; const char *err;
option_source = 2; sf_node sfn;
// spec = tmp;
// option_source = 2;
sfn.sf = tmp;
sfn.f_cooked = NULL;
err = format_parse(&sfn);
if(!err){
format_node *fmt_walk;
fmt_walk = sfn.f_cooked;
while(fmt_walk){ /* put any nodes onto format_list in opposite way */
format_node *travler;
travler = fmt_walk;
fmt_walk = fmt_walk->next;
travler->next = format_list;
format_list = travler;
}
return NULL;
}
fprintf(stderr, "Warning: $PS_FORMAT ignored. (%s)\n", err);
} }
} }
if(spec){ if(spec){
fn = do_one_spec(spec, NULL); /* use override "" for no headers */ format_node *fmt_walk;
fmt_walk = fn; fmt_walk = do_one_spec(spec, NULL); /* use override "" for no headers */
while(fmt_walk){ /* put any nodes onto format_list in opposite way */ while(fmt_walk){ /* put any nodes onto format_list in opposite way */
format_node *travler; format_node *travler;
travler = fmt_walk; travler = fmt_walk;
@ -838,6 +875,7 @@ const char *process_sf_options(int localbroken){
format_list = travler; format_list = travler;
} }
}else{ }else{
const char *err;
err = generate_sysv_list(); err = generate_sysv_list();
if(err) return err; if(err) return err;
option_source = 3; option_source = 3;

4
top.c
View File

@ -1434,8 +1434,8 @@ static void rc_write_new (FILE *fp) {
fprintf(fp, RCF_EYECATCHER "\"%s with windows\"\t\t# shameless braggin'\n" fprintf(fp, RCF_EYECATCHER "\"%s with windows\"\t\t# shameless braggin'\n"
, Myname); , Myname);
fprintf(fp, RCF_DEPRECATED fprintf(fp, RCF_DEPRECATED
"Mode_altscr=%d, Mode_irixps=%d, Delay_time=%.3f, Curwin=%d\n" "Mode_altscr=%d, Mode_irixps=%d, Delay_time=%.3f, Curwin=%u\n"
, Rc.mode_altscr, Rc.mode_irixps, Rc.delay_time, Curwin - Winstk); , Rc.mode_altscr, Rc.mode_irixps, Rc.delay_time, (unsigned)(Curwin - Winstk));
for (i = 0; i < GROUPSMAX; i++) { for (i = 0; i < GROUPSMAX; i++) {
char buf[40]; char buf[40];
char *cp = Winstk[i].rc.fieldscur; char *cp = Winstk[i].rc.fieldscur;

2
top.h
View File

@ -368,7 +368,7 @@ typedef struct WIN_t {
#define STATES_line2x5 "%s\03" \ #define STATES_line2x5 "%s\03" \
" %#5.1f%% \02user,\03 %#5.1f%% \02system,\03 %#5.1f%% \02nice,\03 %#5.1f%% \02idle,\03 %#5.1f%% \02IO-wait\03\n" " %#5.1f%% \02user,\03 %#5.1f%% \02system,\03 %#5.1f%% \02nice,\03 %#5.1f%% \02idle,\03 %#5.1f%% \02IO-wait\03\n"
#define STATES_line2x6 "%s\03" \ #define STATES_line2x6 "%s\03" \
" %#4.1f%% \02us,\03 %#4.1f%% \02sy,\03 %#4.1f%% \02ni,\03 %#4.1f%% \02id,\03 %#4.1f%% \02wa,\03 %#4.1f%% \02hi,\03 %#4.1f%% \02si,\03\n" " %#4.1f%% \02us,\03 %#4.1f%% \02sy,\03 %#4.1f%% \02ni,\03 %#4.1f%% \02id,\03 %#4.1f%% \02wa,\03 %#4.1f%% \02hi,\03 %#4.1f%% \02si\03\n"
#ifdef CASEUP_SUMMK #ifdef CASEUP_SUMMK
#define MEMORY_line1 "Mem: \03" \ #define MEMORY_line1 "Mem: \03" \
" %8uK \02total,\03 %8uK \02used,\03 %8uK \02free,\03 %8uK \02buffers\03\n" " %8uK \02total,\03 %8uK \02used,\03 %8uK \02free,\03 %8uK \02buffers\03\n"