from.c (99143) | from.c (102944) |
---|---|
1/* 2 * Copyright (c) 1980, 1988, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 29 unchanged lines hidden (view full) --- 38#endif /* not lint */ 39 40#ifndef lint 41#if 0 42static char sccsid[] = "@(#)from.c 8.1 (Berkeley) 6/6/93"; 43#endif 44#endif /* not lint */ 45#include <sys/cdefs.h> | 1/* 2 * Copyright (c) 1980, 1988, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 29 unchanged lines hidden (view full) --- 38#endif /* not lint */ 39 40#ifndef lint 41#if 0 42static char sccsid[] = "@(#)from.c 8.1 (Berkeley) 6/6/93"; 43#endif 44#endif /* not lint */ 45#include <sys/cdefs.h> |
46__FBSDID("$FreeBSD: head/usr.bin/from/from.c 99143 2002-06-30 17:36:54Z jmallett $"); | 46__FBSDID("$FreeBSD: head/usr.bin/from/from.c 102944 2002-09-04 23:29:10Z dwmalone $"); |
47 48#include <sys/types.h> 49#include <ctype.h> 50#include <err.h> 51#include <pwd.h> 52#include <stdio.h> 53#include <stdlib.h> 54#include <paths.h> 55#include <string.h> 56#include <unistd.h> 57 | 47 48#include <sys/types.h> 49#include <ctype.h> 50#include <err.h> 51#include <pwd.h> 52#include <stdio.h> 53#include <stdlib.h> 54#include <paths.h> 55#include <string.h> 56#include <unistd.h> 57 |
58int match(char *, char *); | 58int match(const char *, const char *); |
59static void usage(void); 60 61int 62main(int argc, char **argv) 63{ 64 FILE *mbox; 65 struct passwd *pwd; 66 int ch, count, newline; | 59static void usage(void); 60 61int 62main(int argc, char **argv) 63{ 64 FILE *mbox; 65 struct passwd *pwd; 66 int ch, count, newline; |
67 char *file, *sender, *p; | 67 const char *file; 68 char *sender, *p; |
68#if MAXPATHLEN > BUFSIZ 69 char buf[MAXPATHLEN]; 70#else 71 char buf[BUFSIZ]; 72#endif 73 74 file = sender = NULL; 75 count = -1; --- 65 unchanged lines hidden (view full) --- 141static void 142usage(void) 143{ 144 fprintf(stderr, "usage: from [-c] [-f file] [-s sender] [user]\n"); 145 exit(1); 146} 147 148int | 69#if MAXPATHLEN > BUFSIZ 70 char buf[MAXPATHLEN]; 71#else 72 char buf[BUFSIZ]; 73#endif 74 75 file = sender = NULL; 76 count = -1; --- 65 unchanged lines hidden (view full) --- 142static void 143usage(void) 144{ 145 fprintf(stderr, "usage: from [-c] [-f file] [-s sender] [user]\n"); 146 exit(1); 147} 148 149int |
149match(char *line, char *sender) | 150match(const char *line, const char *sender) |
150{ | 151{ |
151 char ch, pch, first, *p, *t; | 152 char ch, pch, first; 153 const char *p, *t; |
152 153 for (first = *sender++;;) { 154 if (isspace(ch = *line)) 155 return(0); 156 ++line; 157 if (isupper(ch)) 158 ch = tolower(ch); 159 if (ch != first) --- 12 unchanged lines hidden --- | 154 155 for (first = *sender++;;) { 156 if (isspace(ch = *line)) 157 return(0); 158 ++line; 159 if (isupper(ch)) 160 ch = tolower(ch); 161 if (ch != first) --- 12 unchanged lines hidden --- |