wanted: decent MOTD

Discuss anything to do with Nexuiz here.

Moderators: Nexuiz Moderators, Moderators

wanted: decent MOTD

Postby tChr » Sat Mar 04, 2006 11:33 pm

I'd like to be able to set up a MOTD over more that one line, at lesat one that would wrap if the line got too long..
the spice extend life!
the spice expand conciousness!
the spice is vital to space travel!
sooooo.. tell me what you want, waht you really-really want
I will proceed directly to the intravenous injection of hard drugs, please.
tChr
Forum addon
 
Posts: 1501
Joined: Tue Feb 28, 2006 9:11 pm
Location: Trondheim, Norway

Postby KadaverJack » Sun Mar 05, 2006 12:20 am

Just insert \n wherever you want to have a linebreak...
KadaverJack
Site admin and forum addon
 
Posts: 1102
Joined: Tue Feb 28, 2006 9:42 pm

Postby tChr » Sun Mar 05, 2006 12:41 am

in 1.5 too? Cool.. Me and tZork were cursing about that when setting up the charging testservers :)

Why not \r\n btw?
the spice extend life!
the spice expand conciousness!
the spice is vital to space travel!
sooooo.. tell me what you want, waht you really-really want
I will proceed directly to the intravenous injection of hard drugs, please.
tChr
Forum addon
 
Posts: 1501
Joined: Tue Feb 28, 2006 9:11 pm
Location: Trondheim, Norway

Postby tZork » Sun Mar 05, 2006 12:46 am

If it does work its in 1.5.x

In 1.5 it does not, just prints out the \n
HOF:
<Diablo> the nex is a "game modification"
<Diablo> quake1 never had a weapon like that.
<Vordreller> there was no need for anything over 4GB untill Vista came along
<Samua>]Idea: Fix it? :D
<Samua>Lies, that only applies to other people.
tZork
tZite Admin
 
Posts: 1337
Joined: Tue Feb 28, 2006 6:16 pm
Location: Halfway to somwhere else

Postby KadaverJack » Sun Mar 05, 2006 1:18 am

tChr wrote:Why not \r\n btw?

Because \r\n is only for stupid OSes, that can't stick to existing standards [/rant]


tZork wrote:If it does work its in 1.5.x

In 1.5 it does not, just prints out the \n

d'oh! You're right, it doesn't work... (neither in 1.5 nor SVN)
I was quite certain that it would work :(
KadaverJack
Site admin and forum addon
 
Posts: 1102
Joined: Tue Feb 28, 2006 9:42 pm

Postby tChr » Sun Mar 05, 2006 1:52 am

KadaverJack wrote:
tChr wrote:Why not \r\n btw?

Because \r\n is only for stupid OSes, that can't stick to existing standards [/rant]

I hate to be the one to tell you this, but this is one of the very few places windows does it by standards, and Unix does not :) Standard internet newline (even pre-unix) is crlf, wich also makes much more sense, as cr should take you to the beginning of the line and lf should take you one down, nothing more :)

For an interesting anecdote read the jargon files intry about Unix brain-damage http://www.catb.org/jargon/html/U/Unix-brain-damage.html
the spice extend life!
the spice expand conciousness!
the spice is vital to space travel!
sooooo.. tell me what you want, waht you really-really want
I will proceed directly to the intravenous injection of hard drugs, please.
tChr
Forum addon
 
Posts: 1501
Joined: Tue Feb 28, 2006 9:11 pm
Location: Trondheim, Norway

Postby Lardarse » Sun Mar 05, 2006 11:11 am

Sorry KJ, but he's right...
Lardarse
Member
 
Posts: 13
Joined: Tue Feb 28, 2006 9:55 pm
Location: Bristol, UK

Postby divVerent » Sun Mar 05, 2006 8:42 pm

"the nice thing about standards is that there are so many to choose from"

ISO C99 for example defines \n another way:
5.2.2 Character display semantics

...

2. Alphabetic escape sequences representing nongraphic characters in the execution character set are intended to produce actions on display devices as follows:
  • ...
  • \n (new line) Moves the active position to the initial position of the next line.
  • \r (carriage return) Moves the active position to the initial position of the current line.
  • ...


And yes, if you are on Windows and C and write "foo\n" to a file opened in "text mode", it will output the bytes 0x0D and 0x0A (CR and LF). If you, OTOH, output "\r\n" on Windows, you will actually write CR CR LF.

Now talk about \r\n being right. \n is _always_ the line delimiter - but when writing to a file, \n could expand to more than one byte. Only PHP kiddies[tm] think \r\n is the right way to end a line... in "proper" code, it's either \n and opening the file in text mode, or \x0D\x0A and opening the file in binary mode.

Disclaimer: when using POSIX output functions like write(), binary mode is assumed. So Darkplaces is doing it right ;)
1. Open Notepad
2. Paste: ÿþMSMSMS
3. Save
4. Open the file in Notepad again

You can vary the number of "MS", so you can clearly see it's MS which is causing it.
divVerent
Site admin and keyboard killer
 
Posts: 3809
Joined: Thu Mar 02, 2006 4:46 pm
Location: BRLOGENSHFEGLE

Postby esteel » Tue Mar 07, 2006 8:46 pm

KadaverJack wrote:d'oh! You're right, it doesn't work... (neither in 1.5 nor SVN)
I was quite certain that it would work :(

I think its because \n inside a string is special in (Q)C.. if you just set the variable sv_motd to "foo\nbar" the \n is just normal text. I suppose we have to split the string in QC..
Last edited by esteel on Thu Aug 31, 2006 2:34 pm, edited 1 time in total.
esteel
Site admin and forum addon
 
Posts: 3924
Joined: Wed Mar 01, 2006 8:27 am

Postby tChr » Tue Mar 07, 2006 8:48 pm

esteel wrote:
KadaverJack wrote:d'oh! You're right, it doesn't work... (neither in 1.5 nor SVN)
I was quite certain that it would work :(

I think its because \n inside a string is special in (Q)C.. if you just set the variable sv_motd to "foo\nbar" the \n is just normal text. I suppose we have to split the string in QC..

Or make auto-wrapping.. or is that hard?
the spice extend life!
the spice expand conciousness!
the spice is vital to space travel!
sooooo.. tell me what you want, waht you really-really want
I will proceed directly to the intravenous injection of hard drugs, please.
tChr
Forum addon
 
Posts: 1501
Joined: Tue Feb 28, 2006 9:11 pm
Location: Trondheim, Norway

Next

Return to Nexuiz - General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron