Re: [Toybox] [CLEANUP][watch.c]

2018-08-24 Thread haroon maqsood
Hi Rob, Thanks Alot, will start on it . Thanks Haroon. From: Rob Landley Sent: Wednesday, August 22, 2018 5:02 PM To: haroon maqsood; toybox@lists.landley.net Subject: Re: [Toybox] [CLEANUP][watch.c] On 08/22/2018 06:10 AM, haroon maqsood wrote: > carry

Re: [Toybox] [CLEANUP][watch.c]

2018-08-22 Thread Rob Landley
On 08/22/2018 06:10 AM, haroon maqsood wrote: > carrying on from the point of knowing what is expected, would you be able to > point me towards a something in the pending directory that you have not > started > on , that i can skim through and perhaps try and cleanup, just to avoid > duplicating

Re: [Toybox] [CLEANUP][watch.c]

2018-08-22 Thread haroon maqsood
skim through and perhaps try and cleanup, just to avoid duplicating efforts. Thanks Haroon. From: Rob Landley Sent: Tuesday, August 21, 2018 3:22 PM To: haroon maqsood; toybox@lists.landley.net Subject: Re: [Toybox] [CLEANUP][watch.c] On 08/20/2018 03:13 AM, haroon

Re: [Toybox] [CLEANUP][watch.c]

2018-08-21 Thread Rob Landley
On 08/20/2018 02:43 PM, enh wrote: > (less importantly, i wondered if the \e escapes in interestingtimes.c are your > plan for the future and will replace \033, or should be \e for consistency. > personally, i find \e less unreadable -- i even prefer \x1b to \033 -- but \e > is > not actually in

Re: [Toybox] [CLEANUP][watch.c]

2018-08-21 Thread Rob Landley
On 08/20/2018 02:39 PM, enh wrote: > speaking of terminal_size, is there a reason it doesn't call  > terminal_probesize > if the ioctl fails? it seems like terminal_probesize is only used in top, in > response to a signal (presumably for SIGWINCH). whereas terminal_size is used > in > all kinds

Re: [Toybox] [CLEANUP][watch.c]

2018-08-21 Thread Rob Landley
On 08/20/2018 03:13 AM, haroon maqsood wrote: > Hi Rob, > Thanks a lot for the feedback,  > Noted, i will be more careful next time . It's a hard problem to get right. (Well, by my standards anyway.) If you do "watch -n 2 sleep 5" on debian you get no output for 5 seconds, and then it updates

Re: [Toybox] [CLEANUP][watch.c]

2018-08-20 Thread enh
(less importantly, i wondered if the \e escapes in interestingtimes.c are your plan for the future and will replace \033, or should be \e for consistency. personally, i find \e less unreadable -- i even prefer \x1b to \033 -- but \e is not actually in the standard.) On Mon, Aug 20, 2018 at 12:39

Re: [Toybox] [CLEANUP][watch.c]

2018-08-20 Thread enh
On Sun, Aug 19, 2018 at 2:44 PM Rob Landley wrote: > On 08/16/2018 08:37 PM, haroon maqsood wrote: > > Hi PFA, > > my attempt at cleanup of watch.c in pending. > > Thanks > > Haroon > > A little more description of what you did would be nice. Let's see... > requiring > -n to be at least one

Re: [Toybox] [CLEANUP][watch.c]

2018-08-20 Thread haroon maqsood
Hi Rob, Thanks a lot for the feedback, Noted, i will be more careful next time . Haroon From: Rob Landley Sent: Sunday, August 19, 2018 9:44 PM To: haroon maqsood; toybox@lists.landley.net Subject: Re: [Toybox] [CLEANUP][watch.c] On 08/16/2018 08:37 PM, haroon

Re: [Toybox] [CLEANUP][watch.c]

2018-08-19 Thread Rob Landley
On 08/16/2018 08:37 PM, haroon maqsood wrote: > Hi PFA, > my attempt at cleanup of watch.c in pending. > Thanks > Haroon A little more description of what you did would be nice. Let's see... requiring -n to be at least one second makes sense, although debian's can do "-n 0.1". (That gets into the

[Toybox] [CLEANUP][watch.c]

2018-08-16 Thread haroon maqsood
Hi PFA, my attempt at cleanup of watch.c in pending. Thanks Haroon From cf2626c0cc19cf0bcc831c289c6fb85ffd54382b Mon Sep 17 00:00:00 2001 From: "maqsood3...@live.com" Date: Fri, 17 Aug 2018 02:25:37 +0100 Subject: [PATCH] watch cleanup --- toys/pending/watch.c | 77

[Toybox] cleanup on dmesg.

2017-06-09 Thread Rob Landley
I lost a couple days to a bad cold. I've got the release notes written up but I don't want to leave dmesg demoted for another release. Did I make it clear how deeply horrible this new API is? We're talking _craptacular_: http://landley.net/notes-2017.html#06-02-2017 Ok, command: first we

[Toybox] [toybox] cleanup in 'netstat.c'

2016-01-21 Thread Lipi C. H. Lee
Hi, Rob. I cleaned up the code in 'netstat.c' as belows. - Adjust to 80 columns - remove a useless function(strchr_nul), variable, type casting and compile warnings(fgets) - clean up netstat command option condition - change useless double pointer to single point and dynamic memory

Re: [Toybox] [toybox] cleanup in 'netstat.c'

2016-01-21 Thread enh
i'm pretty sure a lot of the reformatting here doesn't match rob's intended style. it would be nice to have a .clang-format checked in that's close enough to rob's intended style that we can just automate this to be "good enough" and forget about it... On Thu, Jan 21, 2016 at 2:04 AM, Lipi C. H.

Re: [Toybox] [toybox] cleanup in 'netstat.c'

2016-01-21 Thread Rob Landley
On Thu, Jan 21, 2016 at 4:04 AM, Lipi C. H. Lee wrote: > Hi, Rob. > > I cleaned up the code in 'netstat.c' as belows. > > - Adjust to 80 columns > - remove a useless function(strchr_nul), variable, type casting and compile > warnings(fgets) > - clean up netstat command

[Toybox] [CLEANUP] login.c

2015-08-02 Thread Rob Landley
I've been needing to do a proper cleanup pass on login forever, and finally got around to it. toys/other/login.c | 246 --- 1 file changed, 94 insertions(+), 152 deletions(-) My notes, if you're curious: principle: fewer lines means you can see more

[Toybox] [cleanup] mix.c

2014-12-27 Thread Rob Landley
On 07/29/14 17:15, Bradley Conroy wrote: /* mix.c - A very basic mixer. * * Copyright 2014 Brad Conroy, dedicated to the Public Domain. * I redid mix.c because it segfaulted when I tried it. It still doesn't _work_ for me, but neither does aumix or the xfce volume control knob on this

Re: [Toybox] [cleanup] mix.c

2014-12-27 Thread Isaac Dunham
On Sat, Dec 27, 2014 at 02:56:46PM -0600, Rob Landley wrote: On 07/29/14 17:15, Bradley Conroy wrote: /* mix.c - A very basic mixer. * * Copyright 2014 Brad Conroy, dedicated to the Public Domain. * I redid mix.c because it segfaulted when I tried it. It still doesn't _work_ for

Re: [Toybox] [cleanup] mix.c

2014-12-27 Thread Rob Landley
On 12/27/14 16:20, Isaac Dunham wrote: On Sat, Dec 27, 2014 at 02:56:46PM -0600, Rob Landley wrote: On 07/29/14 17:15, Bradley Conroy wrote: /* mix.c - A very basic mixer. * * Copyright 2014 Brad Conroy, dedicated to the Public Domain. * I redid mix.c because it segfaulted when I tried

Re: [Toybox] [CLEANUP] groupdel

2014-07-07 Thread Ashwini Sharma
On Mon, Jul 7, 2014 at 10:25 AM, Rob Landley r...@landley.net wrote: Haven't checked this in yet because it needs more testing, but patch is attached: GROUP is always toys.optargs[toys.optc-1] so let's move the getgrnam() before the two if/else cases so it's not duplicated. (Speaking of

[Toybox] [CLEANUP] groupdel

2014-07-06 Thread Rob Landley
Haven't checked this in yet because it needs more testing, but patch is attached: GROUP is always toys.optargs[toys.optc-1] so let's move the getgrnam() before the two if/else cases so it's not duplicated. (Speaking of which, in the original code getgrnam() with the corresponding error message

Re: [Toybox] [CLEANUP] makedevs

2014-06-30 Thread Rob Landley
In the absence of a response to wednesday's request for makedevs tests, I just used: #name type mode uid gid major minor start increment count #bcdfp /blah d 755 0 500 /blah/block b 600 0 0 /blah/char c 666 500 500 1 5 3 2 4 /blah/pipe p 777 500 0 Under aboriginal linux, and fixed up the bugs I

[Toybox] [CLEANUP] ifconfig.c commit 921

2014-06-27 Thread Rob Landley
I couldn't find a writeup of 921 and I'm trying to fill out the cleanup.html page, so: Commit 921: http://landley.net/hg/toybox/rev/921 This pass is does a couple things: 1) make sockfd a global so we don't keep reopening the socket 2) inline stuff for future cleanups. The inlines are

Re: [Toybox] [CLEANUP] mkpasswd.c

2014-06-26 Thread Isaac Dunham
On Thu, Jun 26, 2014 at 07:18:31AM -0500, Rob Landley wrote: On 06/26/14 00:20, Isaac Dunham wrote: On Wed, Jun 25, 2014 at 11:02:03PM -0500, Rob Landley wrote: We don't need -m help when we can put the list of supported types in the help text itself. (Unless this is used programmatically

[Toybox] [CLEANUP] makedevs

2014-06-25 Thread Rob Landley
Commit 1362: http://landley.net/hg/toybox/rev/1362 First question: Are there any test command lines I can use for this? The 64 byte limitation on name is arbitrary, it's the start of the string so we might as well just null terminate and use that memory. The help text says to feed '-' to

[Toybox] [CLEANUP] mkpasswd.c

2014-06-25 Thread Rob Landley
Commit 1363: http://landley.net/hg/toybox/rev/1363 Ok, starting with toys/pending/mkpasswd.c: The is_salt_valid() function is only called from one place, and using a regex to check isalnum() or two punctuation characters is a bit overkill. (Since we did not use TOYFLAG_LOCALE we're in the C

Re: [Toybox] [CLEANUP] mkpasswd.c

2014-06-25 Thread Isaac Dunham
On Wed, Jun 25, 2014 at 11:02:03PM -0500, Rob Landley wrote: We don't need -m help when we can put the list of supported types in the help text itself. (Unless this is used programmatically to autodetect support? The ubuntu version outputs a lot of extra verbiage that would make parsing hard,

Re: [Toybox] [CLEANUP] lspci first pass

2014-05-19 Thread Isaac Dunham
Just a couple comments; also, thanks for the explanation! On Sun, May 18, 2014 at 07:58:49PM -0500, Rob Landley wrote: http://landley.net/hg/toybox/rev/1289 Headers info: As long as we've got a config LSPCI_TEXT, have the -n option live there. Add a USE() guard in the NEWTOY() line, and

[Toybox] [CLEANUP] last part 1

2014-05-11 Thread Rob Landley
I keep writing up little notes to self and then forgetting to post 'em. This was from my first pass over last. (Not a huge amount of cleanup, most of it was research.) Currently, toys.h includes utmpx.h but not utmp.h. The reason is that utmpx.h is in posix-2008, and utmp.h isn't:

[Toybox] [CLEANUP] more dd stuff.

2014-05-07 Thread Rob Landley
This dd cleanup has turned into a rewrite and port over sort of thing, so it's not quite the same incremental series of patches as a lot of previous cleanups. I got summary() in (using the new clock_gettime() stuff since the milisecond time querying is apparently deprecated now), and hooked up

Re: [Toybox] [CLEANUP] getty: clean up messages, simplify code

2014-04-12 Thread Rob Landley
On 04/12/14 16:25, Isaac Dunham wrote: getty: build fix, clean up messages, simplify code build fix: xmsprintf has been renamed shorten and lowercase the error messages use xexec() instead of execlp(); perror_exit(); remove redundant variable setting Applied. -- And the rationale:

[Toybox] [CLEANUP] openvt/deallocvt: reindent, remove unneeded O_RDWR

2014-03-29 Thread Isaac Dunham
openvt tries opening several devices to get an fd that points to the current console, without a need for read or write permissions. O_RDWR implies that both O_RDONLY and O_WRONLY would work, so skip it. Reindent. -- I also have a large patch queue for the getty version Ashwini Sharma submitted.

[Toybox] [CLEANUP] uudecode commit 835

2014-01-11 Thread Rob Landley
http://landley.net/hg/toybox/rev/835 Two changes to the NEWTOY() line: only allow at most 1 leftover non-option argument instead of 2 (because POSIX says so), and use TOYFLAG_UMASK to tell the setup code in main.c to set the umask to 0 before calling uudecode's main function. (That way we

[Toybox] [CLEANUP] uudecode 838

2014-01-11 Thread Rob Landley
http://landley.net/hg/toybox/rev/838 Yank the const annotations. uudecode_b64_1byte: The old function had a giant (static) table, the new one is a set of 5 if statements covering the same range. This includes removing a number of comments, because the if statements are reasonably

[Toybox] [CLEANUP] ifconfig commit 862

2014-01-04 Thread Rob Landley
Filling out the cleanup.html page, there are some commits I didn't post message explaining. So I'm backfilling a bit as I fill in the web page. Commit http://landley.net/hg/toybox/rev/862 The usual whitespace collation and inlining. Remove more unused headers. Remove function setport() which

[Toybox] [CLEANUP] ifconfig commit 864

2014-01-04 Thread Rob Landley
Commit http://landley.net/hg/toybox/rev/864 Move the next pointer of struct _iface_list to the start of the struct so we can use the llist infrastructure. Collate iface_flags_str[] to take up fewer lines. Remove set_data() from the prototype list because we're going to inline it everywhere

[Toybox] [CLEANUP] tftpd

2013-12-23 Thread Rob Landley
On 11/24/2013 08:17:24 PM, ibid...@gmail.com wrote: I ran into build errors with tftpd and dumpleases, so here's a fix: POLL_IN is a POSIX macro in signal.h, so we need to use another label. Which libc hit that? toynet.h was deleted before dumpleases was merged. While I was at it, I thought

[Toybox] [CLEANUP] syslogd - Pass 6 + Questions

2013-08-26 Thread Felix Janda
I had broken resolve_config() and the daemonizing (didn't notice the latter because I've always run it in the foreground.)... syslogd doesn't seem very standardized between linux, the BSDs and MAC. Let me consider the options to specify which sockets to listen to: toybox: syslogd -p defsock -a

Re: [Toybox] [CLEANUP] syslogd - Pass 5

2013-08-25 Thread Rob Landley
On 08/24/2013 05:20:06 AM, Felix Janda wrote: Should have tested the previous two patches more than that they compile. The changes -facstr = dec(LOG_FAC(pri), facilitynames); +facstr = dec(pri LOG_FACMASK, facilitynames); -for (tk = !=*; tk; tk++, bits = 1) { +for (tk =

Re: [Toybox] [CLEANUP] syslogd - Pass 5

2013-08-25 Thread Felix Janda
Rob Landley wrote: On 08/24/2013 05:20:06 AM, Felix Janda wrote: [...] If none of these have been applied yet, I could prepare new patches which don't leave the toy broken in between them. I like the incremental nature of it, but I'm still not sure why patch 4 _doesn't_ seem to break

[Toybox] [CLEANUP] syslogd

2013-08-20 Thread Felix Janda
# HG changeset patch # User Felix Janda felix.ja...@posteo.de # Date 1377033348 -7200 # Node ID c8e6b5f10c57bcca7859b4c2891dfdf346ecac6d # Parent f9271a80fedc23b91559f0527da8e9c22d152b5d syslogd: cleanup - Remove structure fd_pair so that sigfd can go into GLOBALS - Remove struct typedefs -

[Toybox] [CLEANUP] du.c

2013-08-18 Thread Rob Landley
Long overdue, cleaning up du.c (which predates the pending directory). http://landley.net/hg/toybox/rev/1010 (and http://127.0.0.1/hg/toybox/rev/1011). Added [-HL] and such to the end of the option string so last option of a given type wins, and fiddled with the help text. The usual

Re: [Toybox] [cleanup] klogd

2013-08-10 Thread Rob Landley
On 08/10/2013 01:28:23 PM, Felix Janda wrote: Hello, below a patch doing the inlining as suggested by Isaac and another patch which moves the common functionality for daemonizing in klogd and syslogd to lib/pending.c. Cheers, Felix Both applied. Rob

Re: [Toybox] [CLEANUP] logger

2013-07-29 Thread Rob Landley
On 07/27/2013 02:30:25 AM, Felix Janda wrote: Ah, I hadn't realized that this is the reason for the short commmit messages for the cleanups. Since the patch isn't (or doesn't seem to be) applied yet. Below there is an edited patch with some more useful commit message. Felix I'd applied it

[Toybox] [CLEANUP] logger

2013-07-24 Thread Felix Janda
Various fixes to logger in below patch. Mainly inline parse_priority(). Many other small changes e.g. s/const//, move around some variables, ... -Felix # HG changeset patch # User Felix Janda felix.ja...@posteo.de # Date 1374706109 -7200 # Node ID 8cc26924c2ef2e862c975a31167a685e18f555ec #

[Toybox] [CLEANUP] ifconfig commit 957

2013-07-20 Thread Rob Landley
http://landley.net/hg/toybox/rev/957 It's been a while. I got a bit blocked on get_sockaddr() cleanup, because although it's only ever called twice (once for ipv6 and once for ipv4), I don't understand what the addresses it's parsing should look like. For example, does local: apply to just

[Toybox] [CLEANUP] paste

2013-07-20 Thread Rob Landley
Description of the paste cleanup that accidentally got checked in during commit 944 because hg import -f has side effects. http://landley.net/hg/toybox/rev/944 (Yes, that commit description is actively ironic. Scroll down to patch.c.) Minor tweaks to the first loop: if -d isn't set then

Re: [Toybox] [CLEANUP] paste

2013-07-20 Thread Felix Janda
Rob Landley wrote: Description of the paste cleanup that accidentally got checked in during commit 944 because hg import -f has side effects. http://landley.net/hg/toybox/rev/944 (Yes, that commit description is actively ironic. Scroll down to patch.c.) [...] The accidental

[Toybox] [CLEANUP] stat's done.

2013-06-02 Thread Rob Landley
I put description text into commits 912, 914, 916, and 917, all building on Felix's work. And then the actual mv was its own commit (918) in hopes of confusing source control less. (Although I did switch default n to default y in the same commit so the file wasn't _identical_...)

[Toybox] [CLEANUP] ifconfig commit 906

2013-05-21 Thread Rob Landley
http://landley.net/hg/toybox/rev/906 I started by doing the table cleanup I mentioned last message, bringing the table back down to three members. I took out the array and made all three members separate, called name, on, and off, and just had the flag setting logic doing two ? : swaps to

[Toybox] [CLEANUP] ifconfig commit 907

2013-05-21 Thread Rob Landley
http://landley.net/hg/toybox/rev/907 --- show_ip_addr The function show_ip_addr() is only ever called from display_ifconfig. It's called four times in a row, so it's better to have it be a function that repeated inline four times. However, it's even better to have it be the body of a loop

[Toybox] [CLEANUP] Next ifconfig pass (commit 905)

2013-05-19 Thread Rob Landley
Cleaning up ifconfig, commit 905: http://landley.net/hg/toybox/rev/905 get_strtou() isn't actually needed: it's a wrapper for strtoul() that's only ever called once. It sets most of its effort setting errno, but all you need to know is that the endptr from strtou isn't the end of the

Re: [Toybox] [CLEANUP] [PATCH] stat: Some cleanup

2013-04-22 Thread Rob Landley
On 04/22/2013 04:27:56 PM, Felix Janda wrote: On 04/21/13 at 11:30pm, Rob Landley wrote: Should %T be implemented? I'd wait for somebody to complain about its absence. I like that approach. Attached is another patch removing unimplemented options/formats and doing a bit of cleanup (mainly

Re: [Toybox] [CLEANUP] stat: Some cleanup

2013-04-21 Thread Felix Janda
On 04/21/13 at 12:09am, Rob Landley wrote: On 04/19/2013 05:28:27 PM, Felix Janda wrote: [snip] The functionality of get_access_str() is also implemented in the ls toy (likely much better). Should something like it be in the library? Once code can be shared by a second command,

Re: [Toybox] [CLEANUP] stat: Some cleanup

2013-04-21 Thread Rob Landley
On 04/21/2013 04:40:16 PM, Felix Janda wrote: If you can come up with a clean way to share the code, go for it. Ok, actually I'd only put something like get_access_str() of stat into the lib. Cool. Although a quick glance at the one in stat implies it doesn't handle the fun combinations of

[Toybox] [CLEANUP]

2013-04-17 Thread Rob Landley
On 04/16/2013 10:18:59 AM, Kyungwan Han wrote: Hello, I learn programming skill and knowledge from following up code cleaning, so I'm checking the change set: http://www.landley.net/hg/toybox/rev/6be04ec7b7ac Ah, I never did summarize that one, did I? Sorry, my day job at Cray's been

[Toybox] [CLEANUP] the rest of uuencode.c

2013-04-16 Thread Rob Landley
The rest of the uuencode cleanup was a big opportunity to inline stuff, put common code next to each other, and then eliminate duplication. Alas, if you edit a file and move it in the same commit, mercurial loses track of it. We can beat the patch out of it via: diff -u (hg cat -r 830