main.c (178246) | 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: --- 6 unchanged lines hidden (view full) --- 15 * Jordan K. Hubbard 16 * 18 July 1993 17 * 18 * This is the info module. 19 * 20 */ 21 22#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: --- 6 unchanged lines hidden (view full) --- 15 * Jordan K. Hubbard 16 * 18 July 1993 17 * 18 * This is the info module. 19 * 20 */ 21 22#include <sys/cdefs.h> |
23__FBSDID("$FreeBSD: head/usr.sbin/pkg_install/info/main.c 178246 2008-04-16 13:05:35Z flz $"); | 23__FBSDID("$FreeBSD: head/usr.sbin/pkg_install/info/main.c 179433 2008-05-30 14:26:09Z flz $"); |
24 | 24 |
25#include <getopt.h> 26#include <err.h> 27 |
|
25#include "lib.h" 26#include "info.h" | 28#include "lib.h" 29#include "info.h" |
27#include <err.h> | |
28 | 30 |
29static char Options[] = "abcdDe:EfgGhiIjkKl:LmoO:pPqQrRst:vVW:xX"; 30 | |
31int Flags = 0; 32match_t MatchType = MATCH_GLOB; 33Boolean QUIET = FALSE; 34Boolean UseBlkSz = FALSE; 35char *InfoPrefix = (char *)(uintptr_t)""; 36char PlayPen[FILENAME_MAX]; 37char *CheckPkg = NULL; 38char *LookUpOrigin = NULL; 39Boolean KeepPackage = FALSE; 40struct which_head *whead; 41 42static void usage(void); 43 | 31int Flags = 0; 32match_t MatchType = MATCH_GLOB; 33Boolean QUIET = FALSE; 34Boolean UseBlkSz = FALSE; 35char *InfoPrefix = (char *)(uintptr_t)""; 36char PlayPen[FILENAME_MAX]; 37char *CheckPkg = NULL; 38char *LookUpOrigin = NULL; 39Boolean KeepPackage = FALSE; 40struct which_head *whead; 41 42static void usage(void); 43 |
44static char opts[] = "abcdDe:EfgGhiIjkKl:LmoO:pPqQrRst:vVW:xX"; 45static struct option longopts[] = { 46 { "all", no_argument, NULL, 'a' }, 47 { "blocksize", no_argument, NULL, 'b' }, 48 { "exist", required_argument, NULL, 'X' }, 49 { "exists", required_argument, NULL, 'X' }, 50 { "extended", no_argument, NULL, 'e' }, 51 { "help", no_argument, NULL, 'h' }, 52 { "keep", no_argument, NULL, 'K' }, 53 { "no-glob", no_argument, NULL, 'G' }, 54 { "origin", required_argument, NULL, 'O' }, 55 { "quiet", no_argument, NULL, 'q' }, 56 { "regex", no_argument, NULL, 'x' }, 57 { "template", required_argument, NULL, 't' }, 58 { "verbose", no_argument, NULL, 'v' }, 59 { "version", no_argument, NULL, 'P' }, 60 { "which", required_argument, NULL, 'W' }, 61}; 62 |
|
44int 45main(int argc, char **argv) 46{ 47 int ch; 48 char **pkgs, **start; 49 char *pkgs_split; 50 51 whead = malloc(sizeof(struct which_head)); 52 if (whead == NULL) 53 err(2, NULL); 54 TAILQ_INIT(whead); 55 56 pkgs = start = argv; 57 if (argc == 1) { 58 MatchType = MATCH_ALL; 59 Flags = SHOW_INDEX; 60 } | 63int 64main(int argc, char **argv) 65{ 66 int ch; 67 char **pkgs, **start; 68 char *pkgs_split; 69 70 whead = malloc(sizeof(struct which_head)); 71 if (whead == NULL) 72 err(2, NULL); 73 TAILQ_INIT(whead); 74 75 pkgs = start = argv; 76 if (argc == 1) { 77 MatchType = MATCH_ALL; 78 Flags = SHOW_INDEX; 79 } |
61 else while ((ch = getopt(argc, argv, Options)) != -1) { | 80 else while ((ch = getopt_long(argc, argv, opts, longopts, NULL)) != -1) { |
62 switch(ch) { 63 case 'a': 64 MatchType = MATCH_ALL; 65 break; 66 67 case 'b': 68 UseBlkSz = TRUE; 69 break; --- 134 unchanged lines hidden (view full) --- 204 break; 205 } 206 207 case 'P': 208 Flags = SHOW_PTREV; 209 break; 210 211 case 'h': | 81 switch(ch) { 82 case 'a': 83 MatchType = MATCH_ALL; 84 break; 85 86 case 'b': 87 UseBlkSz = TRUE; 88 break; --- 134 unchanged lines hidden (view full) --- 223 break; 224 } 225 226 case 'P': 227 Flags = SHOW_PTREV; 228 break; 229 230 case 'h': |
212 case '?': | |
213 default: 214 usage(); 215 break; 216 } 217 } 218 219 argc -= optind; 220 argv += optind; --- 55 unchanged lines hidden --- | 231 default: 232 usage(); 233 break; 234 } 235 } 236 237 argc -= optind; 238 argv += optind; --- 55 unchanged lines hidden --- |