How to license programming code as open-source to say I am the author

licensing

I am just wondering. I've never licensed any code before and there is so many separate information about that I am a little bit confused;
I watched the codes which are published in the Internet and some of them contain their author name and license info so that makes the code some kind of personalized; So my question is… what author should do to be able to :

A) License his code

B) Say he is the code author

C) Place the code in Internet (apache web site or something in this direction)

D) Say it is under apache/GNU license or something?

I am talking about open-source and non-commercial licenses; And the most important thing is… should I patent the code before to prove I am the code owner to license it?

And what organization(s) I should join? In music it is something like ASCAP ( but in my case I don't mean commercial purposes);
but what about programming? Are there some societies which I can join to be sure I can prove the code I published (on their official site etc) is really mine?

Thanks

Best Answer

Look at existing free software. They generally have a comment with a license and a copyright owner. Often, there is a list of contributors.

For example, for GCC, the file gcc/gengtype-state.c starts with

 /* Gengtype persistent state serialization & de-serialization.
    Useful for gengtype in plugin mode.

    Copyright (C) 2010  Free Software Foundation, Inc.

    This file is part of GCC.

    GCC is free software; you can redistribute it and/or modify it under
    the terms of the GNU General Public License as published by the Free
    Software Foundation; either version 3, or (at your option) any later
    version.

    GCC is distributed in the hope that it will be useful, but WITHOUT ANY
    WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    for more details.

    You should have received a copy of the GNU General Public License
    along with GCC; see the file COPYING3.  If not see
    <http://www.gnu.org/licenses/>.

    Contributed by Jeremie Salvucci <jeremie.salvucci@free.fr>
    and Basile Starynkevitch <basile@starynkevitch.net>
 */

See also this answer (to a question related to yours). The GPLv3 seems to require such comments. An example of GPLv3 code with the copyright owner same as the author is onion/onion.c from the onion HTTP server library.

Caveat: I am not a lawyer

Regarding organizations to join, you might be interested by the FSF or some free software "user" organization (like April or Aful in France; perhaps you could find the equivalent in your country).

My preference is for GPLv3 or LGPLv3 licenses.