file.c (284237) | file.c (284277) |
---|---|
1/* 2 * Copyright (c) Ian F. Darwin 1986-1995. 3 * Software written by Ian F. Darwin and others; 4 * maintained 1995-present by Christos Zoulas and others. 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: --- 75 unchanged lines hidden (view full) --- 84private int /* Global command-line options */ 85 bflag = 0, /* brief output format */ 86 nopad = 0, /* Don't pad output */ 87 nobuffer = 0, /* Do not buffer stdout */ 88 nulsep = 0; /* Append '\0' to the separator */ 89 90private const char *separator = ":"; /* Default field separator */ 91private const struct option long_options[] = { | 1/* 2 * Copyright (c) Ian F. Darwin 1986-1995. 3 * Software written by Ian F. Darwin and others; 4 * maintained 1995-present by Christos Zoulas and others. 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: --- 75 unchanged lines hidden (view full) --- 84private int /* Global command-line options */ 85 bflag = 0, /* brief output format */ 86 nopad = 0, /* Don't pad output */ 87 nobuffer = 0, /* Do not buffer stdout */ 88 nulsep = 0; /* Append '\0' to the separator */ 89 90private const char *separator = ":"; /* Default field separator */ 91private const struct option long_options[] = { |
92#define OPT_HELP 1 93#define OPT_APPLE 2 94#define OPT_EXTENSIONS 3 95#define OPT_MIME_TYPE 4 96#define OPT_MIME_ENCODING 5 |
|
92#define OPT(shortname, longname, opt, doc) \ 93 {longname, opt, NULL, shortname}, | 97#define OPT(shortname, longname, opt, doc) \ 98 {longname, opt, NULL, shortname}, |
94#define OPT_LONGONLY(longname, opt, doc) \ 95 {longname, opt, NULL, 0}, | 99#define OPT_LONGONLY(longname, opt, doc, id) \ 100 {longname, opt, NULL, id}, |
96#include "file_opts.h" 97#undef OPT 98#undef OPT_LONGONLY 99 {0, 0, NULL, 0} 100}; 101#define OPTSTRING "bcCde:Ef:F:hiklLm:nNpP:rsvzZ0" 102 103private const struct { --- 73 unchanged lines hidden (view full) --- 177 progname = argv[0]; 178 179#ifdef S_IFLNK 180 flags |= getenv("POSIXLY_CORRECT") ? MAGIC_SYMLINK : 0; 181#endif 182 while ((c = getopt_long(argc, argv, OPTSTRING, long_options, 183 &longindex)) != -1) 184 switch (c) { | 101#include "file_opts.h" 102#undef OPT 103#undef OPT_LONGONLY 104 {0, 0, NULL, 0} 105}; 106#define OPTSTRING "bcCde:Ef:F:hiklLm:nNpP:rsvzZ0" 107 108private const struct { --- 73 unchanged lines hidden (view full) --- 182 progname = argv[0]; 183 184#ifdef S_IFLNK 185 flags |= getenv("POSIXLY_CORRECT") ? MAGIC_SYMLINK : 0; 186#endif 187 while ((c = getopt_long(argc, argv, OPTSTRING, long_options, 188 &longindex)) != -1) 189 switch (c) { |
185 case 0 : 186 switch (longindex) { 187 case 0: 188 help(); 189 break; 190 case 10: 191 flags |= MAGIC_APPLE; 192 break; 193 case 11: 194 flags |= MAGIC_EXTENSION; 195 break; 196 case 12: 197 flags |= MAGIC_MIME_TYPE; 198 break; 199 case 13: 200 flags |= MAGIC_MIME_ENCODING; 201 break; 202 } | 190 case OPT_HELP: 191 help(); |
203 break; | 192 break; |
193 case OPT_APPLE: 194 flags |= MAGIC_APPLE; 195 break; 196 case OPT_EXTENSIONS: 197 flags |= MAGIC_EXTENSION; 198 break; 199 case OPT_MIME_TYPE: 200 flags |= MAGIC_MIME_TYPE; 201 break; 202 case OPT_MIME_ENCODING: 203 flags |= MAGIC_MIME_ENCODING; 204 break; |
|
204 case '0': 205 nulsep = 1; 206 break; 207 case 'b': 208 bflag++; 209 break; 210 case 'c': 211 action = FILE_CHECK; --- 378 unchanged lines hidden (view full) --- 590{ 591 (void)fputs( 592"Usage: file [OPTION...] [FILE...]\n" 593"Determine type of FILEs.\n" 594"\n", stdout); 595#define OPT(shortname, longname, opt, doc) \ 596 fprintf(stdout, " -%c, --" longname, shortname), \ 597 docprint(doc); | 205 case '0': 206 nulsep = 1; 207 break; 208 case 'b': 209 bflag++; 210 break; 211 case 'c': 212 action = FILE_CHECK; --- 378 unchanged lines hidden (view full) --- 591{ 592 (void)fputs( 593"Usage: file [OPTION...] [FILE...]\n" 594"Determine type of FILEs.\n" 595"\n", stdout); 596#define OPT(shortname, longname, opt, doc) \ 597 fprintf(stdout, " -%c, --" longname, shortname), \ 598 docprint(doc); |
598#define OPT_LONGONLY(longname, opt, doc) \ | 599#define OPT_LONGONLY(longname, opt, doc, id) \ |
599 fprintf(stdout, " --" longname), \ 600 docprint(doc); 601#include "file_opts.h" 602#undef OPT 603#undef OPT_LONGONLY 604 fprintf(stdout, "\nReport bugs to http://bugs.gw.com/\n"); 605 exit(0); 606} | 600 fprintf(stdout, " --" longname), \ 601 docprint(doc); 602#include "file_opts.h" 603#undef OPT 604#undef OPT_LONGONLY 605 fprintf(stdout, "\nReport bugs to http://bugs.gw.com/\n"); 606 exit(0); 607} |