From 2b55d867035706fc585e29673469a573221dbf90 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Wed, 1 Jan 2014 15:00:44 -0600 Subject: More work on the cleanup page, partway through describing ifconfig. --- www/cleanup.html | 150 ++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 111 insertions(+), 39 deletions(-) (limited to 'www/cleanup.html') diff --git a/www/cleanup.html b/www/cleanup.html index bb5da4cc..998ae09e 100644 --- a/www/cleanup.html +++ b/www/cleanup.html @@ -1,9 +1,26 @@ +

Index

+ + + +
+ +

Cleaning up the toybox code.

-

Toybox -hasn't always taken proper advantage of external contributions. +

Toybox hasn't always +taken proper advantage of external contributions. Lots of people want to help, but their contributions languish out of tree or in the "pending" directory, awaiting cleanup.

@@ -13,42 +30,46 @@ auditing. Writing "another" implementation of standard command line tools isn't very interesting, they should be _better_ implementations. Unfortunately, this means existing, working commands often take more effort to clean up to Toybox's standards than writing a new one from scratch, not -because they don't work, but because we require an unusual level of polish.

+because they don't work, but because we aim for an unusual level of polish.

In hopes of teaching more people how to do this cleanup work, I've started breaking cleanup changes into smaller chunks and posting explanations of each change to the mailing list. -Below are indexes of each cleanup series. Line/byte totals of completed -series are given for scale, but the point of this work is simplicity, not -size.

+Below are indexes of such cleanup series. Each commit and post are meant to +be read together: each description explains what the corresponding patch +was trying to accomplish.

-

(Note: mercurial's web viewer doesn't follow renames, so the commit list -links may not show the final version of each file moved from the "pending" +

Line/byte totals of completed series are given for scale, but the point +of this work is simplicity and compactness, not size per se.

+ +

(Note: mercurial's web viewer doesn't follow renames, so although each +command name links to a commit list with the bulk of the changes, it may +not include the final version of each file moved from the "pending" directory to its final location. The summaries link the initial and cleaned versions of each file when giving line counts.)


-

General advice and/or policy:

- -

Error messages and internationalization.

+ +

General advice and/or policy.

-

Why not "const"?

+

The design of toybox page and the coding +style section at the start of the source code walkthrough +don't cover everything. Here are some +links to mailing list messages that cover various programming topics +not directly related to a specific cleanup series:

-

(I leave the Why not "bool"? explanation to Linus Torvalds.)

- -

Rationale for removing debug code, the interesting bit says:

-

Rule of thumb: other people's debugging printfs are seldom as -useful as your own debugging printfs. Because you know what your output -_means_, and if you can't annotate the code to dump what you need you haven't -read enough of it yet. -

+
-

uuencode and -uudecode -

+

uuencode

This is an example of cleaning up something that started in a condition most projects would be quite happy with. @@ -75,7 +96,9 @@ description: test suite.

Status: COMPLETE

-

I tried to do the uudecode cleanup in smaller stages:

+

uudecode

+ +

I tried to do the uudecode cleanup in smaller stages than uuencode: