• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Protecting Software w/ Software License Keys...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Protecting Software w/ Software License Keys...


  • Subject: Re: Protecting Software w/ Software License Keys...
  • From: Gibbons Burke <email@hidden>
  • Date: Tue, 18 Jun 2002 09:24:00 -0500

At 6:22 AM -0700 6/18/02, Joe Morris wrote:
>I was thinking a good way to do this would be to base it on the user's username. That way other people could copy it relatively easily, but they'd have to create a new account with that username and switch to that to use it, which would be as deterring as anything is likely to get. :-)
>
>Anyone know off the top of their head how to get the current user's username progromatically?

The classic UNIX command "whoami" will do the trick, but that has been superceded by the "id" command.

These may be executed using the standard C function "system (char *s)", so:

The following code in the main.c file of a "Standard Tool" application template created in Project Builder shows how it works:

<begin main.c>
#include <stdio.h>

int main (int argc, const char * argv[]) {
printf("%s", system("id -p"));
return 0;
}
<end main.c>

See the man page for the "id" command for the various options. If you just want the string for the user's name, that command is "id -un" which is equivalent to the "whoami" command.

Gibbons Burke
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Protecting Software w/ Software License Keys...
      • From: Cryx <email@hidden>
    • Re: Protecting Software w/ Software License Keys...
      • From: Malte Tancred <email@hidden>
References: 
 >Re: Protecting Software w/ Software License Keys... (From: Joe Morris <email@hidden>)

  • Prev by Date: Re: Protecting Software w/ Software License Keys...
  • Next by Date: Re: Getting a list of processes in a network
  • Previous by thread: Re: Protecting Software w/ Software License Keys...
  • Next by thread: Re: Protecting Software w/ Software License Keys...
  • Index(es):
    • Date
    • Thread