main.c (173412) | 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 delete 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 delete module. 19 * 20 */ 21 22#include <sys/cdefs.h> |
23__FBSDID("$FreeBSD: head/usr.sbin/pkg_install/delete/main.c 173412 2007-11-07 10:53:41Z kevlo $"); | 23__FBSDID("$FreeBSD: head/usr.sbin/pkg_install/delete/main.c 179433 2008-05-30 14:26:09Z flz $"); |
24 25#include <sys/types.h> 26#include <sys/stat.h> | 24 25#include <sys/types.h> 26#include <sys/stat.h> |
27#include <getopt.h> |
|
27#include <err.h> | 28#include <err.h> |
29 |
|
28#include "lib.h" 29#include "delete.h" 30 | 30#include "lib.h" 31#include "delete.h" 32 |
31static char Options[] = "adDfGhinp:rvxX"; 32 | |
33char *Prefix = NULL; 34Boolean CleanDirs = FALSE; 35Boolean Interactive = FALSE; 36Boolean NoDeInstall = FALSE; 37Boolean Recursive = FALSE; 38match_t MatchType = MATCH_GLOB; 39 40static void usage(void); 41 | 33char *Prefix = NULL; 34Boolean CleanDirs = FALSE; 35Boolean Interactive = FALSE; 36Boolean NoDeInstall = FALSE; 37Boolean Recursive = FALSE; 38match_t MatchType = MATCH_GLOB; 39 40static void usage(void); 41 |
42static char opts[] = "adDfGhinp:rvxX"; 43static struct option longopts[] = { 44 { "all", no_argument, NULL, 'a' }, 45 { "clean-dirs", no_argument, NULL, 'd' }, 46 { "dry-run", no_argument, NULL, 'n' }, 47 { "extended", no_argument, NULL, 'X' }, 48 { "force", no_argument, NULL, 'f' }, 49 { "help", no_argument, NULL, 'h' }, 50 { "interactive",no_argument, NULL, 'i' }, 51 { "prefix", required_argument, NULL, 'p' }, 52 { "recursive", no_argument, NULL, 'r' }, 53 { "regex", no_argument, NULL, 'x' }, 54 { "no-glob", no_argument, NULL, 'G' }, 55 { "no-script", no_argument, NULL, 'D' }, 56 { "no-scripts", no_argument, NULL, 'D' }, 57 { "verbose", no_argument, NULL, 'v' }, 58 { NULL, 0, NULL, 0 }, 59}; 60 |
|
42int 43main(int argc, char **argv) 44{ 45 int ch, error; 46 char **pkgs, **start; 47 char *pkgs_split; 48 const char *tmp; 49 struct stat stat_s; 50 51 pkgs = start = argv; | 61int 62main(int argc, char **argv) 63{ 64 int ch, error; 65 char **pkgs, **start; 66 char *pkgs_split; 67 const char *tmp; 68 struct stat stat_s; 69 70 pkgs = start = argv; |
52 while ((ch = getopt(argc, argv, Options)) != -1) | 71 while ((ch = getopt_long(argc, argv, opts, longopts, NULL)) != -1) |
53 switch(ch) { 54 case 'v': 55 Verbose++; 56 break; 57 58 case 'f': 59 Force = TRUE; 60 break; --- 35 unchanged lines hidden (view full) --- 96 Interactive = TRUE; 97 break; 98 99 case 'r': 100 Recursive = TRUE; 101 break; 102 103 case 'h': | 72 switch(ch) { 73 case 'v': 74 Verbose++; 75 break; 76 77 case 'f': 78 Force = TRUE; 79 break; --- 35 unchanged lines hidden (view full) --- 115 Interactive = TRUE; 116 break; 117 118 case 'r': 119 Recursive = TRUE; 120 break; 121 122 case 'h': |
104 case '?': | |
105 default: 106 usage(); 107 break; 108 } 109 110 argc -= optind; 111 argv += optind; 112 --- 49 unchanged lines hidden --- | 123 default: 124 usage(); 125 break; 126 } 127 128 argc -= optind; 129 argv += optind; 130 --- 49 unchanged lines hidden --- |