[prev in list] [next in list] [prev in thread] [next in thread]
List: ipcop-svn
Subject: [Ipcop-svn] SF.net SVN: ipcop: [594] ipcop/trunk/src/installer
From: owes () users ! sourceforge ! net
Date: 2007-10-29 13:12:42
Message-ID: E1ImUQ6-0001iX-6C () sc8-pr-svn4 ! sourceforge ! net
[Download RAW message or body]
Revision: 594
http://ipcop.svn.sourceforge.net/ipcop/?rev=594&view=rev
Author: owes
Date: 2007-10-29 06:12:41 -0700 (Mon, 29 Oct 2007)
Log Message:
-----------
Move some helper functions around.
It is now (theoretically) possible to use helper.c without hw and newt for \
misc-progs.
Modified Paths:
--------------
ipcop/trunk/src/installer/Makefile
ipcop/trunk/src/installer/common.h
ipcop/trunk/src/installer/hardware.c
ipcop/trunk/src/installer/helper.c
ipcop/trunk/src/installer/installer.c
ipcop/trunk/src/installer/setup.c
Added Paths:
-----------
ipcop/trunk/src/installer/helper_newt.c
Modified: ipcop/trunk/src/installer/Makefile
===================================================================
--- ipcop/trunk/src/installer/Makefile 2007-10-29 12:53:36 UTC (rev 593)
+++ ipcop/trunk/src/installer/Makefile 2007-10-29 13:12:41 UTC (rev 594)
@@ -4,10 +4,10 @@
HEADERS = common.h
-OBJS_INST = installer.o helper.o hardware.o language.o partition.o passwords.c
+OBJS_INST = installer.o helper.o helper_newt.o hardware.o language.o partition.o \
passwords.c LIBS_INST = -lhd_tiny -lsysfs -lnewt -lslang
-OBJS_SETUP = setup.o helper.o hardware.o host_domain.o keymap.o language.o \
passwords.o
-LIBS_SETUP = -lhd_tiny -lsysfs -lnewt -lslang
+OBJS_SETUP = setup.o helper.o helper_newt.o host_domain.o keymap.o language.o \
passwords.o +LIBS_SETUP = -lnewt -lslang
all: installer setup
Modified: ipcop/trunk/src/installer/common.h
===================================================================
--- ipcop/trunk/src/installer/common.h 2007-10-29 12:53:36 UTC (rev 593)
+++ ipcop/trunk/src/installer/common.h 2007-10-29 13:12:41 UTC (rev 594)
@@ -45,11 +45,22 @@
*/
extern FILE *flog;
extern FILE *fstderr;
-
+/*
+ Global variable used in installer (=1) and setup (=0)
+*/
extern int flag_installer;
+/*
+*/
int mysystem(char *command);
+/*
+ Helper, returns the name of the device without '/dev/'
+ Implemented in hardware.c
+*/
char *short_ddev(int disk);
+/*
+ Implemented in helper_newt.c
+*/
void statuswindow(int width, int height, char *title, char *text, ...);
/*
Gets IPCop version number, platform and 'slogan'.
Modified: ipcop/trunk/src/installer/hardware.c
===================================================================
--- ipcop/trunk/src/installer/hardware.c 2007-10-29 12:53:36 UTC (rev 593)
+++ ipcop/trunk/src/installer/hardware.c 2007-10-29 13:12:41 UTC (rev 594)
@@ -211,3 +211,21 @@
if (scsi)
fprintf(flog, "SCSI YES\n");
}
+
+
+//
+//helper, returns the name of the device without '/dev/'
+//
+// Note : what if the device name is under a subdir like '/dev/scsi/sda' ?
+char *
+short_ddev(int disk) {
+ //char *p = 1+strrchr (harddisklist[disk],'/');
+ //if ((p == NULL+1))
+ if (strncmp("/dev/", harddisklist[disk],5) != 0)
+ {
+ fprintf(flog, "HARDDISK %s: cannot interprete this name...\n",
+ harddisklist[disk]);
+ exit (1); // fatal!
+ }
+ return harddisklist[disk]+5;
+}
Modified: ipcop/trunk/src/installer/helper.c
===================================================================
--- ipcop/trunk/src/installer/helper.c 2007-10-29 12:53:36 UTC (rev 593)
+++ ipcop/trunk/src/installer/helper.c 2007-10-29 13:12:41 UTC (rev 594)
@@ -11,7 +11,6 @@
*/
#include <malloc.h>
-#include <newt.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -44,6 +43,9 @@
}
+FILE *flog = NULL;
+FILE *fstderr = NULL;
+
/* Little wrapper. */
int
mysystem(char *command)
@@ -63,62 +65,6 @@
}
-//
-//helper, returns the name of the device without '/dev/'
-//
-// Note : what if the device name is under a subdir like '/dev/scsi/sda' ?
-char *
-short_ddev(int disk) {
- //char *p = 1+strrchr (harddisklist[disk],'/');
- //if ((p == NULL+1))
- if (strncmp("/dev/", harddisklist[disk],5) != 0)
- {
- fprintf(flog, "HARDDISK %s: cannot interprete this name...\n",
- harddisklist[disk]);
- exit (1); // fatal!
- }
- return harddisklist[disk]+5;
-}
-
-
-void
-statuswindow(int width, int height, char *title, char *text, ...)
-{
- newtComponent t, f;
- char *buf = NULL;
- int size = 0;
- int i = 0;
- va_list args;
-
- va_start(args, text);
-
- do
- {
- size += 1000;
- if (buf)
- free(buf);
- buf = malloc(size);
- i = vsnprintf(buf, size, text, args);
- } while (i == size);
-
- va_end(args);
-
- newtCenteredWindow(width, height, title);
-
- t = newtTextbox(1, 1, width - 2, height - 2, NEWT_TEXTBOX_WRAP);
- newtTextboxSetText(t, buf);
- f = newtForm(NULL, NULL, 0);
-
- free(buf);
-
- newtFormAddComponent(f, t);
-
- newtDrawForm(f);
- newtRefresh();
- newtFormDestroy(f);
-}
-
-
/* insert in front of the list */
void add_kv (NODEKV **kvhead, char *key, char *value)
{
Added: ipcop/trunk/src/installer/helper_newt.c
===================================================================
--- ipcop/trunk/src/installer/helper_newt.c (rev 0)
+++ ipcop/trunk/src/installer/helper_newt.c 2007-10-29 13:12:41 UTC (rev 594)
@@ -0,0 +1,53 @@
+/*
+ * helper_newt.c: window helper functions
+ *
+ * This program is distributed under the terms of the GNU General Public
+ * Licence. See the file COPYING for details.
+ *
+ * (c) 2007, the IPCop team
+ *
+ * $Id$
+ *
+ */
+
+
+#include <newt.h>
+#include "common.h"
+
+
+void
+statuswindow(int width, int height, char *title, char *text, ...)
+{
+ newtComponent t, f;
+ char *buf = NULL;
+ int size = 0;
+ int i = 0;
+ va_list args;
+
+ va_start(args, text);
+
+ do
+ {
+ size += 1000;
+ if (buf)
+ free(buf);
+ buf = malloc(size);
+ i = vsnprintf(buf, size, text, args);
+ } while (i == size);
+
+ va_end(args);
+
+ newtCenteredWindow(width, height, title);
+
+ t = newtTextbox(1, 1, width - 2, height - 2, NEWT_TEXTBOX_WRAP);
+ newtTextboxSetText(t, buf);
+ f = newtForm(NULL, NULL, 0);
+
+ free(buf);
+
+ newtFormAddComponent(f, t);
+
+ newtDrawForm(f);
+ newtRefresh();
+ newtFormDestroy(f);
+}
Property changes on: ipcop/trunk/src/installer/helper_newt.c
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: ipcop/trunk/src/installer/installer.c
===================================================================
--- ipcop/trunk/src/installer/installer.c 2007-10-29 12:53:36 UTC (rev 593)
+++ ipcop/trunk/src/installer/installer.c 2007-10-29 13:12:41 UTC (rev 594)
@@ -34,8 +34,6 @@
NODEKV *kv = NULL; // contains a list key=value pairs
-FILE *flog = NULL;
-FILE *fstderr = NULL;
int flag_installer = 1;
// Try to load from network the IPCop tarballs
Modified: ipcop/trunk/src/installer/setup.c
===================================================================
--- ipcop/trunk/src/installer/setup.c 2007-10-29 12:53:36 UTC (rev 593)
+++ ipcop/trunk/src/installer/setup.c 2007-10-29 13:12:41 UTC (rev 594)
@@ -23,8 +23,6 @@
NODEKV *kv = NULL; // contains a list key=value pairs
-FILE *flog = NULL;
-FILE *fstderr = NULL;
int flag_installer = 0;
This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Ipcop-svn mailing list
Ipcop-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipcop-svn
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic