Lines Matching refs:tf

54 orw_expect(struct t_file *tf, const char *expected, int lines, int eof, int eol)
60 got = openpam_readword(tf->file, &lineno, &len);
61 if (t_ferror(tf))
62 err(1, "%s(): %s", __func__, tf->name);
80 if (eof && !t_feof(tf)) {
84 if (!eof && t_feof(tf)) {
88 ch = fgetc(tf->file);
89 if (t_ferror(tf))
90 err(1, "%s(): %s", __func__, tf->name);
100 ungetc(ch, tf->file);
112 struct t_file *tf;
115 tf = t_fopen(NULL);
116 ret = orw_expect(tf, NULL, 0 /*lines*/, 1 /*eof*/, 0 /*eol*/);
117 t_fclose(tf);
123 struct t_file *tf;
126 tf = t_fopen(NULL);
127 t_fprintf(tf, "\n");
128 t_frewind(tf);
129 ret = orw_expect(tf, NULL, 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
130 t_fclose(tf);
136 struct t_file *tf;
139 tf = t_fopen(NULL);
140 t_fprintf(tf, " ");
141 t_frewind(tf);
142 ret = orw_expect(tf, NULL, 0 /*lines*/, 1 /*eof*/, 0 /*eol*/);
143 t_fclose(tf);
149 struct t_file *tf;
152 tf = t_fopen(NULL);
153 t_fprintf(tf, " \n");
154 t_frewind(tf);
155 ret = orw_expect(tf, NULL, 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
156 t_fclose(tf);
162 struct t_file *tf;
165 tf = t_fopen(NULL);
166 t_fprintf(tf, " \t\r\n");
167 t_frewind(tf);
168 ret = orw_expect(tf, NULL, 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
169 t_fclose(tf);
175 struct t_file *tf;
178 tf = t_fopen(NULL);
179 t_fprintf(tf, "# comment\n");
180 t_frewind(tf);
181 ret = orw_expect(tf, NULL, 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
182 t_fclose(tf);
188 struct t_file *tf;
191 tf = t_fopen(NULL);
192 t_fprintf(tf, " # comment\n");
193 t_frewind(tf);
194 ret = orw_expect(tf, NULL, 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
195 t_fclose(tf);
208 struct t_file *tf;
211 tf = t_fopen(NULL);
212 t_fprintf(tf, "%s\n", word);
213 t_frewind(tf);
214 ret = orw_expect(tf, word, 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
215 t_fclose(tf);
222 struct t_file *tf;
225 tf = t_fopen(NULL);
226 t_fprintf(tf, " %s\n", word);
227 t_frewind(tf);
228 ret = orw_expect(tf, word, 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
229 t_fclose(tf);
236 struct t_file *tf;
239 tf = t_fopen(NULL);
240 t_fprintf(tf, " %s\n", word);
241 t_frewind(tf);
242 ret = orw_expect(tf, word, 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
243 t_fclose(tf);
250 struct t_file *tf;
253 tf = t_fopen(NULL);
254 t_fprintf(tf, "%s \n", word);
255 t_frewind(tf);
256 ret = orw_expect(tf, word, 0 /*lines*/, 0 /*eof*/, 0 /*eol*/);
257 t_fclose(tf);
264 struct t_file *tf;
267 tf = t_fopen(NULL);
268 t_fprintf(tf, "%s \n", word);
269 t_frewind(tf);
270 ret = orw_expect(tf, word, 0 /*lines*/, 0 /*eof*/, 0 /*eol*/);
271 t_fclose(tf);
278 struct t_file *tf;
281 tf = t_fopen(NULL);
282 t_fprintf(tf, "%s # comment\n", word);
283 t_frewind(tf);
284 ret = orw_expect(tf, word, 0 /*lines*/, 0 /*eof*/, 0 /*eol*/) &&
285 orw_expect(tf, NULL, 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
286 t_fclose(tf);
293 struct t_file *tf;
296 tf = t_fopen(NULL);
297 t_fprintf(tf, "%s\n", word);
298 t_frewind(tf);
299 ret = orw_expect(tf, word, 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
300 t_fclose(tf);
307 struct t_file *tf;
310 tf = t_fopen(NULL);
311 t_fprintf(tf, "%s %s\n", word[0], word[1]);
312 t_frewind(tf);
313 ret = orw_expect(tf, word[0], 0 /*lines*/, 0 /*eof*/, 0 /*eol*/) &&
314 orw_expect(tf, word[1], 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
315 t_fclose(tf);
327 struct t_file *tf;
330 tf = t_fopen(NULL);
331 t_fprintf(tf, "\\");
332 t_frewind(tf);
333 ret = orw_expect(tf, NULL, 0 /*lines*/, 1 /*eof*/, 0 /*eol*/);
334 t_fclose(tf);
340 struct t_file *tf;
343 tf = t_fopen(NULL);
344 t_fprintf(tf, "\\\\\n");
345 t_frewind(tf);
346 ret = orw_expect(tf, "\\", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
347 t_fclose(tf);
353 struct t_file *tf;
356 tf = t_fopen(NULL);
357 t_fprintf(tf, "\\ \\\t \\\r \\\n\n");
358 t_frewind(tf);
359 ret = orw_expect(tf, " ", 0 /*lines*/, 0 /*eof*/, 0 /*eol*/) &&
360 orw_expect(tf, "\t", 0 /*lines*/, 0 /*eof*/, 0 /*eol*/) &&
361 orw_expect(tf, "\r", 0 /*lines*/, 0 /*eof*/, 0 /*eol*/) &&
363 orw_expect(tf, NULL, 1 /*lines*/, 0 /*eof*/, 1 /*eol*/);
364 t_fclose(tf);
370 struct t_file *tf;
373 tf = t_fopen(NULL);
374 t_fprintf(tf, "\\\nhello world\n");
375 t_frewind(tf);
376 ret = orw_expect(tf, "hello", 1 /*lines*/, 0 /*eof*/, 0 /*eol*/);
377 t_fclose(tf);
383 struct t_file *tf;
386 tf = t_fopen(NULL);
387 t_fprintf(tf, "hello\\\nworld\n");
388 t_frewind(tf);
389 ret = orw_expect(tf, "helloworld", 1 /*lines*/, 0 /*eof*/, 1 /*eol*/);
390 t_fclose(tf);
396 struct t_file *tf;
399 tf = t_fopen(NULL);
400 t_fprintf(tf, "hello\\\n world\n");
401 t_frewind(tf);
402 ret = orw_expect(tf, "hello", 1 /*lines*/, 0 /*eof*/, 0 /*eol*/);
403 t_fclose(tf);
409 struct t_file *tf;
412 tf = t_fopen(NULL);
413 t_fprintf(tf, "\\z\n");
414 t_frewind(tf);
415 ret = orw_expect(tf, "z", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
416 t_fclose(tf);
428 struct t_file *tf;
431 tf = t_fopen(NULL);
432 t_fprintf(tf, "'");
433 t_frewind(tf);
434 ret = orw_expect(tf, NULL, 0 /*lines*/, 1 /*eof*/, 0 /*eol*/);
435 t_fclose(tf);
441 struct t_file *tf;
444 tf = t_fopen(NULL);
445 t_fprintf(tf, "\"");
446 t_frewind(tf);
447 ret = orw_expect(tf, NULL, 0 /*lines*/, 1 /*eof*/, 0 /*eol*/);
448 t_fclose(tf);
454 struct t_file *tf;
457 tf = t_fopen(NULL);
458 t_fprintf(tf, "''\n");
459 t_frewind(tf);
460 ret = orw_expect(tf, "", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
461 t_fclose(tf);
467 struct t_file *tf;
470 tf = t_fopen(NULL);
471 t_fprintf(tf, "\"\"\n");
472 t_frewind(tf);
473 ret = orw_expect(tf, "", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
474 t_fclose(tf);
480 struct t_file *tf;
483 tf = t_fopen(NULL);
484 t_fprintf(tf, "\"' '\"\n");
485 t_frewind(tf);
486 ret = orw_expect(tf, "' '", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
487 t_fclose(tf);
493 struct t_file *tf;
496 tf = t_fopen(NULL);
497 t_fprintf(tf, "'\" \"'\n");
498 t_frewind(tf);
499 ret = orw_expect(tf, "\" \"", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
500 t_fclose(tf);
506 struct t_file *tf;
509 tf = t_fopen(NULL);
510 t_fprintf(tf, "' ' '\t' '\r' '\n'\n");
511 t_frewind(tf);
512 ret = orw_expect(tf, " ", 0 /*lines*/, 0 /*eof*/, 0 /*eol*/) &&
513 orw_expect(tf, "\t", 0 /*lines*/, 0 /*eof*/, 0 /*eol*/) &&
514 orw_expect(tf, "\r", 0 /*lines*/, 0 /*eof*/, 0 /*eol*/) &&
515 orw_expect(tf, "\n", 1 /*lines*/, 0 /*eof*/, 1 /*eol*/);
516 t_fclose(tf);
522 struct t_file *tf;
525 tf = t_fopen(NULL);
526 t_fprintf(tf, "\" \" \"\t\" \"\r\" \"\n\"\n");
527 t_frewind(tf);
528 ret = orw_expect(tf, " ", 0 /*lines*/, 0 /*eof*/, 0 /*eol*/) &&
529 orw_expect(tf, "\t", 0 /*lines*/, 0 /*eof*/, 0 /*eol*/) &&
530 orw_expect(tf, "\r", 0 /*lines*/, 0 /*eof*/, 0 /*eol*/) &&
531 orw_expect(tf, "\n", 1 /*lines*/, 0 /*eof*/, 1 /*eol*/);
532 t_fclose(tf);
538 struct t_file *tf;
541 tf = t_fopen(NULL);
542 t_fprintf(tf, "'hello world'\n");
543 t_frewind(tf);
544 ret = orw_expect(tf, "hello world", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
545 t_fclose(tf);
551 struct t_file *tf;
554 tf = t_fopen(NULL);
555 t_fprintf(tf, "\"hello world\"\n");
556 t_frewind(tf);
557 ret = orw_expect(tf, "hello world", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
558 t_fclose(tf);
570 struct t_file *tf;
573 tf = t_fopen(NULL);
574 t_fprintf(tf, "'hello 'world\n");
575 t_frewind(tf);
576 ret = orw_expect(tf, "hello world", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
577 t_fclose(tf);
583 struct t_file *tf;
586 tf = t_fopen(NULL);
587 t_fprintf(tf, "\"hello \"world\n");
588 t_frewind(tf);
589 ret = orw_expect(tf, "hello world", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
590 t_fclose(tf);
596 struct t_file *tf;
599 tf = t_fopen(NULL);
600 t_fprintf(tf, "hello' 'world\n");
601 t_frewind(tf);
602 ret = orw_expect(tf, "hello world", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
603 t_fclose(tf);
609 struct t_file *tf;
612 tf = t_fopen(NULL);
613 t_fprintf(tf, "hello\" \"world\n");
614 t_frewind(tf);
615 ret = orw_expect(tf, "hello world", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
616 t_fclose(tf);
622 struct t_file *tf;
625 tf = t_fopen(NULL);
626 t_fprintf(tf, "hello' world'\n");
627 t_frewind(tf);
628 ret = orw_expect(tf, "hello world", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
629 t_fclose(tf);
635 struct t_file *tf;
638 tf = t_fopen(NULL);
639 t_fprintf(tf, "hello\" world\"\n");
640 t_frewind(tf);
641 ret = orw_expect(tf, "hello world", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
642 t_fclose(tf);
655 struct t_file *tf;
658 tf = t_fopen(NULL);
659 t_fprintf(tf, "\\'\n");
660 t_frewind(tf);
661 ret = orw_expect(tf, "'", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
662 t_fclose(tf);
669 struct t_file *tf;
672 tf = t_fopen(NULL);
673 t_fprintf(tf, "\\\"\n");
674 t_frewind(tf);
675 ret = orw_expect(tf, "\"", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
676 t_fclose(tf);
683 struct t_file *tf;
686 tf = t_fopen(NULL);
687 t_fprintf(tf, "'\\ ' '\\\t' '\\\r' '\\\n'\n");
688 t_frewind(tf);
689 ret = orw_expect(tf, "\\ ", 0 /*lines*/, 0 /*eof*/, 0 /*eol*/) &&
690 orw_expect(tf, "\\\t", 0 /*lines*/, 0 /*eof*/, 0 /*eol*/) &&
691 orw_expect(tf, "\\\r", 0 /*lines*/, 0 /*eof*/, 0 /*eol*/) &&
692 orw_expect(tf, "\\\n", 1 /*lines*/, 0 /*eof*/, 1 /*eol*/);
693 t_fclose(tf);
700 struct t_file *tf;
703 tf = t_fopen(NULL);
704 t_fprintf(tf, "\"\\ \" \"\\\t\" \"\\\r\" \"\\\n\"\n");
705 t_frewind(tf);
706 ret = orw_expect(tf, "\\ ", 0 /*lines*/, 0 /*eof*/, 0 /*eol*/) &&
707 orw_expect(tf, "\\\t", 0 /*lines*/, 0 /*eof*/, 0 /*eol*/) &&
708 orw_expect(tf, "\\\r", 0 /*lines*/, 0 /*eof*/, 0 /*eol*/) &&
710 orw_expect(tf, "", 1 /*lines*/, 0 /*eof*/, 1 /*eol*/);
711 t_fclose(tf);
718 struct t_file *tf;
721 tf = t_fopen(NULL);
722 t_fprintf(tf, "'\\z'\n");
723 t_frewind(tf);
724 ret = orw_expect(tf, "\\z", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
725 t_fclose(tf);
732 struct t_file *tf;
735 tf = t_fopen(NULL);
736 t_fprintf(tf, "\"\\z\"\n");
737 t_frewind(tf);
738 ret = orw_expect(tf, "\\z", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
739 t_fclose(tf);
746 struct t_file *tf;
749 tf = t_fopen(NULL);
750 t_fprintf(tf, "'\\\\'\n");
751 t_frewind(tf);
752 ret = orw_expect(tf, "\\\\", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
753 t_fclose(tf);
760 struct t_file *tf;
763 tf = t_fopen(NULL);
764 t_fprintf(tf, "\"\\\\\"\n");
765 t_frewind(tf);
766 ret = orw_expect(tf, "\\", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
767 t_fclose(tf);
774 struct t_file *tf;
777 tf = t_fopen(NULL);
778 t_fprintf(tf, "'\\''\n");
779 t_frewind(tf);
780 ret = orw_expect(tf, NULL, 1 /*lines*/, 1 /*eof*/, 0 /*eol*/);
781 t_fclose(tf);
788 struct t_file *tf;
791 tf = t_fopen(NULL);
792 t_fprintf(tf, "'\\\"'\n");
793 t_frewind(tf);
794 ret = orw_expect(tf, "\\\"", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
795 t_fclose(tf);
802 struct t_file *tf;
805 tf = t_fopen(NULL);
806 t_fprintf(tf, "\"\\'\"\n");
807 t_frewind(tf);
808 ret = orw_expect(tf, "\\'", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
809 t_fclose(tf);
816 struct t_file *tf;
819 tf = t_fopen(NULL);
820 t_fprintf(tf, "\"\\\"\"\n");
821 t_frewind(tf);
822 ret = orw_expect(tf, "\"", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
823 t_fclose(tf);