- ap = argv;
- if (argc)
- ap++;
- while ((p = *ap) != NULL && *p == '-') {
- if (strcmp(p, "-n")==0) {
- nflag = 1;
- } else if (strcmp(p, "-e")==0) {
- eflag = 1;
- } else if (strcmp(p, "-E")==0) {
- eflag = 0;
+ /* Skip argv[0]. */
+ argc--;
+ argv++;
+
+ while (argc > 0 && *argv[0] == '-')
+ {
+ register char *temp;
+ register int ix;
+
+ /*
+ * If it appears that we are handling options, then make sure
+ * that all of the options specified are actually valid.
+ * Otherwise, the string should just be echoed.
+ */
+ temp = argv[0] + 1;
+
+ for (ix = 0; temp[ix]; ix++)
+ {
+ if (strrchr("neE", temp[ix]) == 0)
+ goto just_echo;