Unix Technical Forum

You know you've had to much to drink, when....

This is a discussion on You know you've had to much to drink, when.... within the Slackware Linux Support forums, part of the Unix Operating Systems category; --> ....you keep entering cu - and still don't get root access and spend 40 more minutes trying to figure ...


Go Back   Unix Technical Forum > Unix Operating Systems > Slackware Linux Support

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-21-2008, 04:33 AM
notbob
 
Posts: n/a
Default You know you've had to much to drink, when....

....you keep entering cu - and still don't get root access and spend 40
more minutes trying to figure out why.

Damn $2CHK!

nb
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-21-2008, 04:33 AM
Chris Sorenson
 
Posts: n/a
Default Re: You know you've had to much to drink, when....

notbob wrote:
> ...you keep entering cu - and still don't get root access and spend 40
> more minutes trying to figure out why.
>
> Damn $2CHK!
>


How 'bout a diff to su:

if isWorking(/dev/breathalizer)
{
int number = user->blow()

if (number > .08) {
printf("No root for you!\n")
exit(1);
}
}

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-21-2008, 04:33 AM
notbob
 
Posts: n/a
Default Re: You know you've had to much to drink, when....

On 2007-08-15, Chris Sorenson <csoren@isd.net> wrote:

> How 'bout a diff to su:
>
> if isWorking(/dev/breathalizer)
> {
> int number = user->blow()
>
> if (number > .08) {
> printf("No root for you!\n")
> exit(1);
> }
> }


LOL!.....

nb
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-21-2008, 04:33 AM
~kurt
 
Posts: n/a
Default Re: You know you've had to much to drink, when....

Chris Sorenson <csoren@isd.net> wrote:
>
> if (number > .08) {
> printf("No root for you!\n")
> exit(1);
> }


How 'bout making it a bit more reasonable:

if (number > .12) {

- Kurt
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-21-2008, 04:33 AM
Yeti
 
Posts: n/a
Default Re: You know you've had to much to drink, when....

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chris Sorenson wrote:

> if (number > .08) {
> printf("No root for you!\n")
> exit(1);


I got a "breathalizer" from my mother recently (still can't figure out
why) and it's some El Cheapo Chinese model that has just two LEDs (one
of them two-color). When the two-color one goes red, you're drunk (or
something like that). So just a binary operation would be needed:

if isWorking(/dev/breathalizer)
{
bool number = user->blow()

if (number = 1) {
printf("No root for you!\n")
exit(1);
}
}

(Sorry for any mistakes, I can't speak C at all
Yeti
- --
This message is best viewed with open eyes.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGxDq9Py/9LATNIMwRAvi5AJwO1EC9sudFpd14ug/7z4Xz+GK4pgCdHyHw
bBiIdSlF/q1FkELqmASdL74=
=dE4T
-----END PGP SIGNATURE-----
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-21-2008, 04:33 AM
Ayaz Ahmed Khan
 
Posts: n/a
Default Re: You know you've had to much to drink, when....

"Yeti" typed:

> if isWorking(/dev/breathalizer)
> {
> bool number = user->blow()
>
> if (number = 1) {
> printf("No root for you!\n")
> exit(1);
> }
> }


With that, you will always be found to be drunk (and without root).

--
Ayaz Ahmed Khan
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 02-21-2008, 04:33 AM
Loki Harfagr
 
Posts: n/a
Default Re: You know you've had to much to drink, when....

Thu, 16 Aug 2007 17:04:25 +0500, Ayaz Ahmed Khan did catÂ*:

> "Yeti" typed:
>
>> if isWorking(/dev/breathalizer)
>> {
>> bool number = user->blow()
>>
>> if (number = 1) {
>> printf("No root for you!\n")
>> exit(1);
>> }
>> }

>
> With that, you will always be found to be drunk (and without root).


which from this shown tendency to test variables out of scope
and use assignments in place of tests is probably
safer ;-)

Personally my foolproof test to check if I'd better not
use 'root' is to try and open a file:

# vi smurf

if I get this output I know I'm well done:-)

smurf,v <-- smurf
ci: smurf: No such file or directory
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 02-21-2008, 04:33 AM
Chris Sorenson
 
Posts: n/a
Default Re: You know you've had to much to drink, when....

Loki Harfagr wrote:
> Thu, 16 Aug 2007 17:04:25 +0500, Ayaz Ahmed Khan did cat :
>
>
>>"Yeti" typed:
>>
>>
>>>if isWorking(/dev/breathalizer)
>>>{
>>> bool number = user->blow()
>>>
>>> if (number = 1) {
>>> printf("No root for you!\n")
>>> exit(1);
>>> }
>>>}

>>
>>With that, you will always be found to be drunk (and without root).

>
>
> which from this shown tendency to test variables out of scope
> and use assignments in place of tests is probably
> safer ;-)
>


Plus there's no bool data type in C (C++ yes but that sucks and is
evil!).

Everyone missed the boo-boo in my initial code, number should have been
declared float not int...

> Personally my foolproof test to check if I'd better not
> use 'root' is to try and open a file:
>
> # vi smurf
>
> if I get this output I know I'm well done:-)
>
> smurf,v <-- smurf
> ci: smurf: No such file or directory


That would work for me because I'd never try to use vi unless I
was already quite inebriated!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 02-21-2008, 04:33 AM
CBFalconer
 
Posts: n/a
Default Re: You know you've had to much to drink, when....

Chris Sorenson wrote:
>

.... snip ...
>>>
>>>> if isWorking(/dev/breathalizer) {
>>>> bool number = user->blow()
>>>>
>>>> if (number = 1) {
>>>> printf("No root for you!\n")
>>>> exit(1);
>>>> }
>>>> }

.... snip ...
>
> Everyone missed the boo-boo in my initial code, number should
> have been declared float not int...


Then the equality test (assuming a mistype) is very iffy.

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>



--
Posted via a free Usenet account from http://www.teranews.com

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 02-21-2008, 04:33 AM
Chris Sorenson
 
Posts: n/a
Default Re: You know you've had to much to drink, when....

On Aug 17, 3:05 pm, CBFalconer <cbfalco...@yahoo.com> wrote:

> >>>> if (number = 1) {

>
> Then the equality test (assuming a mistype) is very iffy.
>


Yup, Yeti made that change and it is a mistype. Ayaz caught it too.
Since Yeti changed it to a bool all he needed is 'if(number)'

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:32 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com