Lines Matching refs:pat
118 Pattern *pat; in parse_pattern_files() local
119 pat = g_malloc (sizeof (*pat)); in parse_pattern_files()
121 pat->command = g_regex_new (command, in parse_pattern_files()
129 if (pat->command == NULL) { in parse_pattern_files()
139 pat->responsetext = responsetext; in parse_pattern_files()
140 pat->reply = g_match_info_fetch (info, 4); in parse_pattern_files()
141 while (pat->reply[strlen (pat->reply) - 1] == '\\') { in parse_pattern_files()
143 pat->reply[strlen (pat->reply) - 1] = '\0'; in parse_pattern_files()
148 origstr = pat->reply; in parse_pattern_files()
149 pat->reply = g_strjoin ("\r\n", origstr, line, NULL); in parse_pattern_files()
152 g_ptr_array_add (patterns, pat); in parse_pattern_files()
456 Pattern *pat = NULL; in handle_cmd() local
486 pat = (Pattern *)g_ptr_array_index (fakemodem->patterns, i); in handle_cmd()
487 if (g_regex_match (pat->command, cmd, 0, NULL)) { in handle_cmd()
495 if (pat->reply && pat->reply[0]) { in handle_cmd()
497 printf (" Reply: '%s'\n", pat->reply); in handle_cmd()
498 rval = write (masterfd, pat->reply, strlen (pat->reply)); in handle_cmd()
499 assert(strlen(pat->reply) == rval); in handle_cmd()
504 return pat->responsetext; /* NULL implies "OK" and keep processing */ in handle_cmd()
529 Pattern *pat; in set_response() local
535 pat = (Pattern *)g_ptr_array_index (fakemodem->patterns, i); in set_response()
536 if (strcmp (g_regex_get_pattern (pat->command), command) == 0) { in set_response()
537 g_free (pat->reply); in set_response()
538 pat->reply = g_strdup (reply); in set_response()
539 g_free (pat->responsetext); in set_response()
540 pat->responsetext = g_strdup (response); in set_response()
547 pat = g_malloc (sizeof (*pat)); in set_response()
548 pat->command = g_regex_new (command, in set_response()
555 if (pat->command == NULL) { in set_response()
557 g_free (pat); in set_response()
560 pat->responsetext = g_strdup (response); in set_response()
561 pat->reply = g_strdup (reply); in set_response()
562 g_ptr_array_add (fakemodem->patterns, pat); in set_response()
573 Pattern *pat; in remove_response() local
577 pat = (Pattern *)g_ptr_array_index (fakemodem->patterns, i); in remove_response()
578 if (strcmp (g_regex_get_pattern (pat->command), command) == 0) { in remove_response()