LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-04-2010, 08:39 PM   #1
pr_deltoid
Member
 
Registered: Jun 2010
Distribution: Fedora
Posts: 289

Rep: Reputation: 41
Underscores in standard functions, an example section from cat.c is included.


From cat.c in GNU coreutils:
Code:
void
usage (int status)
{
  if (status != EXIT_SUCCESS)
    fprintf (stderr, _("Try `%s --help' for more information.\n"),
             program_name);
  else
    {
      printf (_("\
Usage: %s [OPTION]... [FILE]...\n\
"),
              program_name);
      fputs (_("\
Why haven't I read about this yet? I've never seen this in examples and I don't understand why I haven't. Why is an underscore here:
fprintf (stderr, _("Try `%s --help' for more information.\n")

Why are there underscores here:
printf (_("\
fputs (_("\

I don't remember ever seeing this in any examples I've ever seen, so I'm sure I've never seen an explanation of this.

Last edited by pr_deltoid; 09-04-2010 at 08:45 PM.
 
Old 09-04-2010, 10:49 PM   #2
estabroo
Senior Member
 
Registered: Jun 2008
Distribution: debian, ubuntu, sidux
Posts: 1,126
Blog Entries: 2

Rep: Reputation: 124Reputation: 124
looks like it's just a macro to call gettext, presumably for internationalization.

from system.h (which is included in cat.c)
#define _(msgid) gettext (msgid)
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to install new drivers NOT included in standard distro - pref via the GUI FL Guy Puppy 2 05-31-2010 05:51 PM
LXer: Ext4 to be standard for Fedora 11, Btrfs also included LXer Syndicated Linux News 0 01-23-2009 01:01 AM
Functions #included don't want to behave MattFunke Programming 4 11-12-2007 09:14 AM
What desktop (included in the standard Slackware install) do you use? cwwilson721 Slackware 96 09-02-2006 06:52 AM
Console standard iInput functions yrauchwerger Programming 1 05-23-2006 02:52 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:11 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration