head 1.3; access; symbols pkgsrc-2013Q2:1.3.0.44 pkgsrc-2013Q2-base:1.3 pkgsrc-2012Q4:1.3.0.42 pkgsrc-2012Q4-base:1.3 pkgsrc-2011Q4:1.3.0.40 pkgsrc-2011Q4-base:1.3 pkgsrc-2011Q2:1.3.0.38 pkgsrc-2011Q2-base:1.3 pkgsrc-2009Q4:1.3.0.36 pkgsrc-2009Q4-base:1.3 pkgsrc-2008Q4:1.3.0.34 pkgsrc-2008Q4-base:1.3 pkgsrc-2008Q3:1.3.0.32 pkgsrc-2008Q3-base:1.3 cube-native-xorg:1.3.0.30 cube-native-xorg-base:1.3 pkgsrc-2008Q2:1.3.0.28 pkgsrc-2008Q2-base:1.3 pkgsrc-2008Q1:1.3.0.26 pkgsrc-2008Q1-base:1.3 pkgsrc-2007Q4:1.3.0.24 pkgsrc-2007Q4-base:1.3 pkgsrc-2007Q3:1.3.0.22 pkgsrc-2007Q3-base:1.3 pkgsrc-2007Q2:1.3.0.20 pkgsrc-2007Q2-base:1.3 pkgsrc-2007Q1:1.3.0.18 pkgsrc-2007Q1-base:1.3 pkgsrc-2006Q4:1.3.0.16 pkgsrc-2006Q4-base:1.3 pkgsrc-2006Q3:1.3.0.14 pkgsrc-2006Q3-base:1.3 pkgsrc-2006Q2:1.3.0.12 pkgsrc-2006Q2-base:1.3 pkgsrc-2006Q1:1.3.0.10 pkgsrc-2006Q1-base:1.3 pkgsrc-2005Q4:1.3.0.8 pkgsrc-2005Q4-base:1.3 pkgsrc-2005Q3:1.3.0.6 pkgsrc-2005Q3-base:1.3 pkgsrc-2005Q2:1.3.0.4 pkgsrc-2005Q2-base:1.3 pkgsrc-2005Q1:1.3.0.2 pkgsrc-2005Q1-base:1.3 pkgsrc-2004Q4:1.2.0.8 pkgsrc-2004Q4-base:1.2 pkgsrc-2004Q3:1.2.0.6 pkgsrc-2004Q3-base:1.2 pkgsrc-2004Q2:1.2.0.4 pkgsrc-2004Q2-base:1.2 pkgsrc-2004Q1:1.2.0.2 pkgsrc-2004Q1-base:1.2 pkgsrc-2003Q4:1.1.1.1.0.10 pkgsrc-2003Q4-base:1.1.1.1 netbsd-1-6-1:1.1.1.1.0.6 netbsd-1-6-1-base:1.1.1.1 netbsd-1-6:1.1.1.1.0.8 netbsd-1-6-RELEASE-base:1.1.1.1 pkgviews:1.1.1.1.0.4 pkgviews-base:1.1.1.1 buildlink2:1.1.1.1.0.2 buildlink2-base:1.1.1.1 netbsd-1-5-PATCH003:1.1.1.1 netbsd-1-5-PATCH001:1.1.1.1 netbsd-1-5-RELEASE:1.1.1.1 netbsd-1-4-PATCH003:1.1.1.1 netbsd-1-4-PATCH002:1.1.1.1 comdex-fall-1999:1.1.1.1 pkgsrc-base:1.1.1.1 TNF:1.1.1; locks; strict; comment @# @; 1.3 date 2005.01.02.03.01.56; author cube; state dead; branches; next 1.2; 1.2 date 2004.01.11.14.21.27; author cube; state Exp; branches; next 1.1; 1.1 date 99.10.08.04.34.43; author dbj; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 99.10.08.04.34.43; author dbj; state Exp; branches; next ; desc @@ 1.3 log @Remove ppp-mppe, obsoleted by pppd and mppe-lkm. I can't really say I will regret it. @ text @$NetBSD: patch-ab,v 1.2 2004/01/11 14:21:27 cube Exp $ --- chat/chat.c.orig 1999-08-13 08:46:09.000000000 +0200 +++ chat/chat.c @@@@ -144,18 +144,6 @@@@ extern char *sys_errlist[]; "unknown error") #endif -/*************** Micro getopt() *********************************************/ -#define OPTION(c,v) (_O&2&&**v?*(*v)++:!c||_O&4?0:(!(_O&1)&& \ - (--c,++v),_O=4,c&&**v=='-'&&v[0][1]?*++*v=='-'\ - &&!v[0][1]?(--c,++v,0):(_O=2,*(*v)++):0)) -#define OPTARG(c,v) (_O&2?**v||(++v,--c)?(_O=1,--c,*v++): \ - (_O=4,(char*)0):(char*)0) -#define OPTONLYARG(c,v) (_O&2&&**v?(_O=1,--c,*v++):(char*)0) -#define ARG(c,v) (c?(--c,*v++):(char*)0) - -static int _O = 0; /* Internal state */ -/*************** Micro getopt() *********************************************/ - char *program_name; #define MAX_ABORTS 50 @@@@ -208,7 +196,7 @@@@ int say_next = 0, hup_next = 0; void *dup_mem __P((void *b, size_t c)); void *copy_of __P((char *s)); void usage __P((void)); -void logf __P((const char *fmt, ...)); +void logit __P((const char *fmt, ...)); void fatal __P((int code, const char *fmt, ...)); SIGTYPE sigalrm __P((int signo)); SIGTYPE sigint __P((int signo)); @@@@ -269,12 +257,12 @@@@ main(argc, argv) char **argv; { int option; - char *arg; + int i; program_name = *argv; tzset(); - while ((option = OPTION(argc, argv)) != 0) { + while ((option = getopt(argc, argv, ":evVf:t:r:sST:U:")) != -1) { switch (option) { case 'e': ++echo; @@@@ -297,25 +285,24 @@@@ main(argc, argv) break; case 'f': - if ((arg = OPTARG(argc, argv)) != NULL) - chat_file = copy_of(arg); + if (optarg != NULL) + chat_file = copy_of(optarg); else usage(); break; case 't': - if ((arg = OPTARG(argc, argv)) != NULL) - timeout = atoi(arg); + if (optarg != NULL) + timeout = atoi(optarg); else usage(); break; case 'r': - arg = OPTARG (argc, argv); - if (arg) { + if (optarg) { if (report_fp != NULL) fclose (report_fp); - report_file = copy_of (arg); + report_file = copy_of (optarg); report_fp = fopen (report_file, "a"); if (report_fp != NULL) { if (verbose) @@@@ -327,15 +314,15 @@@@ main(argc, argv) break; case 'T': - if ((arg = OPTARG(argc, argv)) != NULL) - phone_num = copy_of(arg); + if (optarg != NULL) + phone_num = copy_of(optarg); else usage(); break; case 'U': - if ((arg = OPTARG(argc, argv)) != NULL) - phone_num2 = copy_of(arg); + if (optarg != NULL) + phone_num2 = copy_of(optarg); else usage(); break; @@@@ -345,6 +332,8 @@@@ main(argc, argv) break; } } + argc -= optind; + argv += optind; /* * Default the report file to the stderr location */ @@@@ -367,17 +356,15 @@@@ main(argc, argv) init(); if (chat_file != NULL) { - arg = ARG(argc, argv); - if (arg != NULL) + if (argc) usage(); else do_file (chat_file); } else { - while ((arg = ARG(argc, argv)) != NULL) { - chat_expect(arg); - - if ((arg = ARG(argc, argv)) != NULL) - chat_send(arg); + for (i = 0; i < argc; i++) { + chat_expect(argv[i]); + if (++i < argc) + chat_send(argv[i]); } } @@@@ -471,7 +458,7 @@@@ char line[1024]; /* * Send a message to syslog and/or stderr. */ -void logf __V((const char *fmt, ...)) +void logit __V((const char *fmt, ...)) { va_list args; @@@@ -534,7 +521,7 @@@@ int signo; fatal(2, "Can't set file mode flags on stdin: %m"); if (verbose) - logf("alarm"); + logit("alarm"); } void unalarm() @@@@ -590,7 +577,7 @@@@ void set_tty_parameters() have_tty_parameters = 1; t.c_iflag |= IGNBRK | ISTRIP | IGNPAR; - t.c_oflag = 0; + t.c_oflag |= OPOST | ONLCR; t.c_lflag = 0; t.c_cc[VERASE] = t.c_cc[VKILL] = 0; @@@@ -941,9 +928,9 @@@@ char *s; * The expectation did not occur. This is terminal. */ if (fail_reason) - logf("Failed (%s)", fail_reason); + logit("Failed (%s)", fail_reason); else - logf("Failed"); + logit("Failed"); terminate(exit_code); } @@@@ -1019,7 +1006,7 @@@@ register char *s; abort_string[n_aborts++] = s1; if (verbose) - logf("abort on (%v)", s); + logit("abort on (%v)", s); return; } @@@@ -1045,7 +1032,7 @@@@ register char *s; pack++; n_aborts--; if (verbose) - logf("clear abort on (%v)", s); + logit("clear abort on (%v)", s); } } free(s1); @@@@ -1069,7 +1056,7 @@@@ register char *s; report_string[n_reports++] = s1; if (verbose) - logf("report (%v)", s); + logit("report (%v)", s); return; } @@@@ -1094,7 +1081,7 @@@@ register char *s; pack++; n_reports--; if (verbose) - logf("clear report (%v)", s); + logit("clear report (%v)", s); } } free(s1); @@@@ -1112,7 +1099,7 @@@@ register char *s; timeout = DEFAULT_CHAT_TIMEOUT; if (verbose) - logf("timeout set to %d seconds", timeout); + logit("timeout set to %d seconds", timeout); return; } @@@@ -1175,7 +1162,7 @@@@ int get_char() return ((int)c & 0x7F); default: - logf("warning: read() on stdin returned %d", status); + logit("warning: read() on stdin returned %d", status); case -1: if ((status = fcntl(0, F_GETFL, 0)) == -1) @@@@ -1203,7 +1190,7 @@@@ int c; return (0); default: - logf("warning: write() on stdout returned %d", status); + logit("warning: write() on stdout returned %d", status); case -1: if ((status = fcntl(0, F_GETFL, 0)) == -1) @@@@ -1225,9 +1212,9 @@@@ int c; if (verbose) { if (errno == EINTR || errno == EWOULDBLOCK) - logf(" -- write timed out"); + logit(" -- write timed out"); else - logf(" -- write failed: %m"); + logit(" -- write failed: %m"); } return (0); } @@@@ -1242,9 +1229,9 @@@@ register char *s; if (verbose) { if (quiet) - logf("send (??????)"); + logit("send (??????)"); else - logf("send (%v)", s); + logit("send (%v)", s); } alarm(timeout); alarmed = 0; @@@@ -1331,17 +1318,17 @@@@ register char *string; minlen = (len > sizeof(fail_buffer)? len: sizeof(fail_buffer)) - 1; if (verbose) - logf("expect (%v)", string); + logit("expect (%v)", string); if (len > STR_LEN) { - logf("expect string is too long"); + logit("expect string is too long"); exit_code = 1; return 0; } if (len == 0) { if (verbose) - logf("got it"); + logit("got it"); return (1); } @@@@ -1355,16 +1342,16 @@@@ register char *string; echo_stderr(c); if (verbose && c == '\n') { if (s == logged) - logf(""); /* blank line */ + logit(""); /* blank line */ else - logf("%0.*v", s - logged, logged); + logit("%0.*v", s - logged, logged); logged = s + 1; } *s++ = c; if (verbose && s >= logged + 80) { - logf("%0.*v", s - logged, logged); + logit("%0.*v", s - logged, logged); logged = s; } @@@@ -1409,8 +1396,8 @@@@ register char *string; strncmp(s - len, string, len) == 0) { if (verbose) { if (s > logged) - logf("%0.*v", s - logged, logged); - logf(" -- got it\n"); + logit("%0.*v", s - logged, logged); + logit(" -- got it\n"); } alarm(0); @@@@ -1423,8 +1410,8 @@@@ register char *string; strncmp(s - abort_len, abort_string[n], abort_len) == 0) { if (verbose) { if (s > logged) - logf("%0.*v", s - logged, logged); - logf(" -- failed"); + logit("%0.*v", s - logged, logged); + logit(" -- failed"); } alarm(0); @@@@ -1437,7 +1424,7 @@@@ register char *string; if (s >= end) { if (logged < s - minlen) { - logf("%0.*v", s - logged, logged); + logit("%0.*v", s - logged, logged); logged = s; } s -= minlen; @@@@ -1447,16 +1434,16 @@@@ register char *string; } if (alarmed && verbose) - logf("warning: alarm synchronization problem"); + logit("warning: alarm synchronization problem"); } alarm(0); if (verbose && printed) { if (alarmed) - logf(" -- read timed out"); + logit(" -- read timed out"); else - logf(" -- read failed: %m"); + logit(" -- read failed: %m"); } exit_code = 3; @ 1.2 log @Make this compile with gcc3. Also, do not try to remove ${LOCALBASE}/lkm at deinstall time in case there are other LKMs installed. @ text @d1 1 a1 1 $NetBSD$ @ 1.1 log @Initial revision @ text @d3 3 a5 5 Index: chat/chat.c diff -u chat/chat.c:1.1.1.5 chat/chat.c:1.18 --- chat/chat.c:1.1.1.5 Tue Aug 24 19:50:04 1999 +++ chat/chat.c Tue Aug 24 20:15:00 1999 @@@@ -144,18 +150,6 @@@@ d24 10 a33 1 @@@@ -269,12 +263,12 @@@@ d48 1 a48 1 @@@@ -297,25 +291,24 @@@@ d80 1 a80 1 @@@@ -327,15 +320,15 @@@@ d100 1 a100 1 @@@@ -345,6 +338,8 @@@@ d109 1 a109 1 @@@@ -367,17 +362,15 @@@@ d132 19 a150 1 @@@@ -590,7 +583,7 @@@@ d159 191 @ 1.1.1.1 log @ PPP daemon and LKM with MPPE - Microsoft Point-to-Point Encryption @ text @@