Lines Matching refs:key
97 static void sortkey(const char *key[]);
98 static const char *keymatch(const char *linebuf, const char *key[]);
362 /* return number of strings in key for a given dictionary */
375 /* given a key, construct a diagcode */
378 const char *key[], char *code, size_t maxcode)
393 for (nel = 0; key[nel]; nel++)
394 (void) fprintf(stderr, "\"%s\" ", key[nel]);
399 sortkey(key);
412 if ((rhsp = keymatch(linebuf, key)) != NULL) {
435 /* given a diagcode, return the key (array of strings) */
438 char *key[], int maxkey)
531 key[nel] = NULL;
546 if ((key[nel++] = strdup(beginp)) == NULL) {
622 * sortkey -- make sure key[] array is lexically sorted and without repeats
625 sortkey(const char *key[])
628 int srci; /* source index when iterating through key[] */
629 int dsti; /* dest index when storing elements in key[] */
631 /* count the number of elements in key[] */
632 for (nel = 0; key[nel]; nel++)
638 qsort((void *)key, nel, sizeof (char *), mycmp);
643 if (strcmp(key[srci], key[dsti - 1]) != 0)
644 key[dsti++] = key[srci];
645 key[dsti] = NULL;
651 * assumes that the key[] array has already been lexically sorted.
655 keymatch(const char *linebuf, const char *key[])
665 ptr = key[keynum];
674 return (NULL); /* dict had more strings for key */