Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107141616
D21079.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D21079.id.diff
View Options
Index: head/contrib/elftoolchain/elfcopy/main.c
===================================================================
--- head/contrib/elftoolchain/elfcopy/main.c
+++ head/contrib/elftoolchain/elfcopy/main.c
@@ -1017,13 +1017,16 @@
}
}
- if (optind == argc || optind + 2 < argc)
+ argc -= optind;
+ argv += optind;
+
+ if (argc == 0 || argc > 2)
elfcopy_usage();
- infile = argv[optind];
+ infile = argv[0];
outfile = NULL;
- if (optind + 1 < argc)
- outfile = argv[optind + 1];
+ if (argc > 1)
+ outfile = argv[1];
create_file(ecp, infile, outfile);
}
@@ -1067,7 +1070,10 @@
}
}
- if (optind == argc)
+ argc -= optind;
+ argv += optind;
+
+ if (argc == 0)
mcs_usage();
/* Must specify one operation at least. */
@@ -1104,7 +1110,7 @@
sac->string = string;
}
- for (i = optind; i < argc; i++) {
+ for (i = 0; i < argc; i++) {
/* If only -p is specified, output to /dev/null */
if (print && !append && !compress && !delete)
create_file(ecp, argv[i], "/dev/null");
@@ -1180,21 +1186,24 @@
}
}
+ argc -= optind;
+ argv += optind;
+
if (ecp->strip == 0 &&
((ecp->flags & DISCARD_LOCAL) == 0) &&
((ecp->flags & DISCARD_LLABEL) == 0) &&
lookup_symop_list(ecp, NULL, SYMOP_STRIP) == NULL)
ecp->strip = STRIP_ALL;
- if (optind == argc)
+ if (argc == 0)
strip_usage();
/*
* Only accept a single input file if an output file had been
* specified.
*/
- if (outfile != NULL && argc != (optind + 1))
+ if (outfile != NULL && argc != 1)
strip_usage();
- for (i = optind; i < argc; i++)
+ for (i = 0; i < argc; i++)
create_file(ecp, argv[i], outfile);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jan 11, 6:33 PM (8 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15755319
Default Alt Text
D21079.id.diff (1 KB)
Attached To
Mode
D21079: elfcopy: Stop using optind.
Attached
Detach File
Event Timeline
Log In to Comment