Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/qsubst Clean up, add RCS ids, make this build on a m...



details:   https://anonhg.NetBSD.org/src/rev/213497272800
branches:  trunk
changeset: 476038:213497272800
user:      perry <perry%NetBSD.org@localhost>
date:      Sat Sep 04 17:07:22 1999 +0000

description:
Clean up, add RCS ids, make this build on a modern NetBSD, etc., etc.

diffstat:

 usr.bin/qsubst/Makefile |   7 +++++++
 usr.bin/qsubst/qsubst.1 |  10 ++++++----
 usr.bin/qsubst/qsubst.c |  39 +++++++++++++++++----------------------
 3 files changed, 30 insertions(+), 26 deletions(-)

diffs (172 lines):

diff -r f50b211f7f7a -r 213497272800 usr.bin/qsubst/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/qsubst/Makefile   Sat Sep 04 17:07:22 1999 +0000
@@ -0,0 +1,7 @@
+#      $NetBSD: Makefile,v 1.1 1999/09/04 17:07:22 perry Exp $
+
+PROG=  qsubst
+DPADD+=        $(LIBTERMCAP}
+LDADD+=        -ltermcap
+
+.include <bsd.prog.mk>
diff -r f50b211f7f7a -r 213497272800 usr.bin/qsubst/qsubst.1
--- a/usr.bin/qsubst/qsubst.1   Sat Sep 04 17:04:05 1999 +0000
+++ b/usr.bin/qsubst/qsubst.1   Sat Sep 04 17:07:22 1999 +0000
@@ -1,7 +1,9 @@
+.\"    $NetBSD: qsubst.1,v 1.2 1999/09/04 17:07:23 perry Exp $
+.\"
 .\" This file is in the public domain.
-.Dd May 29, 1997
+.Dd September 4, 1999
 .Dt QSUBST 1
-.Os NetBSD 1.2BETA
+.Os
 .Sh NAME
 .Nm qsubst
 .Nd query-replace strings in files
@@ -28,7 +30,7 @@
 standout mode, if any.  Then one character is read from the terminal.
 This is then interpreted as follows (this is designed to be like Emacs'
 query-replace-string):
-.Bl -tag -compact -offset indent
+.Bl -tag -width "space" -compact -offset indent
 .It space
 Replace this occurrence and go on to the next one.
 .It \&.
@@ -53,7 +55,7 @@
 .Pp
 The first two arguments to qsubst are always the string to replace and
 the string to replace it with.  The options are as follows:
-.Bl -tag -compact -offset indent
+.Bl -tag -width "-F filename" -compact -offset indent
 .It Fl w
 The search string is considered as a C symbol; it must be bounded by
 non-symbol characters.  This option toggles.
diff -r f50b211f7f7a -r 213497272800 usr.bin/qsubst/qsubst.c
--- a/usr.bin/qsubst/qsubst.c   Sat Sep 04 17:04:05 1999 +0000
+++ b/usr.bin/qsubst/qsubst.c   Sat Sep 04 17:07:22 1999 +0000
@@ -1,3 +1,5 @@
+/*     $NetBSD: qsubst.c,v 1.2 1999/09/04 17:07:23 perry Exp $ */
+
 /*
  * qsubst -- designed for renaming routines existing in a whole bunch
  *  of files.  Needs -ltermcap.
@@ -96,22 +98,17 @@
  *                            mouse%rodents.montreal.qc.ca@localhost
  */
 
-#include <stdio.h>
+#include <sys/file.h>
+
 #include <ctype.h>
 #include <errno.h>
-#include <unistd.h>
+#include <signal.h>
+#include <stdio.h>
 #include <stdlib.h>
-#include <signal.h>
 #include <strings.h>
+#include <termcap.h>
 #include <termios.h>
-#include <sys/file.h>
-#include <unused-arg.h>
-
-/* These belong in an include file, but which one? */
-extern int tgetent(char *, const char *);
-extern int tgetflag(const char *);
-extern const char *tgetstr(const char *, char **);
-extern void tputs(const char *, int, int (*)(char));
+#include <unistd.h>
 
 extern const char *__progname;
 
@@ -121,13 +118,13 @@
 
 static int debugging;
 static FILE *tempf;
-static long int tbeg;
+static long tbeg;
 static FILE *workf;
 static char *str1;
 static char *str2;
 static int s1l;
 static int s2l;
-static long int nls[MAX_C_A+1];
+static long nls[MAX_C_A+1];
 static char buf[(BUF_SIZ*2)+2];
 static char *bufp;
 static char *bufp0;
@@ -160,7 +157,8 @@
  signal(SIGTSTP,old_tstp);
 }
 
-static void sigtstp(UNUSED_ARG(int sig))
+/* ARGSUSED */
+static void sigtstp(int sig)
 {
  struct termios tio;
 
@@ -203,10 +201,9 @@
   }
 }
 
-static int putcharf(char c)
+static void putcharf(int c)
 {
  putchar(c);
- return(0); /* ??? */
 }
 
 static void put_ul(char *s)
@@ -226,11 +223,9 @@
 static int getc_cbreak(void)
 {
  struct termios tio;
- struct termios otio;
  char c;
 
  if (tcgetattr(0,&tio) < 0) return(getchar());
- otio = tio;
  tio.c_lflag &= ~(ICANON|ECHOKE|ECHOE|ECHO|ECHONL);
  tio.c_cc[VMIN] = 1;
  tio.c_cc[VTIME] = 0;
@@ -249,7 +244,7 @@
 
 static int doit(void)
 {
- long int save;
+ long save;
  int i;
  int lastnl;
  int use_replacement;
@@ -344,7 +339,7 @@
  return(i);
 }
 
-static void add_shift(long int *a, long int e, int n)
+static void add_shift(long *a, long e, int n)
 {
  int i;
 
@@ -358,7 +353,7 @@
 static void process_file(char *fn)
 {
  int i;
- long int n;
+ long n;
  int c;
 
  workf = fopen(fn,"r+");
@@ -483,7 +478,6 @@
  fclose(f);
 }
 
-int main(int, char **);
 int main(int ac, char **av)
 {
  int skip;
@@ -620,3 +614,4 @@
   }
  exit(0);
 }
+



Home | Main Index | Thread Index | Old Index