main.c (179366) | main.c (179433) |
---|---|
1/* 2 * FreeBSD install - a package for the installation and maintainance 3 * of non-core utilities. 4 * 5 * Jordan K. Hubbard 6 * 18 July 1993 7 * 8 * This is the create module. 9 * 10 */ 11 12#include <sys/cdefs.h> | 1/* 2 * FreeBSD install - a package for the installation and maintainance 3 * of non-core utilities. 4 * 5 * Jordan K. Hubbard 6 * 18 July 1993 7 * 8 * This is the create module. 9 * 10 */ 11 12#include <sys/cdefs.h> |
13__FBSDID("$FreeBSD: head/usr.sbin/pkg_install/create/main.c 179366 2008-05-27 19:06:45Z keramida $"); | 13__FBSDID("$FreeBSD: head/usr.sbin/pkg_install/create/main.c 179433 2008-05-30 14:26:09Z flz $"); |
14 | 14 |
15#include <getopt.h> |
|
15#include <err.h> | 16#include <err.h> |
17 |
|
16#include "lib.h" 17#include "create.h" 18 | 18#include "lib.h" 19#include "create.h" 20 |
19static char Options[] = "EGYNnORhjvxyzf:p:P:C:c:d:i:I:k:K:r:t:X:D:m:s:S:o:b:"; 20 | |
21match_t MatchType = MATCH_GLOB; 22char *Prefix = NULL; 23char *Comment = NULL; 24char *Desc = NULL; 25char *SrcDir = NULL; 26char *BaseDir = NULL; 27char *Display = NULL; 28char *Install = NULL; --- 8 unchanged lines hidden (view full) --- 37char *Conflicts = NULL; 38char *Origin = NULL; 39char *InstalledPkg = NULL; 40char PlayPen[FILENAME_MAX]; 41int Dereference = FALSE; 42int PlistOnly = FALSE; 43int Recursive = FALSE; 44int Regenerate = TRUE; | 21match_t MatchType = MATCH_GLOB; 22char *Prefix = NULL; 23char *Comment = NULL; 24char *Desc = NULL; 25char *SrcDir = NULL; 26char *BaseDir = NULL; 27char *Display = NULL; 28char *Install = NULL; --- 8 unchanged lines hidden (view full) --- 37char *Conflicts = NULL; 38char *Origin = NULL; 39char *InstalledPkg = NULL; 40char PlayPen[FILENAME_MAX]; 41int Dereference = FALSE; 42int PlistOnly = FALSE; 43int Recursive = FALSE; 44int Regenerate = TRUE; |
45int Help = FALSE; |
|
45#if defined(__FreeBSD_version) && __FreeBSD_version >= 500039 46enum zipper Zipper = BZIP2; 47#else 48enum zipper Zipper = GZIP; 49#endif 50 51 52static void usage(void); 53 | 46#if defined(__FreeBSD_version) && __FreeBSD_version >= 500039 47enum zipper Zipper = BZIP2; 48#else 49enum zipper Zipper = GZIP; 50#endif 51 52 53static void usage(void); 54 |
55static char opts[] = "EGYNnORhjvxyzf:p:P:C:c:d:i:I:k:K:r:t:X:D:m:s:S:o:b:"; 56static struct option longopts[] = { 57 { "backup", required_argument, NULL, 'b' }, 58 { "extended", no_argument, NULL, 'E' }, 59 { "help", no_argument, &Help, TRUE }, 60 { "no", no_argument, NULL, 'N' }, 61 { "no-glob", no_argument, NULL, 'G' }, 62 { "origin", required_argument, NULL, 'o' }, 63 { "plist-only", no_argument, NULL, 'O' }, 64 { "prefix", required_argument, NULL, 'p' }, 65 { "recursive", no_argument, NULL, 'R' }, 66 { "regex", no_argument, NULL, 'x' }, 67 { "template", required_argument, NULL, 't' }, 68 { "verbose", no_argument, NULL, 'v' }, 69 { "yes", no_argument, NULL, 'Y' }, 70 { NULL, 0, NULL, 0 }, 71}; 72 |
|
54int 55main(int argc, char **argv) 56{ 57 int ch; 58 char **pkgs, **start, *tmp; 59 60 pkgs = start = argv; | 73int 74main(int argc, char **argv) 75{ 76 int ch; 77 char **pkgs, **start, *tmp; 78 79 pkgs = start = argv; |
61 while ((ch = getopt(argc, argv, Options)) != -1) | 80 while ((ch = getopt_long(argc, argv, opts, longopts, NULL)) != -1) |
62 switch(ch) { 63 case 'v': 64 Verbose++; 65 break; 66 67 case 'x': 68 MatchType = MATCH_REGEX; 69 break; --- 118 unchanged lines hidden (view full) --- 188 } 189 } 190 break; 191 192 case 'R': 193 Recursive = TRUE; 194 break; 195 | 81 switch(ch) { 82 case 'v': 83 Verbose++; 84 break; 85 86 case 'x': 87 MatchType = MATCH_REGEX; 88 break; --- 118 unchanged lines hidden (view full) --- 207 } 208 } 209 break; 210 211 case 'R': 212 Recursive = TRUE; 213 break; 214 |
196 case 'n': 197 Regenerate = FALSE; 198 break; | 215 case 0: 216 if (Help) 217 usage(); 218 break; |
199 | 219 |
200 case '?': | |
201 default: 202 usage(); 203 break; 204 } 205 206 argc -= optind; 207 argv += optind; 208 --- 36 unchanged lines hidden --- | 220 default: 221 usage(); 222 break; 223 } 224 225 argc -= optind; 226 argv += optind; 227 --- 36 unchanged lines hidden --- |