Lines Matching defs:tf

61 orw_expect(struct t_file *tf, const char *expected, int lines, int eof, int eol)
68 got = openpam_readword(tf->file, &lineno, &len);
70 if (t_ferror(tf))
71 err(1, "%s(): %s", __func__, tf->name);
88 if (eof && !t_feof(tf)) {
92 if (!eof && t_feof(tf)) {
96 ch = fgetc(tf->file);
97 if (t_ferror(tf))
98 err(1, "%s(): %s", __func__, tf->name);
107 ungetc(ch, tf->file);
119 struct t_file *tf;
122 tf = t_fopen(NULL);
123 ret = orw_expect(tf, NULL, 0 /*lines*/, 1 /*eof*/, 0 /*eol*/);
124 t_fclose(tf);
130 struct t_file *tf;
133 tf = t_fopen(NULL);
134 t_fprintf(tf, "\n");
135 t_frewind(tf);
136 ret = orw_expect(tf, NULL, 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
137 t_fclose(tf);
143 struct t_file *tf;
146 tf = t_fopen(NULL);
147 t_fprintf(tf, " ");
148 t_frewind(tf);
149 ret = orw_expect(tf, NULL, 0 /*lines*/, 1 /*eof*/, 0 /*eol*/);
150 t_fclose(tf);
156 struct t_file *tf;
159 tf = t_fopen(NULL);
160 t_fprintf(tf, " \n");
161 t_frewind(tf);
162 ret = orw_expect(tf, NULL, 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
163 t_fclose(tf);
169 struct t_file *tf;
172 tf = t_fopen(NULL);
173 t_fprintf(tf, " \t\r\n");
174 t_frewind(tf);
175 ret = orw_expect(tf, NULL, 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
176 t_fclose(tf);
182 struct t_file *tf;
185 tf = t_fopen(NULL);
186 t_fprintf(tf, " \\\n \n");
187 t_frewind(tf);
188 ret = orw_expect(tf, NULL, 1 /*lines*/, 0 /*eof*/, 1 /*eol*/);
189 t_fclose(tf);
195 struct t_file *tf;
198 tf = t_fopen(NULL);
199 t_fprintf(tf, "# comment\n");
200 t_frewind(tf);
201 ret = orw_expect(tf, NULL, 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
202 t_fclose(tf);
208 struct t_file *tf;
211 tf = t_fopen(NULL);
212 t_fprintf(tf, " # comment\n");
213 t_frewind(tf);
214 ret = orw_expect(tf, NULL, 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
215 t_fclose(tf);
221 struct t_file *tf;
224 tf = t_fopen(NULL);
225 t_fprintf(tf, " '# comment'\n");
226 t_frewind(tf);
227 ret = orw_expect(tf, "# comment", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
228 t_fclose(tf);
234 struct t_file *tf;
237 tf = t_fopen(NULL);
238 t_fprintf(tf, " \"# comment\"\n");
239 t_frewind(tf);
240 ret = orw_expect(tf, "# comment", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
241 t_fclose(tf);
247 struct t_file *tf;
250 tf = t_fopen(NULL);
251 t_fprintf(tf, "# comment");
252 t_frewind(tf);
253 ret = orw_expect(tf, NULL, 0 /*lines*/, 1 /*eof*/, 0 /*eol*/);
254 t_fclose(tf);
267 struct t_file *tf;
270 tf = t_fopen(NULL);
271 t_fprintf(tf, "%s\n", word);
272 t_frewind(tf);
273 ret = orw_expect(tf, word, 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
274 t_fclose(tf);
281 struct t_file *tf;
284 tf = t_fopen(NULL);
285 t_fprintf(tf, " %s\n", word);
286 t_frewind(tf);
287 ret = orw_expect(tf, word, 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
288 t_fclose(tf);
295 struct t_file *tf;
298 tf = t_fopen(NULL);
299 t_fprintf(tf, " %s\n", word);
300 t_frewind(tf);
301 ret = orw_expect(tf, word, 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
302 t_fclose(tf);
309 struct t_file *tf;
312 tf = t_fopen(NULL);
313 t_fprintf(tf, "%s \n", word);
314 t_frewind(tf);
315 ret = orw_expect(tf, word, 0 /*lines*/, 0 /*eof*/, 0 /*eol*/);
316 t_fclose(tf);
323 struct t_file *tf;
326 tf = t_fopen(NULL);
327 t_fprintf(tf, "%s \n", word);
328 t_frewind(tf);
329 ret = orw_expect(tf, word, 0 /*lines*/, 0 /*eof*/, 0 /*eol*/);
330 t_fclose(tf);
337 struct t_file *tf;
340 tf = t_fopen(NULL);
341 t_fprintf(tf, "%s # comment\n", word);
342 t_frewind(tf);
343 ret = orw_expect(tf, word, 0 /*lines*/, 0 /*eof*/, 0 /*eol*/) &&
344 orw_expect(tf, NULL, 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
345 t_fclose(tf);
352 struct t_file *tf;
355 tf = t_fopen(NULL);
356 t_fprintf(tf, "%s\n", word);
357 t_frewind(tf);
358 ret = orw_expect(tf, word, 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
359 t_fclose(tf);
366 struct t_file *tf;
369 tf = t_fopen(NULL);
370 t_fprintf(tf, "%s %s\n", word[0], word[1]);
371 t_frewind(tf);
372 ret = orw_expect(tf, word[0], 0 /*lines*/, 0 /*eof*/, 0 /*eol*/) &&
373 orw_expect(tf, word[1], 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
374 t_fclose(tf);
386 struct t_file *tf;
389 tf = t_fopen(NULL);
390 t_fprintf(tf, "\\");
391 t_frewind(tf);
392 ret = orw_expect(tf, NULL, 0 /*lines*/, 1 /*eof*/, 0 /*eol*/);
393 t_fclose(tf);
399 struct t_file *tf;
402 tf = t_fopen(NULL);
403 t_fprintf(tf, "\\\\\n");
404 t_frewind(tf);
405 ret = orw_expect(tf, "\\", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
406 t_fclose(tf);
412 struct t_file *tf;
415 tf = t_fopen(NULL);
416 t_fprintf(tf, "\\ \\\t \\\r \\\n\n");
417 t_frewind(tf);
418 ret = orw_expect(tf, " ", 0 /*lines*/, 0 /*eof*/, 0 /*eol*/) &&
419 orw_expect(tf, "\t", 0 /*lines*/, 0 /*eof*/, 0 /*eol*/) &&
420 orw_expect(tf, "\r", 0 /*lines*/, 0 /*eof*/, 0 /*eol*/) &&
422 orw_expect(tf, NULL, 1 /*lines*/, 0 /*eof*/, 1 /*eol*/);
423 t_fclose(tf);
429 struct t_file *tf;
432 tf = t_fopen(NULL);
433 t_fprintf(tf, "\\\nhello world\n");
434 t_frewind(tf);
435 ret = orw_expect(tf, "hello", 1 /*lines*/, 0 /*eof*/, 0 /*eol*/);
436 t_fclose(tf);
442 struct t_file *tf;
445 tf = t_fopen(NULL);
446 t_fprintf(tf, "hello\\\nworld\n");
447 t_frewind(tf);
448 ret = orw_expect(tf, "helloworld", 1 /*lines*/, 0 /*eof*/, 1 /*eol*/);
449 t_fclose(tf);
455 struct t_file *tf;
458 tf = t_fopen(NULL);
459 t_fprintf(tf, "hello\\\n world\n");
460 t_frewind(tf);
461 ret = orw_expect(tf, "hello", 1 /*lines*/, 0 /*eof*/, 0 /*eol*/);
462 t_fclose(tf);
468 struct t_file *tf;
471 tf = t_fopen(NULL);
472 t_fprintf(tf, "\\z\n");
473 t_frewind(tf);
474 ret = orw_expect(tf, "z", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
475 t_fclose(tf);
481 struct t_file *tf;
484 tf = t_fopen(NULL);
485 t_fprintf(tf, " \\# comment\n");
486 t_frewind(tf);
487 ret = orw_expect(tf, "#", 0 /*lines*/, 0 /*eof*/, 0 /*eol*/) &&
488 orw_expect(tf, "comment", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
489 t_fclose(tf);
495 struct t_file *tf;
498 tf = t_fopen(NULL);
499 t_fprintf(tf, "z\\");
500 t_frewind(tf);
501 ret = orw_expect(tf, NULL, 0 /*lines*/, 1 /*eof*/, 0 /*eol*/);
502 t_fclose(tf);
511 struct t_file *tf;
514 tf = t_fopen(NULL);
515 t_fprintf(tf, " \\# comment\n");
516 t_frewind(tf);
517 ret = orw_expect(tf, "#", 0 /*lines*/, 0 /*eof*/, 0 /*eol*/) &&
518 orw_expect(tf, "comment", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
519 t_fclose(tf);
525 struct t_file *tf;
528 tf = t_fopen(NULL);
529 t_fprintf(tf, "z\\");
530 t_frewind(tf);
531 ret = orw_expect(tf, NULL, 0 /*lines*/, 1 /*eof*/, 0 /*eol*/);
532 t_fclose(tf);
541 struct t_file *tf;
544 tf = t_fopen(NULL);
545 t_fprintf(tf, "'");
546 t_frewind(tf);
547 ret = orw_expect(tf, NULL, 0 /*lines*/, 1 /*eof*/, 0 /*eol*/);
548 t_fclose(tf);
554 struct t_file *tf;
557 tf = t_fopen(NULL);
558 t_fprintf(tf, "\"");
559 t_frewind(tf);
560 ret = orw_expect(tf, NULL, 0 /*lines*/, 1 /*eof*/, 0 /*eol*/);
561 t_fclose(tf);
567 struct t_file *tf;
570 tf = t_fopen(NULL);
571 t_fprintf(tf, "''\n");
572 t_frewind(tf);
573 ret = orw_expect(tf, "", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
574 t_fclose(tf);
580 struct t_file *tf;
583 tf = t_fopen(NULL);
584 t_fprintf(tf, "\"\"\n");
585 t_frewind(tf);
586 ret = orw_expect(tf, "", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
587 t_fclose(tf);
593 struct t_file *tf;
596 tf = t_fopen(NULL);
597 t_fprintf(tf, "\"' '\"\n");
598 t_frewind(tf);
599 ret = orw_expect(tf, "' '", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
600 t_fclose(tf);
606 struct t_file *tf;
609 tf = t_fopen(NULL);
610 t_fprintf(tf, "'\" \"'\n");
611 t_frewind(tf);
612 ret = orw_expect(tf, "\" \"", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
613 t_fclose(tf);
619 struct t_file *tf;
622 tf = t_fopen(NULL);
623 t_fprintf(tf, "' ' '\t' '\r' '\n'\n");
624 t_frewind(tf);
625 ret = orw_expect(tf, " ", 0 /*lines*/, 0 /*eof*/, 0 /*eol*/) &&
626 orw_expect(tf, "\t", 0 /*lines*/, 0 /*eof*/, 0 /*eol*/) &&
627 orw_expect(tf, "\r", 0 /*lines*/, 0 /*eof*/, 0 /*eol*/) &&
628 orw_expect(tf, "\n", 1 /*lines*/, 0 /*eof*/, 1 /*eol*/);
629 t_fclose(tf);
635 struct t_file *tf;
638 tf = t_fopen(NULL);
639 t_fprintf(tf, "\" \" \"\t\" \"\r\" \"\n\"\n");
640 t_frewind(tf);
641 ret = orw_expect(tf, " ", 0 /*lines*/, 0 /*eof*/, 0 /*eol*/) &&
642 orw_expect(tf, "\t", 0 /*lines*/, 0 /*eof*/, 0 /*eol*/) &&
643 orw_expect(tf, "\r", 0 /*lines*/, 0 /*eof*/, 0 /*eol*/) &&
644 orw_expect(tf, "\n", 1 /*lines*/, 0 /*eof*/, 1 /*eol*/);
645 t_fclose(tf);
651 struct t_file *tf;
654 tf = t_fopen(NULL);
655 t_fprintf(tf, "'hello world'\n");
656 t_frewind(tf);
657 ret = orw_expect(tf, "hello world", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
658 t_fclose(tf);
664 struct t_file *tf;
667 tf = t_fopen(NULL);
668 t_fprintf(tf, "\"hello world\"\n");
669 t_frewind(tf);
670 ret = orw_expect(tf, "hello world", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
671 t_fclose(tf);
683 struct t_file *tf;
686 tf = t_fopen(NULL);
687 t_fprintf(tf, "'hello 'world\n");
688 t_frewind(tf);
689 ret = orw_expect(tf, "hello world", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
690 t_fclose(tf);
696 struct t_file *tf;
699 tf = t_fopen(NULL);
700 t_fprintf(tf, "\"hello \"world\n");
701 t_frewind(tf);
702 ret = orw_expect(tf, "hello world", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
703 t_fclose(tf);
709 struct t_file *tf;
712 tf = t_fopen(NULL);
713 t_fprintf(tf, "hello' 'world\n");
714 t_frewind(tf);
715 ret = orw_expect(tf, "hello world", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
716 t_fclose(tf);
722 struct t_file *tf;
725 tf = t_fopen(NULL);
726 t_fprintf(tf, "hello\" \"world\n");
727 t_frewind(tf);
728 ret = orw_expect(tf, "hello world", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
729 t_fclose(tf);
735 struct t_file *tf;
738 tf = t_fopen(NULL);
739 t_fprintf(tf, "hello' world'\n");
740 t_frewind(tf);
741 ret = orw_expect(tf, "hello world", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
742 t_fclose(tf);
748 struct t_file *tf;
751 tf = t_fopen(NULL);
752 t_fprintf(tf, "hello\" world\"\n");
753 t_frewind(tf);
754 ret = orw_expect(tf, "hello world", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
755 t_fclose(tf);
768 struct t_file *tf;
771 tf = t_fopen(NULL);
772 t_fprintf(tf, "\\'\n");
773 t_frewind(tf);
774 ret = orw_expect(tf, "'", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
775 t_fclose(tf);
782 struct t_file *tf;
785 tf = t_fopen(NULL);
786 t_fprintf(tf, "\\\"\n");
787 t_frewind(tf);
788 ret = orw_expect(tf, "\"", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
789 t_fclose(tf);
796 struct t_file *tf;
799 tf = t_fopen(NULL);
800 t_fprintf(tf, "'\\ ' '\\\t' '\\\r' '\\\n'\n");
801 t_frewind(tf);
802 ret = orw_expect(tf, "\\ ", 0 /*lines*/, 0 /*eof*/, 0 /*eol*/) &&
803 orw_expect(tf, "\\\t", 0 /*lines*/, 0 /*eof*/, 0 /*eol*/) &&
804 orw_expect(tf, "\\\r", 0 /*lines*/, 0 /*eof*/, 0 /*eol*/) &&
805 orw_expect(tf, "\\\n", 1 /*lines*/, 0 /*eof*/, 1 /*eol*/);
806 t_fclose(tf);
813 struct t_file *tf;
816 tf = t_fopen(NULL);
817 t_fprintf(tf, "\"\\ \" \"\\\t\" \"\\\r\" \"\\\n\"\n");
818 t_frewind(tf);
819 ret = orw_expect(tf, "\\ ", 0 /*lines*/, 0 /*eof*/, 0 /*eol*/) &&
820 orw_expect(tf, "\\\t", 0 /*lines*/, 0 /*eof*/, 0 /*eol*/) &&
821 orw_expect(tf, "\\\r", 0 /*lines*/, 0 /*eof*/, 0 /*eol*/) &&
823 orw_expect(tf, "", 1 /*lines*/, 0 /*eof*/, 1 /*eol*/);
824 t_fclose(tf);
831 struct t_file *tf;
834 tf = t_fopen(NULL);
835 t_fprintf(tf, "'\\z'\n");
836 t_frewind(tf);
837 ret = orw_expect(tf, "\\z", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
838 t_fclose(tf);
845 struct t_file *tf;
848 tf = t_fopen(NULL);
849 t_fprintf(tf, "\"\\z\"\n");
850 t_frewind(tf);
851 ret = orw_expect(tf, "\\z", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
852 t_fclose(tf);
859 struct t_file *tf;
862 tf = t_fopen(NULL);
863 t_fprintf(tf, "'\\\\'\n");
864 t_frewind(tf);
865 ret = orw_expect(tf, "\\\\", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
866 t_fclose(tf);
873 struct t_file *tf;
876 tf = t_fopen(NULL);
877 t_fprintf(tf, "\"\\\\\"\n");
878 t_frewind(tf);
879 ret = orw_expect(tf, "\\", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
880 t_fclose(tf);
887 struct t_file *tf;
890 tf = t_fopen(NULL);
891 t_fprintf(tf, "'\\''\n");
892 t_frewind(tf);
893 ret = orw_expect(tf, NULL, 1 /*lines*/, 1 /*eof*/, 0 /*eol*/);
894 t_fclose(tf);
901 struct t_file *tf;
904 tf = t_fopen(NULL);
905 t_fprintf(tf, "'\\\"'\n");
906 t_frewind(tf);
907 ret = orw_expect(tf, "\\\"", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
908 t_fclose(tf);
915 struct t_file *tf;
918 tf = t_fopen(NULL);
919 t_fprintf(tf, "\"\\'\"\n");
920 t_frewind(tf);
921 ret = orw_expect(tf, "\\'", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
922 t_fclose(tf);
929 struct t_file *tf;
932 tf = t_fopen(NULL);
933 t_fprintf(tf, "\"\\\"\"\n");
934 t_frewind(tf);
935 ret = orw_expect(tf, "\"", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
936 t_fclose(tf);
948 struct t_file *tf;
951 tf = t_fopen(NULL);
952 t_fprintf(tf, "hello \\\n world\n");
953 t_frewind(tf);
954 ret = orw_expect(tf, "hello", 0 /*lines*/, 0 /*eof*/, 0 /*eol*/) &&
955 orw_expect(tf, "world", 1 /*lines*/, 0 /*eof*/, 1 /*eol*/);
956 t_fclose(tf);
962 struct t_file *tf;
965 tf = t_fopen(NULL);
966 t_fprintf(tf, "hello\\\n world\n");
967 t_frewind(tf);
968 ret = orw_expect(tf, "hello", 1 /*lines*/, 0 /*eof*/, 0 /*eol*/) &&
969 orw_expect(tf, "world", 0 /*lines*/, 0 /*eof*/, 1 /*eol*/);
970 t_fclose(tf);
976 struct t_file *tf;
979 tf = t_fopen(NULL);
980 t_fprintf(tf, "hello \\\nworld\n");
981 t_frewind(tf);
982 ret = orw_expect(tf, "hello", 0 /*lines*/, 0 /*eof*/, 0 /*eol*/) &&
983 orw_expect(tf, "world", 1 /*lines*/, 0 /*eof*/, 1 /*eol*/);
984 t_fclose(tf);
990 struct t_file *tf;
993 tf = t_fopen(NULL);
994 t_fprintf(tf, "hello\\\nworld\n");
995 t_frewind(tf);
996 ret = orw_expect(tf, "helloworld", 1 /*lines*/, 0 /*eof*/, 1 /*eol*/);
997 t_fclose(tf);