style cleanup and tab correction; clean up single character vars

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40322 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Alexander von Gluck IV
2011-01-30 16:50:27 +00:00
parent 95d84e4176
commit 2ab028f7d4
2 changed files with 25 additions and 21 deletions
@@ -28,6 +28,8 @@ get_nth_addon(image_id image, int index)
// #pragma mark - // #pragma mark -
ServicesAddOn::ServicesAddOn(image_id image) ServicesAddOn::ServicesAddOn(image_id image)
: :
NetworkSetupAddOn(image) NetworkSetupAddOn(image)
@@ -45,13 +47,13 @@ ServicesAddOn::CreateView(BRect* bounds)
BRect rlv = r.InsetByCopy(2, 2); BRect rlv = r.InsetByCopy(2, 2);
rlv.right -= B_V_SCROLL_BAR_WIDTH; rlv.right -= B_V_SCROLL_BAR_WIDTH;
fServicesListView = new BListView(rlv, "system_services", fServicesListView = new BListView(rlv, "system_services",
B_SINGLE_SELECTION_LIST, B_FOLLOW_ALL_SIDES); B_SINGLE_SELECTION_LIST, B_FOLLOW_ALL_SIDES);
BScrollView* sv = new BScrollView( "system_services_scrollview", BScrollView* sv = new BScrollView( "system_services_scrollview",
fServicesListView, B_FOLLOW_ALL_SIDES, fServicesListView, B_FOLLOW_ALL_SIDES,
B_WILL_DRAW | B_FRAME_EVENTS, false, true); B_WILL_DRAW | B_FRAME_EVENTS, false, true);
if (ParseInetd() == B_ERROR) if (ParseInetd() != B_OK)
ParseXinetd(); ParseXinetd();
*bounds = r; *bounds = r;
@@ -64,12 +66,12 @@ ServicesAddOn::ParseInetd()
{ {
FILE *f = fopen("/etc/inetd.conf", "r"); FILE *f = fopen("/etc/inetd.conf", "r");
if (f) { if (f) {
char line[1024], *l; char line[1024], *linePtr;
char *token; char *token;
while (fgets(line, sizeof(line), f)) { while (fgets(line, sizeof(line), f)) {
l = line; linePtr = line;
if (! *l) if (! *linePtr)
continue; continue;
if (line[0] == '#') { if (line[0] == '#') {
@@ -78,7 +80,7 @@ ServicesAddOn::ParseInetd()
line[1] == '\r') line[1] == '\r')
// skip comments // skip comments
continue; continue;
l++; // jump the disable/comment service mark linePtr++; // jump the disable/comment service mark
} }
BString label; BString label;
@@ -103,19 +105,20 @@ ServicesAddOn::ParseXinetd()
{ {
FILE *f = fopen("/boot/common/settings/network/services", "r"); FILE *f = fopen("/boot/common/settings/network/services", "r");
if (f) { if (f) {
char line[1024], *l; char line[1024], *linePtr;
char *token; char *token;
char *loc; char *loc;
while (fgets(line, sizeof(line), f)) { while (fgets(line, sizeof(line), f)) {
l = line; linePtr = line;
if (! *l) if (! *linePtr)
continue; continue;
if (line[0] == '#' || line[0] == '\n') if (line[0] == '#' || line[0] == '\n') {
// Skip commented out lines
continue; continue;
// Skip commented out lines }
loc = strstr(l, "service "); loc = strstr(l, "service ");
@@ -6,15 +6,16 @@
* Alexander von Gluck, [email protected] * Alexander von Gluck, [email protected]
*/ */
#include "NetworkSetupAddOn.h" #include "NetworkSetupAddOn.h"
class ServicesAddOn : public NetworkSetupAddOn { class ServicesAddOn : public NetworkSetupAddOn {
protected: protected:
BListView* fServicesListView; BListView* fServicesListView;
public: public:
ServicesAddOn(image_id addon_image); ServicesAddOn(image_id addon_image);
BView* CreateView(BRect* bounds); BView* CreateView(BRect* bounds);
const char* Name() { return "Services"; }; const char* Name() { return "Services"; };
status_t ParseInetd(); status_t ParseInetd();
status_t ParseXinetd(); status_t ParseXinetd();
}; };