Re: &array[0] vs array

2017-03-30 Thread Nicholas Mc Guire
On Thu, Mar 30, 2017 at 09:04:35AM -0400, Ruben Safir wrote:
> On 03/29/2017 08:30 PM, Tobin C. Harding wrote:
> > Does the kernel community have a preference when using the address of
> > the first element of an an array?
> > 
> > 1. addr = &array[0]
> > 2. addr = array;
> > 
> > $ grep '\&.*\[0\]' | wc -l
> > 10077
> > 
> > style (1) is clearly used, I was not able to grep for instances where
> > style (2) is used.
> 
> maybe there is a another reason why 2 is not used.
>
the second form is used - just not quite as often  
with the below quick (and probably incomplete) coccinelle script you 
can find a few hundred occurences of the second form in linux-next 


virtual report

@v2@
identifier array,addr;
type T;
position p;
@@

(
* T array[];
|
* T array[] = ...;
)
 ...
* addr = array@p
 
@script:python@
p << v2.p;
@@
print "%s:%s" % (p[0].file,p[0].line)


If its really obvious that its an array that you are manipulating
maybe the second version is fine - if its not so obvious the
first version makes it clear - and as readability is a key issue
for any complex code I suspect that readability explains the preference.

thx!
hofrat

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: &array[0] vs array

2017-03-30 Thread Ruben Safir
On 03/29/2017 08:30 PM, Tobin C. Harding wrote:
> Does the kernel community have a preference when using the address of
> the first element of an an array?
> 
> 1. addr = &array[0]
> 2. addr = array;
> 
> $ grep '\&.*\[0\]' | wc -l
> 10077
> 
> style (1) is clearly used, I was not able to grep for instances where
> style (2) is used.

maybe there is a another reason why 2 is not used.

-- 
So many immigrant groups have swept through our town
that Brooklyn, like Atlantis, reaches mythological
proportions in the mind of the world - RI Safir 1998
http://www.mrbrklyn.com

DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002
http://www.nylxs.com - Leadership Development in Free Software
http://www2.mrbrklyn.com/resources - Unpublished Archive
http://www.coinhangout.com - coins!
http://www.brooklyn-living.com

Being so tracked is for FARM ANIMALS and and extermination camps,
but incompatible with living as a free human being. -RI Safir 2013

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Error while sending a mail from mutt

2017-03-30 Thread Okash Khawaja

> How do I see what arguments are being sent by mutt to sendmail.

In ~/.muttrc, where it says

set sendmail=...

Replace the argument with your custom script which logs all arguments passed to 
it. 

> Is there any quicker way by which I can get mutt working fine.

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Error while sending a mail from mutt

2017-03-30 Thread Alexander Kapshuk
On Wed, Mar 29, 2017 at 10:32 PM, AYAN KUMAR HALDER
 wrote:
> Hi,
>
> I am trying to send a mail using mutt. I am getting the error as follows :-
>
> SMTP session failed: 501 5.5.4
>
> I understand the error meant that a valid mail transaction protocol
> was used with invalid arguments. Please let me know how do I debug
> this issue further.
>
> Regards,
> Ayan Kumar Halder
>
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

I've set up mutt to use Gmail using the instructions given here:
https://dev.mutt.org/trac/wiki/UseCases/Gmail
https://wiki.archlinux.org/index.php/mutt#Summary

Hope this helps.

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Error while sending a mail from mutt

2017-03-30 Thread AYAN KUMAR HALDER
On Thu, Mar 30, 2017 at 3:15 AM, Okash Khawaja  wrote:
>
>> On 29 Mar 2017, at 21:19, Jim Davis  wrote:
>>
>> On Wed, Mar 29, 2017 at 12:32 PM, AYAN KUMAR HALDER
>>  wrote:
>>> Hi,
>>>
>>> I am trying to send a mail using mutt. I am getting the error as follows :-
>>>
>>> SMTP session failed: 501 5.5.4
>>>
>>> I understand the error meant that a valid mail transaction protocol
>>> was used with invalid arguments. Please let me know how do I debug
>>> this issue further.
>>
>> Mutt usually invokes some other program to send mail -- on my
>> workstation, for instance, that other program is /usr/sbin/sendmail:
>>
>> [jim@krebstar ~]$ mutt -v | grep '^SENDMAIL'
>> SENDMAIL="/usr/sbin/sendmail"
>>
>> so to debug a similar problem on my workstation I'd first look to see
>> where sendmail (or whatever program your mutt installation uses) logs
>> its messages.
>>
>> That used to be in /var/log/maillog or such; nowadays you might have
>> to run journalctl instead.
>>
>> For example, if I try
>>
>> mutt postmas...@example.com >
>> on my workstation, then
>>
>> journalctl | grep sendmail
>>
>> tells me
>>
>> Mar 29 12:59:06 krebstar.arl.arizona.edu sendmail[27263]:
>> v2TJx61J027263: to=postmas...@example.com, ctladdr=jim (1000/1000),
>> delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30294,
>> relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection
>> refused by [127.0.0.1]
>>
>> which reminds me I don't actually have the sendmail service running.
>
> You can check ~/.muttrc file to see what it is using to send emails. If it is 
> using sendmail or esmtp, then in .muttrc file where it specifies sending 
> program you can append -X /path/to/log/file. That will output the whole SMTP 
> dialog to that log file.

In my case, I get the following error messages in /var/log/mail.log
Mar 30 15:39:55 ayankh-X553SA postfix/sendmail[24765]: fatal: usage:
sendmail [options]
Mar 30 15:40:17 ayankh-X553SA postfix/sendmail[24891]: fatal: usage:
sendmail [options]

How do I see what arguments are being sent by mutt to sendmail.
Is there any quicker way by which I can get mutt working fine.

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies