diff options
-rw-r--r-- | ccmakedep.man | 142 | ||||
-rw-r--r-- | cleanlinks | 26 | ||||
-rw-r--r-- | cleanlinks.man | 28 | ||||
-rw-r--r-- | mergelib.man | 25 | ||||
-rw-r--r-- | mkhtmlindex.man | 32 | ||||
-rw-r--r-- | mkhtmlindex.pl | 103 | ||||
-rw-r--r-- | mkhtmlindex.sh | 60 | ||||
-rw-r--r-- | revpath.c | 47 | ||||
-rw-r--r-- | revpath.man | 45 |
9 files changed, 508 insertions, 0 deletions
diff --git a/ccmakedep.man b/ccmakedep.man new file mode 100644 index 0000000..20d9e82 --- /dev/null +++ b/ccmakedep.man @@ -0,0 +1,142 @@ +.TH ccmakedep 1 __xorgversion__ +.SH NAME +ccmakedep \- create dependencies in makefiles using a C compiler +.SH SYNOPSIS +.B ccmakedep +[ +.BI cpp-flags +] [ +.BI \-w width +] [ +.BI \-s magic-string +] [ +.BI \-f makefile +] [ +.BI \-o object-suffix +] [ +.B \-v +] [ +.B \-a +] [ +.BI \-cc compiler +] [ +\-\^\- +.I options +\-\^\- +] +.I sourcefile +\^.\|.\|. +.SH DESCRIPTION +The +.B ccmakedep +program calls a C compiler to preprocess each +.IR sourcefile , +and uses the output to construct +.I makefile +rules describing their dependencies. +These rules instruct +.BR make (1) +on which object files must be recompiled when a dependency has changed. +.PP +By default, +.B ccmakedep +places its output in the file named +.I makefile +if it exists, otherwise +.I Makefile. +An alternate makefile may be specified with the +.B \-f +option. +It first searches the makefile for a line beginning with +.sp +\& # DO NOT DELETE +.sp +or one provided with the +.B \-s +option, as a delimiter for the dependency output. +If it finds it, it will delete everything following this up to the end of +the makefile and put the output after this line. +If it doesn't find it, the program will append the string to the makefile +and place the output after that. +.SH EXAMPLE +Normally, +.B ccmakedep +will be used in a makefile target so that typing 'make depend' will bring +the dependencies up to date for the makefile. +For example, +.nf + SRCS\0=\0file1.c\0file2.c\0.\|.\|. + CFLAGS\0=\0\-O\0\-DHACK\0\-I\^.\^.\^/foobar\0\-xyz + depend: + ccmakedep\0\-\^\-\0$(CFLAGS)\0\-\^\-\0$(SRCS) +.fi +.SH OPTIONS +The program will ignore any option that it does not understand, so you may +use the same arguments that you would for +.BR cc (1), +including +.B \-D +and +.B \-U +options to define and undefine symbols and +.B \-I +to set the include path. +.TP +.B \-a +Append the dependencies to the file instead of replacing existing +dependencies. +.TP +.BI \-cc compiler +Use this compiler to generate dependencies. +.TP +.BI \-f makefile +Filename. +This allows you to specify an alternate makefile in which +.B ccmakedep +can place its output. +Specifying \(lq\-\(rq as the file name (that is, +.BR \-f\- ) +sends the output to standard output instead of modifying an existing file. +.TP +.BI \-s string +Starting string delimiter. +This option permits you to specify a different string for +.B ccmakedep +to look for in the makefile. +The default is \(lq# DO NOT DELETE\(rq. +.TP +.BI \-v +Be verbose: display the C compiler command before running it. +.TP +.BI \-\^\- " options " \-\^\- +If +.B ccmakedep +encounters a double hyphen (\-\^\-) in the argument list, then any +unrecognized arguments following it will be silently ignored. +A second double hyphen terminates this special treatment. +In this way, +.B ccmakedep +can be made to safely ignore esoteric compiler arguments that might +normally be found in a CFLAGS +.B make +macro (see the +.B EXAMPLE +section above). +.BR \-D , +.BR \-I , +and +.B \-U +options appearing between the pair of double hyphens are still processed +normally. +.SH "SEE ALSO" +.BR cc (1), +.BR make (1), +.BR makedepend (1), +.BR ccmakedep (1). +.SH AUTHOR +.B ccmakedep +was written by the X Consortium. +.PP +Colin Watson wrote this manual page, originally for the Debian Project, +based partly on the manual page for +.BR makedepend (1). diff --git a/cleanlinks b/cleanlinks new file mode 100644 index 0000000..51252e2 --- /dev/null +++ b/cleanlinks @@ -0,0 +1,26 @@ +#!/bin/sh +# +# Copyright © 2000 by The XFree86 Project, Inc +# +# Remove dangling symlinks and empty directories from a shadow link tree +# (created with lndir). +# +# Author: David Dawes <dawes@xfree86.org> +# +# $XFree86: xc/config/util/cleanlinks.sh,v 1.1 2001/03/21 20:25:00 dawes Exp $ + +find . -type l -print | +( + read i + while [ X"$i" != X ]; do + if [ ! -f "$i" ]; then + echo $i is a dangling symlink, removing + rm -f "$i" + fi + read i + done +) + +echo Removing empty directories ... +find . -type d -depth -print | xargs rmdir > /dev/null 2>&1 +exit 0 diff --git a/cleanlinks.man b/cleanlinks.man new file mode 100644 index 0000000..403710c --- /dev/null +++ b/cleanlinks.man @@ -0,0 +1,28 @@ +.TH cleanlinks 1 __vendorversion__ +.SH NAME +cleanlinks \- remove dangling symbolic links and empty directories +.SH SYNOPSIS +.B cleanlinks +.SH DESCRIPTION +The +.I cleanlinks +program searches the directory tree descended from the current directory for +symbolic links whose targets do not exist, and removes them. +It then removes all empty directories in that directory tree. +.PP +.I cleanlinks +is useful for cleaning up a shadow link tree created with +.BR lndir (1) +after files have been removed from the real directory. +.SH DIAGNOSTICS +A message will be printed upon encountering each dangling symlink and empty +directory. +.SH SEE ALSO +.BR lndir (1). +.SH AUTHOR +.PP +David Dawes wrote the +.I cleanlinks +program for XFree86. +.PP +Colin Watson wrote this manual page, originally for the Debian Project. diff --git a/mergelib.man b/mergelib.man new file mode 100644 index 0000000..d05065f --- /dev/null +++ b/mergelib.man @@ -0,0 +1,25 @@ +.TH mergelib 1 __xorgversion__ +.SH NAME +mergelib \- merge one library into another +.SH SYNOPSIS +.B mergelib +.I to-library +.I from-library +.RI [ object-filename-prefix ] +.SH DESCRIPTION +The +.I mergelib +program merges objects from one library into another. +The names of object files in +.I from-library +will be prefixed by +.I object-filename-prefix +(\(oq_\(cq by default) to avoid name clashes. +The merged library will be left in +.IR to-library . +.SH AUTHOR +Jim Fulton wrote the +.I mergelib +program for the X Consortium. +.PP +Colin Watson wrote this manual page, originally for the Debian Project. diff --git a/mkhtmlindex.man b/mkhtmlindex.man new file mode 100644 index 0000000..c673e94 --- /dev/null +++ b/mkhtmlindex.man @@ -0,0 +1,32 @@ +.TH mkhtmlindex 1 __vendorversion__ +.SH NAME +mkhtmlindex \- generate index files for HTML man pages +.SH SYNOPSIS +.B mkhtmlindex +.I htmlmandir +.SH DESCRIPTION +The +.I mkhtmlindex +program generates index files for a directory of HTML-formatted manual +pages. +It searches for files whose names are of the form \(lqname.1.html\(rq, +and outputs index files \(lqmanindex1.html\(rq, \(lqmanindex.2.html\(rq, +and so on, one for each manual volume. +Empty index files will be removed. +Names and descriptions are found by scanning the first +.I <H2> +section of each page. +.SH OPTIONS +.I mkhtmlindex +takes only one argument: the directory to process. +.SH NOTES +This utility is currently rather specific to XFree86. +In particular, the format of the index files it outputs is not configurable, +nor is the HTML formatting it expects of manual pages. +.SH AUTHOR +.PP +David Dawes wrote the +.I mkhtmlindex +program for XFree86. +.PP +Colin Watson wrote this manual page, originally for the Debian Project. diff --git a/mkhtmlindex.pl b/mkhtmlindex.pl new file mode 100644 index 0000000..1092534 --- /dev/null +++ b/mkhtmlindex.pl @@ -0,0 +1,103 @@ +#!/usr/bin/perl +# +# $XFree86: xc/config/util/mkhtmlindex.pl,v 1.3 2001/03/18 14:49:01 dawes Exp $ +# +# Copyright © 2000,2001 by VA Linux Systems, Inc. +# +# Generate index files for HTML man pages. +# +# Author: David Dawes <dawes@xfree86.org> +# + +# +# Best viewed with tabs set to 4 +# + +if ($#ARGV ne 0) { + print STDERR "Usage: mkhtmlindex.pl htmlmandir\n"; + exit 1; +} + +$dir = $ARGV[0]; + +if (! -d $dir) { + print STDERR "$dir is not a directory\n"; + exit 1; +} + +@vollist = ("1", "2", "3", "4", "5", "6", "7", "8", "9", "o", "l", "n", "p"); + +$indexprefix = "manindex"; + +foreach $vol (@vollist) { + $empty = "yes"; + $indexname="$dir/$indexprefix$vol.html"; + + # print "Processing volume $vol\n"; + + open(mindex, ">$indexname") || die "Can't create $indexname"; + opendir(dir, "$dir") || die "Can't open $dir"; + + print mindex <<EOF; +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> +<TITLE>XFree86[tm] Manual pages: Section $vol</TITLE> +</HEAD> +<BODY BGCOLOR="#efefef" TEXT="black" LINK="blue" VLINK="#551A8B" ALINK="red"> + +<H1>XFree86[tm] Manual pages: Section $vol</H1> +<P> +<UL> +EOF + + foreach $file (sort readdir dir) { + if ($file =~ "\.$vol\.html") { + open(file, "<$dir/$file") || die "Can't open $dir/$file"; + while (<file>) { + chop; + if (/^<H2>/) { + if (! /<\/H2>$/) { + while (<file> && ! /<\/H2>$/) { + ; + } + } + $heading = ""; + while (<file>) { + if (/^<H2>/) { + last; + } + $heading = "$heading" . "$_"; + } + if ($heading) { + undef $empty; + $heading =~ s/--/-/; + ($name, $descr) = split(/-/, $heading, 2); + $file =~ /(.*)\.$vol\.html/; + $fname = $1; + $descr =~ s/<[P]>//g; + print mindex + "<LI><A href=\"$file\">$fname</A> - $descr</LI>"; + } + last; + } + } + close file; + } + } + + print mindex <<EOF; +</UL> +<P> +</BODY> +</HTML> +EOF + + close mindex; + closedir dir; + if (defined $empty) { + # print "Removing empty $indexname\n"; + unlink $indexname; + } +} diff --git a/mkhtmlindex.sh b/mkhtmlindex.sh new file mode 100644 index 0000000..b880617 --- /dev/null +++ b/mkhtmlindex.sh @@ -0,0 +1,60 @@ +#!/bin/sh +# +# $XFree86: xc/config/util/mkhtmlindex.sh,v 1.4 2001/10/28 03:32:04 tsi Exp $ +# +# Copyright © 2000 by Precision Insight, Inc. +# +# Generate index files for the HTML man pages +# +# Author: David Dawes <dawes@xfree86.org> +# + +VOLLIST="1 2 3 4 5 6 7 8 9 o l n p" +INDEX="manindex" + +if [ $# != 1 ]; then + echo Usage: $0 htmlmandir + exit 1 +fi + +if [ ! -d $1 ]; then + echo $1 is not a directory + exit 1 +fi + +cd $1 + +for s in $VOLLIST; do + list="`ls *.$s.html 2> /dev/null`" || : # ignore failed glob expansion + if [ X"$list" != X ]; then + file=$INDEX$s.html + rm -f $file + cat <<EOF > $file +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> +<TITLE>XFree86[tm] Manual pages: Section $s</TITLE> +</HEAD> +<BODY BGCOLOR="#efefef" TEXT="black" LINK="blue" VLINK="#551A8B" ALINK="red"> + +<H1>XFree86[tm] Manual pages: Section $s</H1> +<P> +<UL> +EOF + for i in $list; do + title="`egrep '^[0-9A-Za-z]' $i | egrep -v '^Name' | head -1`" + name="`echo \"$title\" | sed -e 's/ - .*//'`" + desc="`echo \"$title\" | sed -e 's/[^-]* - //' -e 's/<P>//'`" + echo "<LI><A href=\"$i\">$name</A> - $desc</LI>" >> $file + done + cat <<EOF >> $file +</UL> +<P> +</BODY> +</HTML> +EOF + fi +done + +exit 0 diff --git a/revpath.c b/revpath.c new file mode 100644 index 0000000..db88393 --- /dev/null +++ b/revpath.c @@ -0,0 +1,47 @@ +/* + * Copyright 1999 by The XFree86 Project, Inc. + */ +/* $XFree86: xc/config/util/revpath.c,v 1.2 1999/02/01 11:55:49 dawes Exp $ */ + +/* + * Reverse a pathname. It returns a relative path that can be used to undo + * 'cd argv[1]'. + * + * It is impossible to do this in general, but this handles the cases that + * come up in imake. Maybe imake should use an absolute path for $(TOP) + * instead of a relative path so that this problem can be avoided? + */ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +int +main(int argc, char *argv[]) +{ + int levels = 0; + char *p; + + /* Silently ignore invalid usage */ + if (argc != 2) + exit(0); + + /* Split the path and count the levels */ + p = strtok(argv[1], "/"); + while (p) { + if (strcmp(p, ".") == 0) + ; + else if (strcmp(p, "..") == 0) + levels--; + else + levels++; + p = strtok(NULL, "/"); + } + + while (levels-- > 0) + printf("../"); + + printf("\n"); + + exit(0); +} diff --git a/revpath.man b/revpath.man new file mode 100644 index 0000000..7d9cc94 --- /dev/null +++ b/revpath.man @@ -0,0 +1,45 @@ +.\" $XFree86: xc/config/util/revpath.man,v 1.2 2001/01/27 18:19:55 dawes Exp $ +.TH REVPATH 1 __vendorversion__ +.SH NAME +revpath \- generate a relative path that can be used to undo a change-directory +.SH SYNOPSIS +.B revpath +.I path +.SH DESCRIPTION +The +.I revpath +program prints out a relative path that is the ``reverse'' or ``inverse'' of +.IR path . +Start with two directories +.I top +and +.IR bottom , +with the latter below the former, and +.I path +is the location of +.I bottom +relative to +.IR top . +The output of +.I revpath +is the location of +.I top +relative to +.IR bottom . +The resulting path contains a trailing `/' character when the result is +non-trivial. +If +.I path +is equivalent to `.', the resulting output is empty. +If +.I path +is invalid in some way (e.g., doesn't represent the path to a subdirectory) +the output is also empty and no error messages are ever generated. +.SH DIAGNOSTICS +There are no diagnostics. Error conditions are silently ignored, and the +exit status is always 0. +.SH BUGS +It isn't possible to reverse arbitrary relative paths. +If any path element between the two end points of +.I path +is a symbolic link, the results will probably be incorrect. |