-#define ARG_GET_HOST 0
-#define ARG_GET_DISK 1
-#define ARG_GET_DATE 2
-#define ARG_GET_LEVL 3
-
- arg_state = ARG_GET_HOST;
- while(optind < my_argc) {
- switch(arg_state) {
- case ARG_GET_HOST:
- /*
- * New host/disk/date/level set, so allocate a match_list.
- */
- me = alloc(SIZEOF(*me));
- me->hostname = my_argv[optind++];
- me->diskname = "";
- me->datestamp = "";
- me->level = "";
- me->next = match_list;
- match_list = me;
- if(me->hostname[0] != '\0'
- && (errstr=validate_regexp(me->hostname)) != NULL) {
- fprintf(stderr, "%s: bad hostname regex \"%s\": %s\n",
- get_pname(), me->hostname, errstr);
- usage();
- /*NOTREACHED*/
- }
- arg_state = ARG_GET_DISK;
- break;
- case ARG_GET_DISK:
- me->diskname = my_argv[optind++];
- if(me->diskname[0] != '\0'
- && (errstr=validate_regexp(me->diskname)) != NULL) {
- fprintf(stderr, "%s: bad diskname regex \"%s\": %s\n",
- get_pname(), me->diskname, errstr);
- usage();
- /*NOTREACHED*/
- }
- arg_state = ARG_GET_DATE;
- break;
- case ARG_GET_DATE:
- me->datestamp = my_argv[optind++];
- if(me->datestamp[0] != '\0'
- && (errstr=validate_regexp(me->datestamp)) != NULL) {
- fprintf(stderr, "%s: bad datestamp regex \"%s\": %s\n",
- get_pname(), me->datestamp, errstr);
- usage();
- /*NOTREACHED*/
- }
- arg_state = ARG_GET_LEVL;
- break;
- case ARG_GET_LEVL:
- me->level = my_argv[optind++];
- if(me->level[0] != '\0'
- && (errstr=validate_regexp(me->level)) != NULL) {
- fprintf(stderr, "%s: bad level regex \"%s\": %s\n",
- get_pname(), me->level, errstr);
- usage();
- /*NOTREACHED*/
- }
- arg_state = ARG_GET_HOST;
- break;
- }
- }