SF.net SVN: morphix: [2421] trunk/mmaker/src/make-mini.c
[email protected] Sun, 24 Sep 2006 10:32:52 -0700
| Newsgroups | gmane.linux.morphix.cvs |
|---|---|
| Message-ID | <[email protected]> |
Revision: 2421
http://svn.sourceforge.net/morphix/?rev=2421&view=rev
Author: alextreme
Date: 2006-09-24 10:32:47 -0700 (Sun, 24 Sep 2006)
Log Message:
-----------
* USER (for homedir-minimodules) now optional, defaults to 'morph'
Modified Paths:
--------------
trunk/mmaker/src/make-mini.c
Modified: trunk/mmaker/src/make-mini.c
===================================================================
--- trunk/mmaker/src/make-mini.c 2006-09-23 16:14:39 UTC (rev 2420)
+++ trunk/mmaker/src/make-mini.c 2006-09-24 17:32:47 UTC (rev 2421)
@@ -33,13 +33,13 @@
printf("Currently only support for homedir/overlay modules is implemented\n\n");
printf("Use one of:\n");
- printf("\t--lang LANG:\tuse LANG as the default language (overridden by bootoptions)\n");
- printf("\t--overlay:\tadd files from /tmp/overlay to minimodule\n");
- printf("\t--homedir-hidden USER:\tadd hidden USER's files to minimodule\n");
- printf("\t--homedir USER:\t\tadd non-hidden USER's files to minimodule\n");
- printf("\t--homedir-all USER:\tadd both hidden and non-hidden USER's files to minimodule\n\n");
+ printf("\t--lang LANG:\t\t\tuse LANG as the default language\n\t\t\t\t\t(overridden by bootoptions)\n");
+ printf("\t--overlay:\t\t\tadd files from /tmp/overlay to minimodule\n");
+ printf("\t--homedir [USER]:\t\tadd non-hidden USER's files to minimodule\n");
+ printf("\t--homedir-hidden [USER]:\tadd hidden USER's files to minimodule\n");
+ printf("\t--homedir-all [USER]:\t\tadd both hidden and non-hidden USER's\n\t\t\t\t\tfiles to minimodule\n\n");
printf("\tLANG example: nl_NL@euro\n");
- printf("\tUSER must be a valid user and have a /home/USER directory, ie: morph\n");
+ printf("\tUSER must be a valid user and have a /home/USER directory, ie: myuser.\n\tIf USER is not defined, 'morph' is used by default\n");
printf("\nThis tool is made possible by an infinite amount of monkeys\n");
}
@@ -60,10 +60,13 @@
static struct option long_options[] = {
{"overlay",0,0,0},
+
{"homedir-hidden",1,0,1},
{"homedir",1,0,2},
+ {"homedir-all",1,0,4},
+
{"lang",1,0,3}, // requires LANG argument
- {"homedir-all",1,0,4},
+
{0,0,0,0}
};
@@ -75,39 +78,59 @@
while ((c = getopt_long(argc,argv,"",long_options, &option_index)) != -1) {
switch (c) {
case 0: //files in /tmp/overlay
- opts+=1;
overlay = TRUE;
d=c;
break;
case 1: //homedir-hidden (hidden files only)
- opts+=2;
hidden = TRUE;
homedir = FALSE;
- user = g_strdup(optarg);
+ if (argc > 3) {
+ user = g_strdup(optarg);
+ opts++;
+ }
+ else {
+ user = g_strdup("morph");
+ }
+ opts++;
d=c;
break;
case 2: //homedir
- opts+=2;
homedir = TRUE;
hidden = FALSE;
- user = g_strdup(optarg);
+ if (argc > 3) {
+ user = g_strdup(optarg);
+ opts++;
+ }
+ else {
+ user = g_strdup("morph");
+ }
+ opts++;
d=c;
break;
case 3: // lang
- opts+=2;
langoption = TRUE;
- lang = g_strdup(optarg);
+ if (argc > 3) {
+ lang = g_strdup(optarg);
+ opts++;
+ }
+ opts++;
d=c;
break;
case 4: //homedir-all
- opts+=2;
homedir = TRUE;
hidden = TRUE;
- user = g_strdup(optarg);
+ if (argc > 3) {
+ user = g_strdup(optarg);
+ opts++;
+ }
+ else {
+ user = g_strdup("morph");
+ }
+ opts++;
d=c;
break;
@@ -125,7 +148,7 @@
// use getopt here if we want to have options
- if (opts == 0 || argv[1+opts] == NULL) {
+ if ((homedir == FALSE && overlay == FALSE && hidden == FALSE && langoption == FALSE) || (langoption == TRUE && lang == "")) {
printf("Opts: %d Argc: %d\n",opts,argc);
usage(argv[0]);
return(EXIT_FAILURE);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV