Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6336553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:04:46+00:00 2026-05-24T19:04:46+00:00

I noticed this in open source code files for DRBD software ( user/drbdtool_common.c )

  • 0

I noticed this in open source code files for DRBD software (user/drbdtool_common.c)

const char* shell_escape(const char* s)
{
    /* ugly static buffer. so what. */
    static char buffer[1024];
    char *c = buffer;

    if (s == NULL)
        return s;

    while (*s) {
        if (buffer + sizeof(buffer) < c+2)
            break;

        switch(*s) {
        /* set of 'clean' characters */
        case '%': case '+': case '-': case '.': case '/':
        case '0' ... '9':
        case ':': case '=': case '@':
        case 'A' ... 'Z':
        case '_':
        case 'a' ... 'z':
            break;
        /* escape everything else */
        default:
            *c++ = '\\';
        }
        *c++ = *s++;
    }
    *c = '\0';
    return buffer;
}

I have never seen this “triple dot” construction (case '0' ... '9':) in C before. Is it a valid standard C language? Or is that some kind of preprocessor magic? What’s going on here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T19:04:47+00:00Added an answer on May 24, 2026 at 7:04 pm

    As others have said, this is a compiler-specific extension. Invoke the compiler with the right options (say, gcc -std=c99 -pedantic), and it should warn you about it.

    I’ll also point out that its use is potentially dangerous, apart from the fact that another compiler might not implement it. 'a' ... 'z' denotes the 26 lowercase letters — but the C Standard doesn’t guarantee that their values are contiguous. In EBCDIC, for example, there are punctuation characters among the letters.

    On the other hand, I doubt that either gcc or Sun C supports systems that use a character set in which the letters aren’t contiguous. (They are in ASCII and all its derivatives, including Latin-1, Windows-1252, and Unicode.)

    On the other other hand, it excludes accented letters. (Depending on how DRBD is used, that may or may not be an issue.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was taking a look through some open-source C++ code and I noticed a
So I was looking at an open source's csproj file and noticed this: <ProjectExtensions>
Today, looking at the man page for open() , I've noticed this function is
I was just writing some quick code and noticed this complier error Using the
Prescript: The amazing etherpad was recently open sourced. Get it here: http://code.google.com/p/etherpad . This
I got an .ipa file from a customer (without source code access). This app
Noticed this today when a patch was submitted with the following line: lblCompletionTime.Text =
Just noticed this on OSX and I found it curious as I expected long
I noticed This question , but my question is a bit more specific. Is
I just noticed this about a week ago. I'm storing data about the current

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.