199112Sobrien#include <sys/cdefs.h> 299112Sobrien__FBSDID("$FreeBSD$"); 365428Simp 4179020Sbrooks/* 5179020Sbrooks * This material, written by Henry Spencer, was released by him 6179020Sbrooks * into the public domain and is thus not subject to any copyright. 7179020Sbrooks */ 8179020Sbrooks 9194Snate#include <stdio.h> 10200462Sdelphij#include <stdlib.h> 1165428Simp#include <unistd.h> 12194Snate 1387283Sdwmaloneint 14102944Sdwmalonemain(int argc, char *argv[]) 15194Snate{ 16194Snate int c; 17194Snate int status = 0; 18194Snate 19194Snate optind = 2; /* Past the program name and the option letters. */ 2024360Simp while ((c = getopt(argc, argv, argv[1])) != -1) 21194Snate switch (c) { 22194Snate case '?': 23194Snate status = 1; /* getopt routine gave message */ 24194Snate break; 25194Snate default: 26194Snate if (optarg != NULL) 2745279Scracauer printf(" -%c %s", c, optarg); 28194Snate else 29194Snate printf(" -%c", c); 30194Snate break; 31194Snate } 32194Snate printf(" --"); 33194Snate for (; optind < argc; optind++) 34194Snate printf(" %s", argv[optind]); 35194Snate printf("\n"); 3695657Smarkm return status; 37194Snate} 38