Skip to content

Getting 404 errors every time on cht.exe, same command works using curl #7

@jbrown123

Description

@jbrown123

I have the latest cht.exe (just downloaded moments ago) in my path. No matter what I request or how I request it I always get a 404 error.

When I uses cht c/strlen I get the following:

c:\>cht c/strlen
/*
 * 404 NOT FOUND
 *
 * Unknown cheat sheet. Please try to reformulate your query.
 * Query format:
 */

 /LANG/QUESTION

/* Examples: */

 /python/read+json
 /golang/run+external+program
 /js/regex+search

/*
 * See /:help for more info.
 *
 * If the problem persists, file a GitHub issue at
 * github.com/chubin/cheat.sh or ping @igor_chubin
 */

Asking with space instead of a slash also doesn't work.

c:\>cht c strlen
/*
 * 404 NOT FOUND
 *
 * Unknown cheat sheet. Please try to reformulate your query.
 * Query format:
 */

 /LANG/QUESTION

/* Examples: */

 /python/read+json
 /golang/run+external+program
 /js/regex+search

/*
 * See /:help for more info.
 *
 * If the problem persists, file a GitHub issue at
 * github.com/chubin/cheat.sh or ping @igor_chubin
 */

Same if I just ask for a unix command like shutdown:

c:\>cht shutdown
/*
 * 404 NOT FOUND
 *
 * Unknown cheat sheet. Please try to reformulate your query.
 * Query format:
 */

 /LANG/QUESTION

/* Examples: */

 /python/read+json
 /golang/run+external+program
 /js/regex+search

/*
 * See /:help for more info.
 *
 * If the problem persists, file a GitHub issue at
 * github.com/chubin/cheat.sh or ping @igor_chubin
 */

However, if I use curl for the same queries, it works fine:

c:\>curl cht.sh/shutdown
 cheat:shutdown
# To reboot the system immediately:
shutdown -r now

# To shut system down immediately:
shutdown -h now

# To reboot system after 5 minutes:
shutdown -r +5

# To cancel a scheduled shutdown:
shutdown -c

 tldr:shutdown
# shutdown
# Shutdown and reboot the system.
# More information: <https://manned.org/shutdown.8>.

# Power off (halt) immediately:
shutdown -h now

# Reboot immediately:
shutdown -r now

# Reboot in 5 minutes:
shutdown -r +5 &

# Shutdown at 1:00 pm (Uses 24h clock):
shutdown -h 13:00

# Cancel a pending shutdown/reboot operation:
shutdown -c

or by language

c:\>curl cht.sh/c/strlen
/*
 * If you want to rewrite standard C function `strlen` then you should
 * follow [the declaration
 * conventions](http:www.iso-9899.info/n1570.html#7.24.6.3) of the
 * function.
 *
 * >     size_t strlen(const char *s);
 *
 * First of all it should have return type `size_t` and the parameter
 * shall have qualifier `const` that you could use the function with
 * constant character arrays.
 * Also such a name as `sum` is not very suitable for this function. In
 * your function you have too many local variables.
 *
 * I would write the function the following way
 */

 size_t strlen( const char *s )
 {
     size_t n = 0;

     while ( s[n] ) ++n;

     return n;
 }

/* The other way is to use only pointers. For example */

 size_t strlen( const char *s )
 {
     const char *p = s;

     while ( *p ) ++p;

     return p - s;
 }

/* [Vlad from Moscow] [so/q/26923117] [cc by-sa 3.0] */

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions