Codebase list mg / upstream/20080610
Imported Upstream version 20080610 Andreas Beckmann 9 years ago
10 changed file(s) with 45 addition(s) and 92 deletion(s). Raw diff Collapse all Expand all
66 #ifndef MAXLOGNAME
77 #define MAXLOGNAME LOGIN_NAME_MAX
88 #endif
9 #define HAVE_ARC4RANDOM
9 #define HAVE_ARC4RANDOM_EXT
10 #define HAVE_NOSTRTONUM
11 #define HAVE_NOSTRLCPY
12 #define HAVE_NOSTRLCAT
13 #define HAVE_NOFGETLN
14 #define GNU_LS
0 /* $OpenBSD: file.c,v 1.64 2006/12/24 01:20:53 kjell Exp $ */
0 /* $OpenBSD: file.c,v 1.65 2008/03/21 08:01:20 pyr Exp $ */
11
22 /* This file is in the public domain. */
33
253253 if (ro == TRUE)
254254 curbp->b_flag |= BFREADONLY;
255255
256 if (startrow)
256 if (startrow) {
257257 gotoline(FFARG, startrow);
258 startrow = 0;
259 }
258260
259261 undo_add_modified();
260262 return (status);
0 /* $OpenBSD: funmap.c,v 1.27 2007/05/28 17:52:17 kjell Exp $ */
1 /*
2 * Copyright (c) 2001 Artur Grabowski <art@openbsd.org>. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
15 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 */
0 /* $OpenBSD: funmap.c,v 1.28 2008/06/10 00:19:31 kjell Exp $ */
1
2 /* This file is in the public domain */
3
244 #include "def.h"
255 #include "kbd.h"
266 #include "funmap.h"
0 /* $OpenBSD: funmap.h,v 1.6 2005/11/18 20:56:52 deraadt Exp $ */
1 /*
2 * Copyright (c) 2001 Artur Grabowski <art@openbsd.org>. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
15 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 */
0 /* $OpenBSD: funmap.h,v 1.7 2008/06/10 00:19:31 kjell Exp $ */
1
2 /* This file is in the public domain */
243
254 void funmap_init(void);
265 PF name_function(const char *);
0 /* $OpenBSD: grep.c,v 1.34 2007/05/28 17:52:17 kjell Exp $ */
1 /*
2 * Copyright (c) 2001 Artur Grabowski <art@openbsd.org>.
3 * Copyright (c) 2005 Kjell Wooding <kjell@openbsd.org>.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
0 /* $OpenBSD: grep.c,v 1.35 2008/06/10 00:19:31 kjell Exp $ */
1
2 /* This file is in the public domain */
263
274 #include "def.h"
285 #include "kbd.h"
0 /* $OpenBSD: macro.c,v 1.12 2007/03/29 17:37:15 kjell Exp $ */
0 /* $OpenBSD: macro.c,v 1.13 2008/06/10 02:39:22 kjell Exp $ */
11
22 /* This file is in the public domain. */
33
1010 #include "key.h"
1111 #include "macro.h"
1212
13 int inmacro = FALSE;
14 int macrodef = FALSE;
13 int inmacro = FALSE; /* Macro playback in progess */
14 int macrodef = FALSE; /* Macro recording in progress */
1515 int macrocount = 0;
1616
1717 struct line *maclhead = NULL;
6969 PF funct;
7070
7171 if (macrodef ||
72 (macrocount >= MAXMACRO && macro[MAXMACRO].m_funct != finishmacro))
72 (macrocount >= MAXMACRO && macro[MAXMACRO - 1].m_funct
73 != finishmacro)) {
74 ewprintf("Macro too long. Aborting.");
7375 return (FALSE);
76 }
7477
7578 if (macrocount == 0)
7679 return (TRUE);
0 /* $OpenBSD: main.c,v 1.56 2007/02/20 04:39:45 cloder Exp $ */
0 /* $OpenBSD: main.c,v 1.57 2008/05/29 19:58:15 sobrado Exp $ */
11
22 /* This file is in the public domain. */
33
3333 static void
3434 usage()
3535 {
36 fprintf(stderr, "usage: %s [+line] [-n] [-f mode] [file ...]\n",
36 fprintf(stderr, "usage: %s [-n] [-f mode] [+number] [file ...]\n",
3737 __progname);
3838 exit(1);
3939 }
0 .\" $OpenBSD: mg.1,v 1.32 2007/05/31 19:20:13 jmc Exp $
0 .\" $OpenBSD: mg.1,v 1.36 2008/05/29 19:58:15 sobrado Exp $
11 .\"
2 .Dd $Mdocdate: July 4 2007 $
2 .Dd $Mdocdate: June 10 2008 $
33 .Dt MG 1
44 .Os
55 .Sh NAME
77 .Nd emacs-like text editor
88 .Sh SYNOPSIS
99 .Nm mg
10 .Op Ar options
11 .Op Ar file ...
10 .Op Fl n
11 .Op Fl f Ar mode
12 .Op + Ns Ar number
13 .Op Ar
1214 .Sh DESCRIPTION
1315 .Nm
1416 is intended to be a small, fast, and portable editor for
2224 .Pp
2325 The options are as follows:
2426 .Bl -tag -width Ds
25 .It Ar +number
27 .It + Ns Ar number
2628 Go to the line specified by number (do not insert
2729 a space between the "+" sign and the number).
2830 If a negative number is specified, the line number counts
2931 backwards from the end of the file i.e. +-1 will be the last
3032 line of the file, +-2 will be second last, and so on.
31 .It Fl f Ar <mode>
33 .It Fl f Ar mode
3234 Run the mode command for all buffers created from
3335 arguments on the command line, including the
3436 scratch buffer and all files.
0 /* $OpenBSD: theo.c,v 1.101 2007/08/28 17:57:16 jasper Exp $ */
0 /* $OpenBSD: theo.c,v 1.104 2008/06/08 21:35:21 henning Exp $ */
11 /*
22 * Copyright (c) 2002 Artur Grabowski <art@openbsd.org>
33 * All rights reserved.
191191 "cache aliasing is a problem that would have stopped in 1992 if someone had killed about 5 people who worked at Sun.",
192192 "Don't spread rumours about me being gentle.",
193193 "If municipal water filtering equipment was built by the gcc developers, the western world would be dead by now.",
194 "kettenis supported a new machine in my basement and all I got to do was fix a 1 character typo in his html page commit.",
195 "industry told us a lesson: when you're an asshole, they mail you hardware",
194196 };
195197
196198 static const int ntalk = sizeof(talk)/sizeof(talk[0]);
0 /* $OpenBSD: ttyio.c,v 1.31 2006/04/03 05:03:34 deraadt Exp $ */
0 /* $OpenBSD: ttyio.c,v 1.32 2008/02/05 12:53:38 reyk Exp $ */
11
22 /* This file is in the public domain. */
33
144144 return;
145145
146146 while ((written = write(fileno(stdout), buf, nobuf)) != nobuf) {
147 if (written == -1)
147 if (written == -1) {
148 if (errno == EINTR)
149 continue;
148150 panic("ttflush write failed");
151 }
149152 buf += written;
150153 nobuf -= written;
151154 }