Other Features of inc

[previous] [next] [table of contents] [index]

By now, you've used inc. It has some useful switches that we haven't covered, though.

If you need to keep track of the mail you get, inc -audit will make a log file. The -silent switch prevents the usual scan of messages incorporated. Use -nochangecur when you don't want the current message reset. Your new messages don't have to go in the inbox folder -- you can give inc another folder name. inc also works across a network with POP; the Section Using MH with POP has a quick introduction.

Logging New Mail with -audit

inc can keep an audit file of all the mail you incorporate. By default, it's kept in your MH directory. The log shows when you typed inc as well as scan lines for each message that's incorporated. Here's a piece of an audit file named inc_log. It shows two incs -- the first brought in two messages, and the second brought one more:
% cd Mail
% cat inc_log
<<inc>> Mon, 09 Jan 1995 08:22:45 -0600
  45+ 01/09 root               <<The job you submitted to at,
  46  01/09 Jim Bob Smith      Re: Encapsulation destroying go
<<inc>> Mon, 09 Jan 1995 10:53:38 -0600
  47+ 01/09 Al Bok             Printer<<I am on the VAX system
To get more information, you can use a scan format file with inc. There are a few standard files or you can make your own format file to log just the information you want. For example, here's a line of the audit file made by the standard scan.time format file. Compare it to the lines in the previous example:
<<inc>> Mon, 09 Jan 1995 17:48:10 -0600
  48+ 01/09 17:23EST Samantha Singer    Test<<This is a test m
To use an audit file, put the name of the file -- and, if you want one, the scan format file -- in your MH profile:
inc: -audit inc_log -form scan.time

Not Using +inbox

Most users use inbox as a place to sort out new mail and, often, to refile it to other folders. If you want inc to drop the new mail into another folder, you have two choices.

In MH 6.8 and above, inc checks your MH profile for an Inbox: entry. If there is one, inc uses that folder instead of inbox.

In all versions of MH, you can put a folder name on the command line:

% inc +project
Incorporating new mail into project...
    ...
In versions of MH before 6.8, if you want to use another folder every time you run inc, you can add +foldername to the inc: entry in your MH profile. But then you won't be able to choose another folder on the command line; you'll get the error inc: only one folder at a time!. That's because, like most MH commands, inc gets all the arguments from both the MH profile and the command line. If you have that problem, try using shell aliases for inc.

Less-used inc Features

Although these features aren't used often, they'll help people with specialized needs.

Keeping inc Quiet

The -silent switch tells inc to bring in any new mail without showing the scan listing. If there's no mail, it will tell you; otherwise, inc won't display anything.

But if you have an audit file set up, -silent also prevents logging the individual messages in that file. All you'll get is the single time-stamp line:

<<inc>> Mon, 09 Jan 1995 18:04:37 -0600
If you want inc to be silent on the terminal but also to write a complete audit file, try this command line (assuming you have the inc: -audit entry set in your MH profile):
% inc >/dev/null
That throws the scan lines which would be on your screen into the UNIX "garbage can" named /dev/null. It still shows the message inc: No mail to incorporate on your screen if there's no mail. You can't put >/dev/null in your MH profile, but you can add a shell alias so that it happens each time you use inc. In csh, for instance:
alias inc '\inc >/dev/null'

inc -nochangecur

Normally, inc changes the current message to be the first one you incorporate. The -nochangecur switch stops that -- inc will still add the new mail to your inbox folder, but it'll leave the current message as it was.

Other Mailboxes

By default, inc reads mail from your default system mailbox -- for example, the file with your username in the /usr/spool/mail directory. There are three ways to change that.

If New Messages Arrive

If your system is busy or you're incorporating a lot of messages, this may happen:
% inc
Incorporating new mail into inbox...
 143+ 01/09 To:al@phlabs.ph.co New MH feature<<Al, scan has
	...
 450  01/13 mom@home.org       Where are you?<<I've sent yo
inc: new messages have arrived!
%
The new messages have arrived! means that, while inc was reading from your system mailbox and writing into your inbox folder, your system mailbox was modified somehow. Usually, that's because the system mail transfer agent has written new messages into the system mailbox.

Normally, inc truncates ("zeros") the system mailbox when it's done. Because inc doesn't want to miss a message, it won't truncate the system mailbox if new messages have arrived. If this happens, make a note of the first and last messages you just incorporated. Run inc again; the same messages -- and the messages that just arrived -- will be incorporated again. To delete the duplicates, remove the messages you incorporated first:

% inc
Incorporating new mail into inbox...
 451+ 01/09 To:al@phlabs.ph.co New MH feature<<Al, scan has
	...
 757  01/13 mom@home.org       Where are you?<<I've sent yo
 758  01/13 Al Bok             More new MH features<<Now I
% rmm 143-450

[Table of Contents] [Index] [Previous: Checking for Mail Waiting: msgchk] [Next: Using MH with POP]


Last change $Date: 1996/06/06 15:12:05 $

This file is from the third edition of the book MH & xmh: Email for Users & Programmers, ISBN 1-56592-093-7, by Jerry Peek. Copyright © 1991, 1992, 1995 by O'Reilly & Associates, Inc. This file is freely-available; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. For more information, see the file copying.htm.

Suggestions are welcome: Jerry Peek <jpeek@jpeek.com>