quit.c (da52b4caaf187775f6b56a72c6b16e94ad728f7b) quit.c (6d8484b0d0191b66f9bfd0dfa89c06a29647f02a)
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

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

44 *
45 * Termination processing.
46 */
47
48/*
49 * The "quit" command.
50 */
51int
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

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

44 *
45 * Termination processing.
46 */
47
48/*
49 * The "quit" command.
50 */
51int
52quitcmd()
52quitcmd(void)
53{
54 /*
55 * If we are sourcing, then return 1 so execute() can handle it.
56 * Otherwise, return -1 to abort command loop.
57 */
58 if (sourcing)
59 return (1);
60 return (-1);
61}
62
63/*
64 * Save all of the undetermined messages at the top of "mbox"
65 * Save all untouched messages back in the system mailbox.
66 * Remove the system mailbox, if none saved there.
67 */
68void
53{
54 /*
55 * If we are sourcing, then return 1 so execute() can handle it.
56 * Otherwise, return -1 to abort command loop.
57 */
58 if (sourcing)
59 return (1);
60 return (-1);
61}
62
63/*
64 * Save all of the undetermined messages at the top of "mbox"
65 * Save all untouched messages back in the system mailbox.
66 * Remove the system mailbox, if none saved there.
67 */
68void
69quit()
69quit(void)
70{
71 int mcount, p, modify, autohold, anystat, holdbit, nohold;
72 FILE *ibuf, *obuf, *fbuf, *rbuf, *readstat, *abuf;
73 struct message *mp;
74 int c, fd;
75 struct stat minfo;
76 char *mbox, tempname[PATHSIZE];
77

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

327
328/*
329 * Preserve all the appropriate messages back in the system
330 * mailbox, and print a nice message indicated how many were
331 * saved. On any error, just return -1. Else return 0.
332 * Incorporate the any new mail that we found.
333 */
334int
70{
71 int mcount, p, modify, autohold, anystat, holdbit, nohold;
72 FILE *ibuf, *obuf, *fbuf, *rbuf, *readstat, *abuf;
73 struct message *mp;
74 int c, fd;
75 struct stat minfo;
76 char *mbox, tempname[PATHSIZE];
77

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

327
328/*
329 * Preserve all the appropriate messages back in the system
330 * mailbox, and print a nice message indicated how many were
331 * saved. On any error, just return -1. Else return 0.
332 * Incorporate the any new mail that we found.
333 */
334int
335writeback(res)
336 FILE *res;
335writeback(FILE *res)
337{
338 struct message *mp;
339 int p, c;
340 FILE *obuf;
341
342 p = 0;
343 if ((obuf = Fopen(mailname, "r+")) == NULL) {
344 warn("%s", mailname);

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

381 return (0);
382}
383
384/*
385 * Terminate an editing session by attempting to write out the user's
386 * file from the temporary. Save any new stuff appended to the file.
387 */
388void
336{
337 struct message *mp;
338 int p, c;
339 FILE *obuf;
340
341 p = 0;
342 if ((obuf = Fopen(mailname, "r+")) == NULL) {
343 warn("%s", mailname);

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

380 return (0);
381}
382
383/*
384 * Terminate an editing session by attempting to write out the user's
385 * file from the temporary. Save any new stuff appended to the file.
386 */
387void
389edstop()
388edstop(void)
390{
391 int gotcha, c;
392 struct message *mp;
393 FILE *obuf, *ibuf, *readstat;
394 struct stat statb;
395 char tempname[PATHSIZE];
396
397 if (readonly)

--- 98 unchanged lines hidden ---
389{
390 int gotcha, c;
391 struct message *mp;
392 FILE *obuf, *ibuf, *readstat;
393 struct stat statb;
394 char tempname[PATHSIZE];
395
396 if (readonly)

--- 98 unchanged lines hidden ---