Deleted Added
full compact
edit.c (216370) edit.c (216564)
1/*
2 * Copyright (c) 1980, 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

--- 19 unchanged lines hidden (view full) ---

28 */
29
30#ifndef lint
31#if 0
32static char sccsid[] = "@(#)edit.c 8.1 (Berkeley) 6/6/93";
33#endif
34#endif /* not lint */
35#include <sys/cdefs.h>
1/*
2 * Copyright (c) 1980, 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

--- 19 unchanged lines hidden (view full) ---

28 */
29
30#ifndef lint
31#if 0
32static char sccsid[] = "@(#)edit.c 8.1 (Berkeley) 6/6/93";
33#endif
34#endif /* not lint */
35#include <sys/cdefs.h>
36__FBSDID("$FreeBSD: head/usr.bin/mail/edit.c 216370 2010-12-11 08:32:16Z joel $");
36__FBSDID("$FreeBSD: head/usr.bin/mail/edit.c 216564 2010-12-19 16:25:23Z charnier $");
37
38#include "rcv.h"
39#include <fcntl.h>
40#include "extern.h"
41
42/*
43 * Mail -- a mail program
44 *
45 * Perform message editing functions.
46 */
47
48/*
49 * Edit a message list.
50 */
51int
37
38#include "rcv.h"
39#include <fcntl.h>
40#include "extern.h"
41
42/*
43 * Mail -- a mail program
44 *
45 * Perform message editing functions.
46 */
47
48/*
49 * Edit a message list.
50 */
51int
52editor(msgvec)
53 int *msgvec;
52editor(int *msgvec)
54{
55
56 return (edit1(msgvec, 'e'));
57}
58
59/*
60 * Invoke the visual editor on a message list.
61 */
62int
53{
54
55 return (edit1(msgvec, 'e'));
56}
57
58/*
59 * Invoke the visual editor on a message list.
60 */
61int
63visual(msgvec)
64 int *msgvec;
62visual(int *msgvec)
65{
66
67 return (edit1(msgvec, 'v'));
68}
69
70/*
71 * Edit a message by writing the message into a funnily-named file
72 * (which should not exist) and forking an editor on it.
73 * We get the editor from the stuff above.
74 */
75int
63{
64
65 return (edit1(msgvec, 'v'));
66}
67
68/*
69 * Edit a message by writing the message into a funnily-named file
70 * (which should not exist) and forking an editor on it.
71 * We get the editor from the stuff above.
72 */
73int
76edit1(msgvec, type)
77 int *msgvec;
78 int type;
74edit1(int *msgvec, int type)
79{
80 int c, i;
81 FILE *fp;
82 struct message *mp;
83 off_t size;
84
85 /*
86 * Deal with each message to be edited . . .

--- 45 unchanged lines hidden (view full) ---

132
133/*
134 * Run an editor on the file at "fpp" of "size" bytes,
135 * and return a new file pointer.
136 * Signals must be handled by the caller.
137 * "Type" is 'e' for _PATH_EX, 'v' for _PATH_VI.
138 */
139FILE *
75{
76 int c, i;
77 FILE *fp;
78 struct message *mp;
79 off_t size;
80
81 /*
82 * Deal with each message to be edited . . .

--- 45 unchanged lines hidden (view full) ---

128
129/*
130 * Run an editor on the file at "fpp" of "size" bytes,
131 * and return a new file pointer.
132 * Signals must be handled by the caller.
133 * "Type" is 'e' for _PATH_EX, 'v' for _PATH_VI.
134 */
135FILE *
140run_editor(fp, size, type, readonly)
141 FILE *fp;
142 off_t size;
143 int type, readonly;
136run_editor(FILE *fp, off_t size, int type, int readonly)
144{
145 FILE *nf = NULL;
146 int t;
147 time_t modtime;
148 char *edit, tempname[PATHSIZE];
149 struct stat statb;
150
151 (void)snprintf(tempname, sizeof(tempname),

--- 70 unchanged lines hidden ---
137{
138 FILE *nf = NULL;
139 int t;
140 time_t modtime;
141 char *edit, tempname[PATHSIZE];
142 struct stat statb;
143
144 (void)snprintf(tempname, sizeof(tempname),

--- 70 unchanged lines hidden ---