|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T s
Length: 1089 (0x441) Types: TextFile Names: »scanf.c«
└─⟦9ae75bfbd⟧ Bits:30007242 EUUGD3: Starter Kit └─⟦aa80fdcbc⟧ »EurOpenD3/mail/ida.5.61.tar.Z« └─⟦4314099ac⟧ └─⟦this⟧ »aux/scanf.c« └─⟦9ae75bfbd⟧ Bits:30007242 EUUGD3: Starter Kit └─⟦bfebc70e2⟧ »EurOpenD3/mail/sendmail-5.65b+IDA-1.4.3.tar.Z« └─⟦f9e35cd84⟧ └─⟦this⟧ »sendmail/ida/aux/scanf.c«
/* ** SCANF -- Program to scan & extract input lines. ** Copyright (c) 1987, 1988 Lennart Lovstrand ** CIS Dept, Univ of Linkoping, Sweden ** ** Use it, abuse it, but don't sell it. ** ** Very simple version 0.11 of Tue Aug 23 12:01:10 BST 1988 */ #include "useful.h" #include <stdio.h> #include <ctype.h> main(argc, argv) int argc; char **argv; { char buf[BUFSIZ], val[BUFSIZ]; FILE *input; bool ignore_case = FALSE; if (argc > 1 && strcmp(argv[1], "-i") == 0) { ignore_case = TRUE; argc--; argv++; } if (argc < 2 || argc > 3) { fprintf(stderr, "usage: scanf [-i] scanf_pattern [file]\n"); exit(1); } if (ignore_case) lower(argv[1]); if (argc == 2) input = stdin; else { input = fopen(argv[2], "r"); if (input == NULL) { perror(argv[2]); exit(1); } } while (fgets(buf, sizeof(buf), input) != NULL) { if (ignore_case) lower(buf); if (sscanf(buf, argv[1], val) == 1) puts(val); } } lower(p) register char *p; { for (; *p != '\0'; p++) if (isupper(*p)) *p = tolower(*p); }