main.c (176593) | main.c (179433) |
---|---|
1/* 2 * 3 * FreeBSD install - a package for the installation and maintainance 4 * of non-core utilities. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 5 unchanged lines hidden (view full) --- 14 * 15 * Jordan K. Hubbard 16 * 18 July 1993 17 * 18 * This is the add module. 19 */ 20 21#include <sys/cdefs.h> | 1/* 2 * 3 * FreeBSD install - a package for the installation and maintainance 4 * of non-core utilities. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 5 unchanged lines hidden (view full) --- 14 * 15 * Jordan K. Hubbard 16 * 18 July 1993 17 * 18 * This is the add module. 19 */ 20 21#include <sys/cdefs.h> |
22__FBSDID("$FreeBSD: head/usr.sbin/pkg_install/add/main.c 176593 2008-02-26 14:35:01Z kensmith $"); | 22__FBSDID("$FreeBSD: head/usr.sbin/pkg_install/add/main.c 179433 2008-05-30 14:26:09Z flz $"); |
23 | 23 |
24#include <err.h> | |
25#include <sys/param.h> 26#include <sys/utsname.h> | 24#include <sys/param.h> 25#include <sys/utsname.h> |
26#include <err.h> 27#include <getopt.h> 28 |
|
27#include "lib.h" 28#include "add.h" 29 | 29#include "lib.h" 30#include "add.h" 31 |
30static char Options[] = "hviIRfFnrp:P:SMt:C:K"; 31 | |
32char *Prefix = NULL; 33Boolean PrefixRecursive = FALSE; 34char *Chroot = NULL; 35Boolean NoInstall = FALSE; 36Boolean NoRecord = FALSE; 37Boolean Remote = FALSE; 38Boolean KeepPackage = FALSE; 39Boolean FailOnAlreadyInstalled = TRUE; --- 50 unchanged lines hidden (view full) --- 90 { 0, 0, NULL } 91}; 92 93static char *getpackagesite(void); 94int getosreldate(void); 95 96static void usage(void); 97 | 32char *Prefix = NULL; 33Boolean PrefixRecursive = FALSE; 34char *Chroot = NULL; 35Boolean NoInstall = FALSE; 36Boolean NoRecord = FALSE; 37Boolean Remote = FALSE; 38Boolean KeepPackage = FALSE; 39Boolean FailOnAlreadyInstalled = TRUE; --- 50 unchanged lines hidden (view full) --- 90 { 0, 0, NULL } 91}; 92 93static char *getpackagesite(void); 94int getosreldate(void); 95 96static void usage(void); 97 |
98static char opts[] = "hviIRfFnrp:P:SMt:C:K"; 99static struct option longopts[] = { 100 { "chroot", required_argument, NULL, 'C' }, 101 { "dry-run", no_argument, NULL, 'n' }, 102 { "force", no_argument, NULL, 'f' }, 103 { "help", no_argument, NULL, 'h' }, 104 { "keep", no_argument, NULL, 'K' }, 105 { "master", no_argument, NULL, 'M' }, 106 { "no-deps", no_argument, NULL, 'i' }, 107 { "no-record", no_argument, NULL, 'R' }, 108 { "no-script", no_argument, NULL, 'I' }, 109 { "prefix", required_argument, NULL, 'p' }, 110 { "remote", no_argument, NULL, 'r' }, 111 { "template", required_argument, NULL, 't' }, 112 { "slave", no_argument, NULL, 'S' }, 113 { "verbose", no_argument, NULL, 'v' }, 114 { NULL, 0, NULL, 0 } 115}; 116 |
|
98int 99main(int argc, char **argv) 100{ 101 int ch, error; 102 char **start; 103 char *cp, *packagesite = NULL, *remotepkg = NULL, *ptr; 104 static char temppackageroot[MAXPATHLEN]; 105 static char pkgaddpath[MAXPATHLEN]; 106 107 if (*argv[0] != '/' && strchr(argv[0], '/') != NULL) 108 PkgAddCmd = realpath(argv[0], pkgaddpath); 109 else 110 PkgAddCmd = argv[0]; 111 112 start = argv; | 117int 118main(int argc, char **argv) 119{ 120 int ch, error; 121 char **start; 122 char *cp, *packagesite = NULL, *remotepkg = NULL, *ptr; 123 static char temppackageroot[MAXPATHLEN]; 124 static char pkgaddpath[MAXPATHLEN]; 125 126 if (*argv[0] != '/' && strchr(argv[0], '/') != NULL) 127 PkgAddCmd = realpath(argv[0], pkgaddpath); 128 else 129 PkgAddCmd = argv[0]; 130 131 start = argv; |
113 while ((ch = getopt(argc, argv, Options)) != -1) { | 132 while ((ch = getopt_long(argc, argv, opts, longopts, NULL)) != -1) { |
114 switch(ch) { 115 case 'v': 116 Verbose++; 117 break; 118 119 case 'p': 120 Prefix = optarg; 121 PrefixRecursive = FALSE; --- 43 unchanged lines hidden (view full) --- 165 166 case 'M': 167 AddMode = MASTER; 168 break; 169 170 case 'C': 171 Chroot = optarg; 172 break; | 133 switch(ch) { 134 case 'v': 135 Verbose++; 136 break; 137 138 case 'p': 139 Prefix = optarg; 140 PrefixRecursive = FALSE; --- 43 unchanged lines hidden (view full) --- 184 185 case 'M': 186 AddMode = MASTER; 187 break; 188 189 case 'C': 190 Chroot = optarg; 191 break; |
192 |
|
173 case 'i': 174 IgnoreDeps = TRUE; 175 break; 176 177 case 'h': | 193 case 'i': 194 IgnoreDeps = TRUE; 195 break; 196 197 case 'h': |
178 case '?': | |
179 default: 180 usage(); 181 break; 182 } 183 } 184 argc -= optind; 185 argv += optind; 186 --- 148 unchanged lines hidden --- | 198 default: 199 usage(); 200 break; 201 } 202 } 203 argc -= optind; 204 argv += optind; 205 --- 148 unchanged lines hidden --- |